Lines Matching refs:fd
169 int fd;
173 if ((fd = open(procname, O_WRONLY, 0)) < 0)
177 if (write(fd, (char *)&ctl, sizeof (long)+sizeof (sigset_t))
182 if (write(fd, (char *)&ctl, sizeof (long)+sizeof (fltset_t))
187 if (write(fd, (char *)&ctl, sizeof (long)+sizeof (sysset_t))
192 if (write(fd, (char *)&ctl, sizeof (long)+sizeof (sysset_t))
197 if (write(fd, (char *)&ctl, sizeof (long)+sizeof (long))
202 if (write(fd, (char *)&ctl, sizeof (long)+sizeof (long))
205 if (close(fd) != 0)
438 Dupfd(int fd, int dfd)
441 * Make sure fd not one of 0, 1, or 2 to avoid stdio interference.
442 * Also, if dfd is greater than 2, dup fd to be exactly dfd.
444 if (dfd > 2 || (0 <= fd && fd <= 2)) {
445 if (dfd > 2 && fd != dfd)
449 if (fd != dfd) {
450 dfd = fcntl(fd, F_DUPFD, (intptr_t)dfd);
451 (void) close(fd);
452 fd = dfd;
459 (void) fcntl(fd, F_SETFD, (intptr_t)1);
460 return (fd);
481 int fd;
492 if ((fd = open(procname, omode, 0)) < 0 ||
493 (cp->asfd = Dupfd(fd, cp->asfd)) < 0)
497 if ((fd = open(procname, O_WRONLY, 0)) < 0 ||
498 (cp->ctlfd = Dupfd(fd, cp->ctlfd)) < 0)
502 if ((fd = open(procname, O_RDONLY, 0)) < 0 ||
503 (cp->statusfd = Dupfd(fd, cp->statusfd)) < 0)
701 int fd;
705 if ((fd = open(procname, O_RDONLY, 0)) < 0) {
709 (void) pread(fd, cp->user.u_psargs, PSARGSZ,
711 (void) close(fd);
723 int fd;
730 if ((fd = open(procname, O_RDONLY, 0)) >= 0) {
731 (void) read(fd, (char *)action, sizeof (action));
732 (void) close(fd);