Lines Matching defs:fd
113 int fd, olen, nlen, rw;
128 fd = open(fname, O_RDWR);
129 if (fd == -1) {
134 for (pos = 0; read(fd, &ips, sizeof(ips)) == sizeof(ips); ) {
145 if (lseek(fd, pos, SEEK_SET) != pos) {
149 if (write(fd, &ips, sizeof(ips)) != sizeof(ips)) {
154 pos = lseek(fd, 0, SEEK_CUR);
156 close(fd);
168 int fd, olen, nlen, rw;
185 fd = open(fname, O_RDWR);
186 if (fd == -1) {
191 for (pos = 0; read(fd, &ipn, sizeof(ipn)) == sizeof(ipn); ) {
202 if (lseek(fd, pos, SEEK_SET) != pos) {
206 if (write(fd, &ipn, sizeof(ipn)) != sizeof(ipn)) {
211 pos = lseek(fd, 0, SEEK_CUR);
213 close(fd);
359 int fd = -1;
367 if ((fd = open(ipfdev, O_RDWR)) == -1)
368 if ((fd = open(ipfdev, O_RDONLY)) == -1)
371 if (setzone(fd) != 0) {
372 close(fd);
373 fd = -1;
376 return fd;
380 void closedevice(fd)
381 int fd;
383 close(fd);
387 int setlock(fd, lock)
388 int fd, lock;
393 if (ioctl(fd, SIOCSTLCK, &lock) == -1) {
404 int writestate(fd, file)
405 int fd;
435 if (ioctl(fd, SIOCSTGET, &obj)) {
456 int readstate(fd, file)
457 int fd;
545 if (ioctl(fd, SIOCSTPUT, &obj)) {
563 int readnat(fd, file)
564 int fd;
680 if (ioctl(fd, SIOCSTPUT, &obj)) {
699 int writenat(fd, file)
700 int fd;
726 if (ioctl(fd, SIOCSTGSZ, &ng)) {
755 if (ioctl(fd, SIOCSTGET, &obj)) {
786 int fd, devfd;
797 fd = opendevice(NULL);
798 if (fd == -1)
800 if (setlock(fd, 1)) {
801 close(fd);
819 if (setlock(fd, 0)) {
820 close(fd);
824 close(fd);
828 setlock(fd, 0);
829 close(fd);
837 int fd, devfd;
847 fd = opendevice(NULL);
848 if (fd == -1)
850 if (setlock(fd, 1)) {
851 close(fd);
869 if (setlock(fd, 0)) {
870 close(fd);