- register int line = 0;
- int oldmask;
-#ifdef __STDC__
- void catchalarm(int);
-#else
- void catchalarm();
-#endif
-
- STRUCT *sc, *osc;
-
- nl[N_SOFTC].n_value += unit * sizeof(STRUCT);
- sc = (STRUCT *)malloc(sizeof(STRUCT));
- osc = (STRUCT *)malloc(sizeof(STRUCT));
-
- bzero((char *)osc, sizeof(STRUCT));
-
- while (1) {
-#ifndef KVMLIB
- if (klseek(kmem, (off_t)nl[N_SOFTC].n_value, 0) == -1) {
- perror("kmem seek");
- exit(1);
- }
- if (read(kmem, (char *)sc, sizeof(STRUCT)) <= 0) {
- perror("kmem read");
- exit(1);
- }
-#else
- if (kvm_read(KDARG nl[N_SOFTC].n_value, sc,
- sizeof(STRUCT)) != sizeof(STRUCT)) {
- perror("kvm_read");
- exit(1);
- }
-#endif
-
- (void)signal(SIGALRM, catchalarm);
- signalled = 0;
- (void)alarm(interval);
-
- if ((line % 20) == 0) {
- printf("%6.6s %6.6s %6.6s %6.6s %6.6s",
- "in", "pack", "comp", "uncomp", "err");
- if (vflag)
- printf(" %6.6s %6.6s", "toss", "ip");
- printf(" | %6.6s %6.6s %6.6s %6.6s %6.6s",
- "out", "pack", "comp", "uncomp", "ip");
- if (vflag)
- printf(" %6.6s %6.6s", "search", "miss");
- putchar('\n');
- }
+ register int line = 0;
+ int oldmask;
+ struct ifpppstatsreq req;
+ struct ppp_stats osc;
+
+ bzero(&osc, sizeof(osc));
+
+ sprintf(req.ifr_name, "ppp%d", unit);
+ while (1) {
+ if (ioctl(s, SIOCGPPPSTATS, &req) < 0) {
+ if (errno == ENOTTY)
+ fprintf(stderr, "pppstats: kernel support missing\n");
+ else
+ perror("ioctl(SIOCGPPPSTATS)");
+ exit(1);
+ }
+ (void)signal(SIGALRM, catchalarm);
+ signalled = 0;
+ (void)alarm(interval);