|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include <sys/ioctl.h> ! 3: main() ! 4: { ! 5: struct passfd pass; ! 6: int fd, nfd; ! 7: char c; ! 8: extern int errno; ! 9: ! 10: if((fd=domount("quux"))<0) ! 11: exit(errno); ! 12: fprintf(stderr, "domount(quux) returns %d\n", fd); ! 13: for(;;) { ! 14: if (ioctl(fd, FIORCVFD, &pass)<0) { ! 15: close(fd); ! 16: exit(2); ! 17: } ! 18: fprintf(stderr, "ioctl(fd, FIORCVFD, &pass) returns %d\n",pass.fd); ! 19: nfd = pass.fd; ! 20: (void)ioctl(nfd, FIOACCEPT, &pass); ! 21: fprintf(stderr, "ioctl(fd, FIOACCEPT, &pass) returned\n"); ! 22: read(nfd, &c, 1); ! 23: close(nfd); ! 24: } ! 25: } ! 26: ! 27: domount(name) ! 28: char *name; ! 29: { ! 30: int pfd[2]; ! 31: extern int conn_ld; ! 32: ! 33: if (pipe(pfd) < 0) ! 34: return -1; ! 35: if (ioctl(pfd[1], FIOPUSHLD, &conn_ld) < 0) ! 36: return -1; ! 37: ! 38: /* mount */ ! 39: if (fmount(3, pfd[1], name, 0) < 0) ! 40: return -1; ! 41: close(pfd[1]); ! 42: return(pfd[0]); ! 43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.