- 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");
+ register int line = 0;
+ int oldmask;
+ struct ifpppstatsreq req;
+ struct ifpppcstatsreq creq;
+ struct ppp_stats osc;
+ struct ppp_comp_stats csc;
+
+ bzero(&osc, sizeof(osc));
+ bzero(&csc, sizeof(csc));
+
+ sprintf(req.ifr_name, "ppp%d", unit);
+ sprintf(creq.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);
+ }
+ if ((cflag || rflag) && ioctl(s, SIOCGPPPCSTATS, &creq) < 0) {
+ if (errno == ENOTTY) {
+ fprintf(stderr, "pppstats: no kernel compression support\n");
+ if (cflag)
+ exit(1);
+ rflag = 0;
+ } else {
+ perror("ioctl(SIOCGPPPCSTATS)");