Lines Matching defs:fd
590 int fd;
597 if ((fd = open(_PATH_CONSOLE, O_RDWR | O_NONBLOCK)) != -1) {
598 (void)fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK);
599 if (login_tty(fd) == 0)
601 close(fd);
605 if ((fd = open(_PATH_DEVNULL, O_RDWR)) == -1) {
609 if (fd != STDIN_FILENO) {
610 dup2(fd, STDIN_FILENO);
611 close(fd);
613 fd = open(_PATH_INITLOG, O_WRONLY | O_APPEND | O_CREAT, 0644);
614 if (fd == -1)
616 else if (fd != STDOUT_FILENO) {
617 dup2(fd, STDOUT_FILENO);
618 close(fd);
648 int error, fd;
650 fd = open(path, O_RDONLY);
651 if (fd < 0) {
656 error = fstat(fd, &sb);
659 close(fd);
667 close(fd);
671 nbytes = read(fd, buf, bufsize);
674 close(fd);
679 error = close(fd);
696 int error, fd;
698 fd = open(path, O_WRONLY | O_CREAT | O_EXCL, 0700);
699 if (fd < 0) {
704 nbytes = write(fd, buf, bufsize);
707 close(fd);
711 error = close(fd);
1541 int fd;
1547 fd = open(sp->se_device, O_RDONLY | O_NONBLOCK, 0);
1548 if (fd < 0) {
1554 close(fd);