X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;ds=sidebyside;f=pppd%2Fsys-sunos4.c;h=8a1847faed8d67048b4798faa49a06c4d1ee5350;hb=ab7cff041f1b8054ae5691df236fe18c1d23bfe6;hp=ba2cc3c7953cd1e57071567464221018575863f1;hpb=fdc0c58f5a318a320f15e922f4df879b6bd75c71;p=ppp.git diff --git a/pppd/sys-sunos4.c b/pppd/sys-sunos4.c index ba2cc3c..8a1847f 100644 --- a/pppd/sys-sunos4.c +++ b/pppd/sys-sunos4.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-sunos4.c,v 1.16 1999/03/19 01:29:47 paulus Exp $"; +static char rcsid[] = "$Id: sys-sunos4.c,v 1.17 1999/03/19 04:23:50 paulus Exp $"; #endif #include @@ -617,6 +617,44 @@ wait_input(timo) fatal("poll: %m"); } +/* + * add_fd - add an fd to the set that wait_input waits for. + */ +void add_fd(fd) + int fd; +{ + int n; + + for (n = 0; n < n_pollfds; ++n) + if (pollfds[n].fd == fd) + return; + if (n_pollfds < MAX_POLLFDS) { + pollfds[n_pollfds].fd = fd; + pollfds[n_pollfds].events = POLLIN | POLLPRI | POLLHUP; + ++n_pollfds; + } else + error("Too many inputs!"); +} + +/* + * remove_fd - remove an fd from the set that wait_input waits for. + */ +void remove_fd(fd) + int fd; +{ + int n; + + for (n = 0; n < n_pollfds; ++n) { + if (pollfds[n].fd == fd) { + while (++n < n_pollfds) + pollfds[n-1] = pollfds[n]; + --n_pollfds; + break; + } + } +} + +#if 0 /* * wait_loop_output - wait until there is data available on the * loopback, for the length of time specified by *timo (indefinite @@ -643,7 +681,7 @@ wait_time(timo) if (n < 0 && errno != EINTR) fatal("select: %m"); } - +#endif /* * read_packet - get a PPP packet from the serial device. @@ -821,6 +859,21 @@ get_idle_time(u, ip) return strioctl(pppfd, PPPIO_GIDLE, ip, 0, sizeof(struct ppp_idle)) >= 0; } +/* + * get_ppp_stats - return statistics for the link. + */ +int +get_ppp_stats(u, stats) + int u; + struct ppp_stats *stats; +{ + if (strioctl(pppfd, PPPIO_GETSTAT, stats, 0, sizeof(*stats)) < 0) { + error("Couldn't get link statistics: %m"); + return 0; + } + return 1; +} + /* * ccp_fatal_error - returns 1 if decompression was disabled as a