Lines Matching refs:fd

81 void stty_telos(int fd);
84 void slip_send(int fd, unsigned char c);
85 void slip_send_char(int fd, unsigned char c);
387 int status, i, fd = -1; in get_slipfd() local
419 if((fd = socket(p->ai_family, p->ai_socktype, in get_slipfd()
425 if(connect(fd, p->ai_addr, p->ai_addrlen) == -1) { in get_slipfd()
426 close(fd); in get_slipfd()
438 fcntl(fd, F_SETFL, O_NONBLOCK); in get_slipfd()
449 fd = devopen(siodev, O_RDWR | O_NONBLOCK); in get_slipfd()
450 if(fd == -1) { in get_slipfd()
461 fd = devopen(siodev, O_RDWR | O_NONBLOCK); in get_slipfd()
462 if(fd != -1) { in get_slipfd()
466 if(fd == -1) { in get_slipfd()
477 stty_telos(fd); in get_slipfd()
480 slip_send(fd, SLIP_END); in get_slipfd()
481 inslip = fdopen(fd, "r"); in get_slipfd()
487 slipfd = fd; in get_slipfd()
498 slip_send_char(int fd, unsigned char c) in slip_send_char() argument
502 slip_send(fd, SLIP_ESC); in slip_send_char()
503 slip_send(fd, SLIP_ESC_END); in slip_send_char()
506 slip_send(fd, SLIP_ESC); in slip_send_char()
507 slip_send(fd, SLIP_ESC_ESC); in slip_send_char()
510 slip_send(fd, c); in slip_send_char()
516 slip_send(int fd, unsigned char c) in slip_send() argument
532 slip_flushbuf(int fd) in slip_flushbuf() argument
541 n = write(fd, slip_buf + slip_begin, (slip_end - slip_begin)); in slip_flushbuf()
635 stty_telos(int fd) in stty_telos() argument
641 if(tcflush(fd, TCIOFLUSH) == -1) err(1, "tcflush"); in stty_telos()
643 if(tcgetattr(fd, &tty) == -1) err(1, "tcgetattr"); in stty_telos()
660 if(tcsetattr(fd, TCSAFLUSH, &tty) == -1) err(1, "tcsetattr"); in stty_telos()
667 if(tcsetattr(fd, TCSAFLUSH, &tty) == -1) err(1, "tcsetattr"); in stty_telos()
677 if(tcflush(fd, TCIOFLUSH) == -1) err(1, "tcflush"); in stty_telos()
683 int fd = open(dev, flags); in devopen_readlink() local
685 if (fd < 0) { in devopen_readlink()
691 return fd; /* We failed to readlink, return original error code. */ in devopen_readlink()
699 return fd; in devopen_readlink()
723 int fd, err; in tun_alloc() local
728 if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) { in tun_alloc()
743 if((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) { in tun_alloc()
744 close(fd); in tun_alloc()
748 return fd; in tun_alloc()