Remove the fildesc_clone() function and its associated unnecessary code.

It didn't implement the proper /dev/fd functionality (which would be to
include in the directory listing /dev/fd/n if the process has fd n open)
anyway.

Anything needing access to /dev/fd/n where n > 2 can use the optional
fdescfs module, which implements this properly and does not cause any
trouble with devfs.

Discussed with:	phk
This commit is contained in:
Chris Costello 2001-08-06 05:56:33 +00:00
parent ae71ff3eb0
commit c30d4da338

View File

@ -1469,28 +1469,6 @@ SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW,
SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD,
&nfiles, 0, "System-wide number of open files");
static void
fildesc_clone(void *arg, char *name, int namelen, dev_t *dev)
{
int u;
if (*dev != NODEV)
return;
if (dev_stdclone(name, NULL, "fd/", &u) != 1)
return;
if (u <= 2)
return;
/* Don't clone higher than it makes sense */
if (u >= maxfilesperproc)
return;
/* And don't clone higher than our minors will support */
if (u > 0xffffff)
return;
u = unit2minor(u);
*dev = make_dev(&fildesc_cdevsw, u, UID_BIN, GID_BIN, 0666, name);
return;
}
static void
fildesc_drvinit(void *unused)
{
@ -1502,7 +1480,6 @@ fildesc_drvinit(void *unused)
make_dev_alias(dev, "stdout");
dev = make_dev(&fildesc_cdevsw, 2, UID_BIN, GID_BIN, 0666, "fd/2");
make_dev_alias(dev, "stderr");
EVENTHANDLER_REGISTER(dev_clone, fildesc_clone, 0, 1000);
if (!devfs_present) {
int fd;