diff options
author | ed <ed@FreeBSD.org> | 2010-01-27 11:54:42 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-01-27 11:54:42 +0000 |
commit | 93642d99973a88335db8126f637ce0b2ef249f6d (patch) | |
tree | 9f74dddfd54b164d4a996e250961b65d9b9d86f8 /lib | |
parent | 816304450375a4427d1b3354736d8d0110eaefdb (diff) | |
download | FreeBSD-src-93642d99973a88335db8126f637ce0b2ef249f6d.zip FreeBSD-src-93642d99973a88335db8126f637ce0b2ef249f6d.tar.gz |
Remove pseudo-terminals from ttys(5).
When we had utmp(5), we had to list all the psuedo-terminals in ttys(5)
to make ttyslot(3) function properly. Now that pututxline(3) deals with
slot allocation internally (not based on TTY names), we don't need to
list all the TTYs on the system in ttys(5) to make user accounting work
properly.
This patch removes all the entries from the /etc/ttys files, but also
the pts(4) entries that were appended implicitly, which was added in
r154838.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/getttyent.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c index 99d9821..9b9e3ea 100644 --- a/lib/libc/gen/getttyent.c +++ b/lib/libc/gen/getttyent.c @@ -38,17 +38,12 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <ctype.h> #include <string.h> -#include <dirent.h> -#include <paths.h> static char zapchar; static FILE *tf; -static int maxpts = -1; -static int curpts = 0; static size_t lbsize; static char *line; -#define PTS "pts/" #define MALLOCCHUNK 100 static char *skip(char *); @@ -73,7 +68,6 @@ struct ttyent * getttyent(void) { static struct ttyent tty; - static char devpts_name[] = "pts/4294967295"; char *p; int c; size_t i; @@ -81,19 +75,8 @@ getttyent(void) if (!tf && !setttyent()) return (NULL); for (;;) { - if (!fgets(p = line, lbsize, tf)) { - if (curpts <= maxpts) { - sprintf(devpts_name, "pts/%d", curpts++); - tty.ty_name = devpts_name; - tty.ty_getty = tty.ty_type = NULL; - tty.ty_status = TTY_NETWORK; - tty.ty_window = NULL; - tty.ty_comment = NULL; - tty.ty_group = _TTYS_NOGROUP; - return (&tty); - } + if (!fgets(p = line, lbsize, tf)) return (NULL); - } /* extend buffer if line was too big, and retry */ while (!index(p, '\n') && !feof(tf)) { i = strlen(p); @@ -219,29 +202,12 @@ value(char *p) int setttyent(void) { - DIR *devpts_dir; if (line == NULL) { if ((line = malloc(MALLOCCHUNK)) == NULL) return (0); lbsize = MALLOCCHUNK; } - devpts_dir = opendir(_PATH_DEV PTS); - if (devpts_dir) { - struct dirent *dp; - - maxpts = -1; - while ((dp = readdir(devpts_dir))) { - if (strcmp(dp->d_name, ".") != 0 && - strcmp(dp->d_name, "..") != 0) { - if (atoi(dp->d_name) > maxpts) { - maxpts = atoi(dp->d_name); - curpts = 0; - } - } - } - closedir(devpts_dir); - } if (tf) { rewind(tf); return (1); @@ -255,7 +221,6 @@ endttyent(void) { int rval; - maxpts = -1; /* * NB: Don't free `line' because getttynam() * may still be referencing it |