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)
446 Dupfd(int fd, int dfd)
449 * Make sure fd not one of 0, 1, or 2 to avoid stdio interference.
450 * Also, if dfd is greater than 2, dup fd to be exactly dfd.
452 if (dfd > 2 || (0 <= fd && fd <= 2)) {
453 if (dfd > 2 && fd != dfd)
457 if (fd != dfd) {
458 dfd = fcntl(fd, F_DUPFD, (intptr_t)dfd);
459 (void) close(fd);
460 fd = dfd;
467 (void) fcntl(fd, F_SETFD, (intptr_t)1);
468 return (fd);
489 int fd;
500 if ((fd = open(procname, omode, 0)) < 0 ||
501 (cp->asfd = Dupfd(fd, cp->asfd)) < 0)
505 if ((fd = open(procname, O_WRONLY, 0)) < 0 ||
506 (cp->ctlfd = Dupfd(fd, cp->ctlfd)) < 0)
510 if ((fd = open(procname, O_RDONLY, 0)) < 0 ||
511 (cp->statusfd = Dupfd(fd, cp->statusfd)) < 0)
711 int fd;
715 if ((fd = open(procname, O_RDONLY, 0)) < 0) {
719 (void) pread(fd, cp->user.u_psargs, PSARGSZ,
721 (void) close(fd);
733 int fd;
740 if ((fd = open(procname, O_RDONLY, 0)) >= 0) {
741 (void) read(fd, (char *)action, sizeof (action));
742 (void) close(fd);