X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-ultrix.c;h=009999eb2026a0b99fe299b04e332e94f150ed7e;hp=e4ed3e7f0ab0b85d0e9bd68267cc80d69e72cc05;hb=de87fc02dd7cc8518d50edfd9f9dd4a32bb74703;hpb=fdc0c58f5a318a320f15e922f4df879b6bd75c71 diff --git a/pppd/sys-ultrix.c b/pppd/sys-ultrix.c index e4ed3e7..009999e 100644 --- a/pppd/sys-ultrix.c +++ b/pppd/sys-ultrix.c @@ -20,9 +20,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef lint -static char rcsid[] = "$Id: sys-ultrix.c,v 1.28 1999/03/19 01:29:51 paulus Exp $"; -#endif +#define RCSID "$Id: sys-ultrix.c,v 1.33 1999/08/13 06:46:20 paulus Exp $" /* * TODO: @@ -52,6 +50,8 @@ static char rcsid[] = "$Id: sys-ultrix.c,v 1.28 1999/03/19 01:29:51 paulus Exp $ #include "pppd.h" +static const char rcsid[] = RCSID; + static int initdisc = -1; /* Initial TTY discipline for ppp_fd */ static int initfdflags = -1; /* Initial file descriptor flags for ppp_fd */ static int ppp_fd = -1; /* fd which is set to PPP discipline */ @@ -150,7 +150,7 @@ sys_check_options() return 1; } - +#if 0 /* * daemon - Detach us from the terminal session. */ @@ -174,6 +174,7 @@ daemon(nochdir, noclose) } return 0; } +#endif /* * ppp_available - check whether the system has any ppp interfaces @@ -586,7 +587,8 @@ wait_input(timo) /* * add_fd - add an fd to the set that wait_input waits for. */ -void add_fd(int fd) +void add_fd(fd) + int fd; { FD_SET(fd, &in_fds); if (fd > max_in_fd) @@ -596,7 +598,8 @@ void add_fd(int fd) /* * remove_fd - remove an fd from the set that wait_input waits for. */ -void remove_fd(int fd) +void remove_fd(fd) + int fd; { FD_CLR(fd, &in_fds); } @@ -793,6 +796,27 @@ get_idle_time(u, ip) return ioctl(ppp_fd, PPPIOCGIDLE, ip) >= 0; } +/* + * get_ppp_stats - return statistics for the link. + */ +int +get_ppp_stats(u, stats) + int u; + struct pppd_stats *stats; +{ + struct ifpppstatsreq req; + + memset (&req, 0, sizeof (req)); + strlcpy(req.ifr_name, interface, sizeof(req.ifr_name)); + if (ioctl(sockfd, SIOCGPPPSTATS, &req) < 0) { + error("Couldn't get PPP statistics: %m"); + return 0; + } + stats->bytes_in = req.stats.p.ppp_ibytes; + stats->bytes_out = req.stats.p.ppp_obytes; + return 1; +} + /* * sifvjcomp - config tcp header compression @@ -1275,9 +1299,9 @@ logwtmp(line, name, host) if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0) return; if (!fstat(fd, &buf)) { - strlcpy(ut.ut_line, line, sizeof(ut.ut_line)); - strlcpy(ut.ut_name, name, sizeof(ut.ut_name)); - strlcpy(ut.ut_host, host, sizeof(ut.ut_host)); + strncpy(ut.ut_line, line, sizeof(ut.ut_line)); + strncpy(ut.ut_name, name, sizeof(ut.ut_name)); + strncpy(ut.ut_host, host, sizeof(ut.ut_host)); (void)time(&ut.ut_time); if (write(fd, (char *)&ut, sizeof(struct utmp)) != sizeof(struct utmp)) (void)ftruncate(fd, buf.st_size); @@ -1285,6 +1309,7 @@ logwtmp(line, name, host) close(fd); } +#if 0 /* * Routines for locking and unlocking the serial device, moved here * from chat.c. @@ -1361,3 +1386,4 @@ unlock() lock_file = NULL; } } +#endif