]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-sunos4.c
remove a couple of ansi-C-isms.
[ppp.git] / pppd / sys-sunos4.c
index ba2cc3c7953cd1e57071567464221018575863f1..8a1847faed8d67048b4798faa49a06c4d1ee5350 100644 (file)
@@ -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 <stdio.h>
@@ -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