mount_procfs.c revision 1.7
11.7Sjtc/* $NetBSD: mount_procfs.c,v 1.7 1996/04/13 01:31:59 jtc Exp $ */ 21.6Scgd 31.2Spk/* 41.4Scgd * Copyright (c) 1990, 1992, 1993 Jan-Simon Pendry 51.5Smycroft * Copyright (c) 1992, 1993, 1994 61.4Scgd * The Regents of the University of California. All rights reserved. 71.4Scgd * 81.4Scgd * This code is derived from software contributed to Berkeley by 91.4Scgd * Jan-Simon Pendry. 101.2Spk * 111.2Spk * Redistribution and use in source and binary forms, with or without 121.2Spk * modification, are permitted provided that the following conditions 131.2Spk * are met: 141.2Spk * 1. Redistributions of source code must retain the above copyright 151.2Spk * notice, this list of conditions and the following disclaimer. 161.2Spk * 2. Redistributions in binary form must reproduce the above copyright 171.2Spk * notice, this list of conditions and the following disclaimer in the 181.2Spk * documentation and/or other materials provided with the distribution. 191.2Spk * 3. All advertising materials mentioning features or use of this software 201.2Spk * must display the following acknowledgement: 211.4Scgd * This product includes software developed by the University of 221.4Scgd * California, Berkeley and its contributors. 231.4Scgd * 4. Neither the name of the University nor the names of its contributors 241.4Scgd * may be used to endorse or promote products derived from this software 251.4Scgd * without specific prior written permission. 261.2Spk * 271.4Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 281.4Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 291.4Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 301.4Scgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 311.4Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 321.4Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 331.4Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 341.4Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 351.4Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 361.4Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 371.4Scgd * SUCH DAMAGE. 381.2Spk */ 391.2Spk 401.5Smycroft#ifndef lint 411.5Smycroftchar copyright[] = 421.5Smycroft"@(#) Copyright (c) 1992, 1993, 1994\n\ 431.5Smycroft The Regents of the University of California. All rights reserved.\n"; 441.5Smycroft#endif /* not lint */ 451.5Smycroft 461.5Smycroft#ifndef lint 471.6Scgd#if 0 481.6Scgdstatic char sccsid[] = "@(#)mount_procfs.c 8.3 (Berkeley) 3/27/94"; 491.6Scgd#else 501.7Sjtcstatic char rcsid[] = "$NetBSD: mount_procfs.c,v 1.7 1996/04/13 01:31:59 jtc Exp $"; 511.6Scgd#endif 521.5Smycroft#endif /* not lint */ 531.5Smycroft 541.4Scgd#include <sys/param.h> 551.4Scgd#include <sys/mount.h> 561.4Scgd 571.5Smycroft#include <err.h> 581.4Scgd#include <unistd.h> 591.1Spk#include <stdio.h> 601.4Scgd#include <stdlib.h> 611.4Scgd#include <string.h> 621.4Scgd 631.5Smycroft#include "mntopts.h" 641.5Smycroft 651.7Sjtcconst struct mntopt mopts[] = { 661.5Smycroft MOPT_STDOPTS, 671.5Smycroft { NULL } 681.5Smycroft}; 691.5Smycroft 701.5Smycroftvoid usage __P((void)); 711.1Spk 721.1Spkint 731.4Scgdmain(argc, argv) 741.4Scgd int argc; 751.4Scgd char *argv[]; 761.1Spk{ 771.4Scgd int ch, mntflags; 781.1Spk 791.4Scgd mntflags = 0; 801.5Smycroft while ((ch = getopt(argc, argv, "o:")) != EOF) 811.5Smycroft switch (ch) { 821.5Smycroft case 'o': 831.5Smycroft getmntopts(optarg, mopts, &mntflags); 841.1Spk break; 851.4Scgd case '?': 861.1Spk default: 871.4Scgd usage(); 881.1Spk } 891.4Scgd argc -= optind; 901.4Scgd argv += optind; 911.1Spk 921.4Scgd if (argc != 2) 931.4Scgd usage(); 941.1Spk 951.5Smycroft if (mount(MOUNT_PROCFS, argv[1], mntflags, NULL)) 961.5Smycroft err(1, NULL); 971.4Scgd exit(0); 981.4Scgd} 991.1Spk 1001.4Scgdvoid 1011.4Scgdusage() 1021.4Scgd{ 1031.4Scgd (void)fprintf(stderr, 1041.5Smycroft "usage: mount_procfs [-o options] /proc mount_point\n"); 1051.4Scgd exit(1); 1061.1Spk} 107