mount_procfs.c revision 1.4
11.2Spk/* 21.4Scgd * Copyright (c) 1990, 1992, 1993 Jan-Simon Pendry 31.4Scgd * Copyright (c) 1992, 1993 41.4Scgd * The Regents of the University of California. All rights reserved. 51.4Scgd * 61.4Scgd * This code is derived from software contributed to Berkeley by 71.4Scgd * Jan-Simon Pendry. 81.2Spk * 91.2Spk * Redistribution and use in source and binary forms, with or without 101.2Spk * modification, are permitted provided that the following conditions 111.2Spk * are met: 121.2Spk * 1. Redistributions of source code must retain the above copyright 131.2Spk * notice, this list of conditions and the following disclaimer. 141.2Spk * 2. Redistributions in binary form must reproduce the above copyright 151.2Spk * notice, this list of conditions and the following disclaimer in the 161.2Spk * documentation and/or other materials provided with the distribution. 171.2Spk * 3. All advertising materials mentioning features or use of this software 181.2Spk * must display the following acknowledgement: 191.4Scgd * This product includes software developed by the University of 201.4Scgd * California, Berkeley and its contributors. 211.4Scgd * 4. Neither the name of the University nor the names of its contributors 221.4Scgd * may be used to endorse or promote products derived from this software 231.4Scgd * without specific prior written permission. 241.2Spk * 251.4Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 261.4Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 271.4Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 281.4Scgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 291.4Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 301.4Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 311.4Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 321.4Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 331.4Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 341.4Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 351.4Scgd * SUCH DAMAGE. 361.2Spk * 371.4Scgd * from: @(#)mount_procfs.c 8.1 (Berkeley) 1/11/94 381.4Scgd * $Id: mount_procfs.c,v 1.4 1994/01/12 20:21:50 cgd Exp $ 391.2Spk */ 401.2Spk 411.4Scgd#include <sys/param.h> 421.4Scgd#include <sys/mount.h> 431.4Scgd 441.4Scgd#include <errno.h> 451.4Scgd#include <unistd.h> 461.1Spk#include <stdio.h> 471.4Scgd#include <stdlib.h> 481.4Scgd#include <string.h> 491.4Scgd 501.4Scgdvoid usage __P((void)); 511.1Spk 521.1Spkint 531.4Scgdmain(argc, argv) 541.4Scgd int argc; 551.4Scgd char *argv[]; 561.1Spk{ 571.4Scgd int ch, mntflags; 581.1Spk 591.4Scgd mntflags = 0; 601.4Scgd while ((ch = getopt(argc, argv, "F:")) != EOF) 611.4Scgd switch(ch) { 621.1Spk case 'F': 631.4Scgd mntflags = atoi(optarg); 641.1Spk break; 651.4Scgd case '?': 661.1Spk default: 671.4Scgd usage(); 681.1Spk } 691.4Scgd argc -= optind; 701.4Scgd argv += optind; 711.1Spk 721.4Scgd if (argc != 2) 731.4Scgd usage(); 741.1Spk 751.4Scgd if (mount(MOUNT_PROCFS, argv[1], mntflags, NULL)) { 761.4Scgd (void)fprintf(stderr, "mount_fdesc: %s\n", strerror(errno)); 771.4Scgd exit(1); 781.1Spk } 791.4Scgd exit(0); 801.4Scgd} 811.1Spk 821.4Scgdvoid 831.4Scgdusage() 841.4Scgd{ 851.4Scgd (void)fprintf(stderr, 861.4Scgd "usage: mount_procfs [ -F fsoptions ] /proc mount_point\n"); 871.4Scgd exit(1); 881.1Spk} 89