#include #include #include #include #include #include #include #include int fd = -1; lsctl_t lsctl; void init_ls() { if (fd > 0) close(fd); fd = open("/dev/lockstat", O_RDWR); if (fd < 0) { perror("opening /dev/lockstat"); exit(1); } if (write(fd, &lsctl, sizeof(lsctl)) != sizeof(lsctl)) { perror("writing lockstat control"); exit(1); } } void handle_data(char *buf, int rec_len, int rec_cnt) { lsrec_t *l; int i; for (i=0; i= lsctl.lc_nlocks) printf("Warning: lockstat module ran out of lock records.\n"); handle_data(buf, nlocks, lsctl.lc_recsize); } }