From a83f7ffd960ef95589b77e48387a3ea4447b96ea Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 20 Dec 2012 04:09:25 +0100 Subject: [PATCH] Remove the mknod(8) utility. Now that we have devfs(5), it's of no use anymore. --- Makefile_upgrade.inc | 3 + sbin/Makefile | 1 - sbin/mknod/Makefile | 8 --- sbin/mknod/mknod.8 | 119 ------------------------------ sbin/mknod/mknod.c | 156 ---------------------------------------- share/man/man5/devfs.5 | 5 -- usr.bin/mkfifo/mkfifo.1 | 3 +- 7 files changed, 4 insertions(+), 291 deletions(-) delete mode 100644 sbin/mknod/Makefile delete mode 100644 sbin/mknod/mknod.8 delete mode 100644 sbin/mknod/mknod.c diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 48e04173a3..273870cfca 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -2100,6 +2100,9 @@ TO_REMOVE+=/usr/share/man/cat2/upc_register.2.gz TO_REMOVE+=/usr/share/man/man2/upc_register.2.gz TO_REMOVE+=/usr/share/man/cat9/VFS_INIT.9.gz TO_REMOVE+=/usr/share/man/man9/VFS_INIT.9.gz +TO_REMOVE+=/sbin/mknod +TO_REMOVE+=/usr/share/man/cat8/mknod.8.gz +TO_REMOVE+=/usr/share/man/man8/mknod.8.gz .if ${MACHINE_ARCH} == "x86_64" TO_REMOVE+=/usr/sbin/stlstats diff --git a/sbin/Makefile b/sbin/Makefile index 8d5bf47f02..c8663fca1d 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -45,7 +45,6 @@ SUBDIR= adjkerntz \ ldconfig \ md5 \ mkinitrd \ - mknod \ mountctl \ mount \ mount_ufs \ diff --git a/sbin/mknod/Makefile b/sbin/mknod/Makefile deleted file mode 100644 index 81d321f12a..0000000000 --- a/sbin/mknod/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/5/93 -# $FreeBSD: src/sbin/mknod/Makefile,v 1.2.14.1 2001/04/25 10:58:32 ru Exp $ -# $DragonFly: src/sbin/mknod/Makefile,v 1.4 2006/10/17 00:55:42 pavalos Exp $ - -PROG= mknod -MAN= mknod.8 - -.include diff --git a/sbin/mknod/mknod.8 b/sbin/mknod/mknod.8 deleted file mode 100644 index ff90ce1bd4..0000000000 --- a/sbin/mknod/mknod.8 +++ /dev/null @@ -1,119 +0,0 @@ -.\" Copyright (c) 1980, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)mknod.8 8.2 (Berkeley) 12/11/93 -.\" $FreeBSD: src/sbin/mknod/mknod.8,v 1.11.2.10 2003/03/04 15:16:19 keramida Exp $ -.\" -.Dd December 11, 1993 -.Dt MKNOD 8 -.Os -.Sh NAME -.Nm mknod -.Nd build special file -.Sh SYNOPSIS -.Nm -.Ar name -.Op Cm c | Cm b -.Ar major minor -.Op Ar owner : Ns Ar group -.Sh DESCRIPTION -The -.Nm -utility creates device special files. -.Pp -To make nodes manually, the four required arguments are: -.Bl -tag -width indent -.It Ar name -Device name, for example -.Dq da -for a SCSI disk or a -.Dq pty -for pseudo-terminals. -.It Cm b | Cm c -Type of device. -If the -device is a block type device such as a tape or disk drive which needs -both cooked and raw special files, -the type is -.Cm b . -All other devices are character type devices, such as terminal -and pseudo devices, and are type -.Cm c . -.It Ar major -The major device number is an integer number which tells the kernel -which device driver entry point to use. -.It Ar minor -The minor device number tells the kernel which subunit -the node corresponds to on the device; for example, -a subunit may be a file system partition -or a tty line. -.It Ar owner : Ns Ar group -The -.Ar owner -.Ar group -operand pair is optional, however, if one is specified, they both must be -specified. -The -.Ar owner -may be either a numeric user ID or a user name. -If a user name is also a numeric user ID, the operand is used as a -user name. -The -.Ar group -may be either a numeric group ID or a group name. -Similar to the user name, -if a group name is also a numeric group ID, the operand is used as a -group name. -.El -.Pp -Major and minor device numbers can be given in any format acceptable to -.Xr strtoul 3 , -so that a leading -.Ql 0x -indicates a hexadecimal number, and a leading -.Ql 0 -will cause the number to be interpreted as octal. -.Sh COMPATIBILITY -The -.Xr chown 8 Ns - Ns -like functionality is specific to -.Dx -/ -.Fx . -.Sh SEE ALSO -.Xr mkfifo 1 , -.Xr mknod 2 , -.Xr chown 8 -.Sh HISTORY -A -.Nm -utility appeared in -.At v6 . diff --git a/sbin/mknod/mknod.c b/sbin/mknod/mknod.c deleted file mode 100644 index 0658ec996c..0000000000 --- a/sbin/mknod/mknod.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kevin Fall. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved. - * @(#)mknod.c 8.1 (Berkeley) 6/5/93 - * $FreeBSD: src/sbin/mknod/mknod.c,v 1.13 2000/01/06 17:51:46 obrien Exp $ - * $DragonFly: src/sbin/mknod/mknod.c,v 1.5 2005/01/01 23:09:57 cpressey Exp $ - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -static void -usage(void) -{ - - fprintf(stderr, - "usage: mknod name [b | c] major minor [owner:group]\n"); - exit(1); -} - -static u_long -id(char *name, const char *type) -{ - u_long val; - char *ep; - - /* - * XXX - * We know that uid_t's and gid_t's are unsigned longs. - */ - errno = 0; - val = strtoul(name, &ep, 10); - if (errno) - err(1, "%s", name); - if (*ep != '\0') - errx(1, "%s: illegal %s name", name, type); - return (val); -} - -static gid_t -a_gid(char *s) -{ - struct group *gr; - - if (*s == '\0') /* Argument was "uid[:.]". */ - errx(1, "group must be specified when the owner is"); - return ((gr = getgrnam(s)) == NULL) ? id(s, "group") : gr->gr_gid; -} - -static uid_t -a_uid(char *s) -{ - struct passwd *pw; - - if (*s == '\0') /* Argument was "[:.]gid". */ - errx(1, "owner must be specified when the group is"); - return ((pw = getpwnam(s)) == NULL) ? id(s, "user") : pw->pw_uid; -} - -int -main(int argc, char **argv) -{ - int range_error; - uid_t uid; - gid_t gid; - mode_t mode; - dev_t dev; - char *cp, *endp; - long mymajor, myminor; - - if (argc != 5 && argc != 6) - usage(); - - mode = 0666; - if (argv[2][0] == 'c') - mode |= S_IFCHR; - else if (argv[2][0] == 'b') - mode |= S_IFBLK; - else - errx(1, "node must be type 'b' or 'c'"); - - errno = 0; - mymajor = (long)strtoul(argv[3], &endp, 0); - if (endp == argv[3] || *endp != '\0') - errx(1, "%s: non-numeric major number", argv[3]); - range_error = errno; - errno = 0; - myminor = (long)strtoul(argv[4], &endp, 0); - if (endp == argv[4] || *endp != '\0') - errx(1, "%s: non-numeric minor number", argv[4]); - range_error |= errno; - dev = makedev(mymajor, myminor); - if (range_error || major(dev) != mymajor || - minor(dev) != myminor) - errx(1, "major or minor number too large"); - - uid = gid = -1; - if (6 == argc) { - /* have owner:group */ - if ((cp = strchr(argv[5], ':')) != NULL) { - *cp++ = '\0'; - gid = a_gid(cp); - } else - usage(); - uid = a_uid(argv[5]); - } - - if (mknod(argv[1], mode, dev) != 0) - err(1, "%s", argv[1]); - if (6 == argc) - if (chown(argv[1], uid, gid)) - err(1, "setting ownership on %s", argv[1]); - exit(0); -} diff --git a/share/man/man5/devfs.5 b/share/man/man5/devfs.5 index dcd81517bd..f423b47ac1 100644 --- a/share/man/man5/devfs.5 +++ b/share/man/man5/devfs.5 @@ -64,11 +64,6 @@ environment, can be used to create a new .Pa /dev mount point. -.\".Pp -.\"The -.\".Xr mknod 8 -.\"tool can be used to recover deleted device entries under -.\".Nm . .Sh FILES .Bl -tag -width /dev/XXXX -compact .It Pa /dev diff --git a/usr.bin/mkfifo/mkfifo.1 b/usr.bin/mkfifo/mkfifo.1 index 022492676a..d5e2177d53 100644 --- a/usr.bin/mkfifo/mkfifo.1 +++ b/usr.bin/mkfifo/mkfifo.1 @@ -86,8 +86,7 @@ utility requires write permission in the parent directory. .Xr mkdir 1 , .Xr rm 1 , .Xr mkfifo 2 , -.Xr mknod 2 , -.Xr mknod 8 +.Xr mknod 2 .Sh STANDARDS The .Nm -- 2.41.0