diff options
author | gjb <gjb@FreeBSD.org> | 2016-03-02 16:14:46 +0000 |
---|---|---|
committer | gjb <gjb@FreeBSD.org> | 2016-03-02 16:14:46 +0000 |
commit | 955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d (patch) | |
tree | 9c83d6fb30867514fbcff33f80605a1fb118d720 /libexec | |
parent | 4719e40f5bedd0f88591120e071741635f07993b (diff) | |
parent | 774a6245596e60bf04f03e8cccab06a3194504f5 (diff) | |
download | FreeBSD-src-955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d.zip FreeBSD-src-955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d.tar.gz |
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/Makefile | 5 | ||||
-rw-r--r-- | libexec/dma/dmagent/Makefile.depend | 8 | ||||
-rw-r--r-- | libexec/ftpd/Makefile.depend | 2 | ||||
-rw-r--r-- | libexec/getty/subr.c | 33 | ||||
-rw-r--r-- | libexec/mail.local/Makefile.depend | 2 | ||||
-rw-r--r-- | libexec/rlogind/rlogind.c | 66 | ||||
-rw-r--r-- | libexec/rtld-elf/paths.h | 2 | ||||
-rw-r--r-- | libexec/smrsh/Makefile.depend | 2 | ||||
-rw-r--r-- | libexec/ypxfr/Makefile.depend | 8 |
9 files changed, 40 insertions, 88 deletions
diff --git a/libexec/Makefile b/libexec/Makefile index a8ace18..b60cc34 100644 --- a/libexec/Makefile +++ b/libexec/Makefile @@ -5,7 +5,6 @@ SUBDIR= ${_atf} \ ${_atrun} \ - ${_casper} \ ${_comsat} \ ${_dma} \ getty \ @@ -38,10 +37,6 @@ _atrun= atrun SUBDIR+= bootpd .endif -.if ${MK_CASPER} != "no" -_casper= casper -.endif - .if ${MK_FINGER} != "no" SUBDIR+= fingerd .endif diff --git a/libexec/dma/dmagent/Makefile.depend b/libexec/dma/dmagent/Makefile.depend index 226aa40..46c0054 100644 --- a/libexec/dma/dmagent/Makefile.depend +++ b/libexec/dma/dmagent/Makefile.depend @@ -19,12 +19,4 @@ DIRDEPS = \ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # local dependencies - needed for -jN in clean tree -aliases_parse.o: aliases_parse.c -aliases_parse.o: aliases_parse.h -aliases_parse.po: aliases_parse.c -aliases_parse.po: aliases_parse.h -aliases_scan.o: aliases_parse.h -aliases_scan.o: aliases_scan.c -aliases_scan.po: aliases_parse.h -aliases_scan.po: aliases_scan.c .endif diff --git a/libexec/ftpd/Makefile.depend b/libexec/ftpd/Makefile.depend index 0c70593..5480d1d 100644 --- a/libexec/ftpd/Makefile.depend +++ b/libexec/ftpd/Makefile.depend @@ -24,6 +24,4 @@ DIRDEPS = \ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # local dependencies - needed for -jN in clean tree -ftpcmd.o: ftpcmd.c -ftpcmd.po: ftpcmd.c .endif diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c index 992280a..4716e97 100644 --- a/libexec/getty/subr.c +++ b/libexec/getty/subr.c @@ -38,14 +38,16 @@ static const char rcsid[] = /* * Melbourne getty. */ -#include <stdlib.h> -#include <string.h> -#include <termios.h> -#include <unistd.h> #include <sys/ioctl.h> #include <sys/param.h> #include <sys/time.h> + +#include <poll.h> +#include <stdlib.h> +#include <string.h> #include <syslog.h> +#include <termios.h> +#include <unistd.h> #include "gettytab.h" #include "pathnames.h" @@ -71,7 +73,7 @@ gettable(const char *name, char *buf) static int firsttime = 1; dba[0] = _PATH_GETTYTAB; - dba[1] = 0; + dba[1] = NULL; if (firsttime) { /* @@ -593,7 +595,7 @@ struct portselect { { "B4800", "std.4800" }, { "B9600", "std.9600" }, { "B19200", "std.19200" }, - { 0 } + { NULL, NULL } }; const char * @@ -602,7 +604,7 @@ portselector(void) char c, baud[20]; const char *type = "default"; struct portselect *ps; - int len; + size_t len; alarm(5*60); for (len = 0; len < sizeof (baud) - 1; len++) { @@ -633,24 +635,21 @@ portselector(void) const char * autobaud(void) { - int rfds; - struct timeval timeout; + struct pollfd set[1]; + struct timespec timeout; char c; const char *type = "9600-baud"; (void)tcflush(0, TCIOFLUSH); - rfds = 1 << 0; - timeout.tv_sec = 5; - timeout.tv_usec = 0; - if (select(32, (fd_set *)&rfds, (fd_set *)NULL, - (fd_set *)NULL, &timeout) <= 0) + set[0].fd = STDIN_FILENO; + set[0].events = POLLIN; + if (poll(set, 1, 5000) <= 0) return (type); if (read(STDIN_FILENO, &c, sizeof(char)) != sizeof(char)) return (type); timeout.tv_sec = 0; - timeout.tv_usec = 20; - (void) select(32, (fd_set *)NULL, (fd_set *)NULL, - (fd_set *)NULL, &timeout); + timeout.tv_nsec = 20000; + (void)nanosleep(&timeout, NULL); (void)tcflush(0, TCIOFLUSH); switch (c & 0377) { diff --git a/libexec/mail.local/Makefile.depend b/libexec/mail.local/Makefile.depend index 9e38097..33b2f79 100644 --- a/libexec/mail.local/Makefile.depend +++ b/libexec/mail.local/Makefile.depend @@ -17,6 +17,4 @@ DIRDEPS = \ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # local dependencies - needed for -jN in clean tree -mail.local.o: sm_os.h -mail.local.po: sm_os.h .endif diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c index d64d7bf..f054970 100644 --- a/libexec/rlogind/rlogind.c +++ b/libexec/rlogind/rlogind.c @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <libutil.h> #include <paths.h> +#include <poll.h> #include <pwd.h> #include <syslog.h> #include <stdio.h> @@ -350,34 +351,27 @@ protocol(int f, int p) nfd = f + 1; else nfd = p + 1; - if (nfd > FD_SETSIZE) { - syslog(LOG_ERR, "select mask too small, increase FD_SETSIZE"); - fatal(f, "internal error (select mask too small)", 0); - } for (;;) { - fd_set ibits, obits, ebits, *omask; - - FD_ZERO(&ebits); - FD_ZERO(&ibits); - FD_ZERO(&obits); - omask = (fd_set *)NULL; - if (fcc) { - FD_SET(p, &obits); - omask = &obits; - } else - FD_SET(f, &ibits); + struct pollfd set[2]; + + set[0].fd = p; + set[0].events = POLLPRI; + set[1].fd = f; + set[1].events = 0; + if (fcc) + set[0].events |= POLLOUT; + else + set[1].events |= POLLIN; if (pcc >= 0) { - if (pcc) { - FD_SET(f, &obits); - omask = &obits; - } else - FD_SET(p, &ibits); + if (pcc) + set[1].events |= POLLOUT; + else + set[0].events |= POLLIN; } - FD_SET(p, &ebits); - if ((n = select(nfd, &ibits, omask, &ebits, 0)) < 0) { + if ((n = poll(set, 2, INFTIM)) < 0) { if (errno == EINTR) continue; - fatal(f, "select", 1); + fatal(f, "poll", 1); } if (n == 0) { /* shouldn't happen... */ @@ -385,18 +379,16 @@ protocol(int f, int p) continue; } #define pkcontrol(c) ((c)&(TIOCPKT_FLUSHWRITE|TIOCPKT_NOSTOP|TIOCPKT_DOSTOP)) - if (FD_ISSET(p, &ebits)) { + if (set[0].revents & POLLPRI) { cc = read(p, &cntl, 1); if (cc == 1 && pkcontrol(cntl)) { cntl |= oobdata[0]; send(f, &cntl, 1, MSG_OOB); - if (cntl & TIOCPKT_FLUSHWRITE) { + if (cntl & TIOCPKT_FLUSHWRITE) pcc = 0; - FD_CLR(p, &ibits); - } } } - if (FD_ISSET(f, &ibits)) { + if (set[1].revents & POLLIN) { fcc = read(f, fibuf, sizeof(fibuf)); if (fcc < 0 && errno == EWOULDBLOCK) fcc = 0; @@ -422,11 +414,10 @@ protocol(int f, int p) goto top; /* n^2 */ } } - FD_SET(p, &obits); /* try write */ } } - if (FD_ISSET(p, &obits) && fcc > 0) { + if (set[0].revents & POLLOUT && fcc > 0) { cc = write(p, fbp, fcc); if (cc > 0) { fcc -= cc; @@ -434,7 +425,7 @@ protocol(int f, int p) } } - if (FD_ISSET(p, &ibits)) { + if (set[0].revents & POLLIN) { pcc = read(p, pibuf, sizeof (pibuf)); pbp = pibuf; if (pcc < 0 && errno == EWOULDBLOCK) @@ -443,7 +434,6 @@ protocol(int f, int p) break; else if (pibuf[0] == 0) { pbp++, pcc--; - FD_SET(f, &obits); /* try write */ } else { if (pkcontrol(pibuf[0])) { pibuf[0] |= oobdata[0]; @@ -452,18 +442,8 @@ protocol(int f, int p) pcc = 0; } } - if ((FD_ISSET(f, &obits)) && pcc > 0) { + if (set[1].revents & POLLOUT && pcc > 0) { cc = write(f, pbp, pcc); - if (cc < 0 && errno == EWOULDBLOCK) { - /* - * This happens when we try write after read - * from p, but some old kernels balk at large - * writes even when select returns true. - */ - if (!FD_ISSET(p, &ibits)) - sleep(5); - continue; - } if (cc > 0) { pcc -= cc; pbp += cc; diff --git a/libexec/rtld-elf/paths.h b/libexec/rtld-elf/paths.h index 7d9d372..69b1d03 100644 --- a/libexec/rtld-elf/paths.h +++ b/libexec/rtld-elf/paths.h @@ -52,7 +52,7 @@ #endif #ifndef STANDARD_LIBRARY_PATH -#define STANDARD_LIBRARY_PATH "/lib:/usr/lib" +#define STANDARD_LIBRARY_PATH "/lib/casper:/lib:/usr/lib" #endif #ifndef LD_ diff --git a/libexec/smrsh/Makefile.depend b/libexec/smrsh/Makefile.depend index 518da5b..0cb1420 100644 --- a/libexec/smrsh/Makefile.depend +++ b/libexec/smrsh/Makefile.depend @@ -16,6 +16,4 @@ DIRDEPS = \ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # local dependencies - needed for -jN in clean tree -smrsh.o: sm_os.h -smrsh.po: sm_os.h .endif diff --git a/libexec/ypxfr/Makefile.depend b/libexec/ypxfr/Makefile.depend index 6a84a3f..bdd7bc2 100644 --- a/libexec/ypxfr/Makefile.depend +++ b/libexec/ypxfr/Makefile.depend @@ -19,12 +19,4 @@ DIRDEPS = \ .if ${DEP_RELDIR} == ${_DEP_RELDIR} # local dependencies - needed for -jN in clean tree -yp_clnt.o: yp.h -yp_clnt.o: yp_clnt.c -yp_clnt.po: yp.h -yp_clnt.po: yp_clnt.c -ypxfr_clnt.o: yp.h -ypxfr_clnt.o: ypxfr_clnt.c -ypxfr_clnt.po: yp.h -ypxfr_clnt.po: ypxfr_clnt.c .endif |