Lines Matching refs:fd
57 static bool write_sync(int fd, const void *data, size_t size) in write_sync() argument
63 len = write(fd, data + offset, size - offset); in write_sync()
159 static void init_term(int fd, struct termios *old) in init_term() argument
163 if (tcgetattr(fd, old) == -1) in init_term()
169 tcsetattr(fd, TCSANOW, &new_term); in init_term()
172 static void restore_term(int fd, struct termios *old) in restore_term() argument
174 tcsetattr(fd, TCSANOW, old); in restore_term()
177 static int console_loop(int fd, struct xs_handle *xs, char *pty_path, in console_loop() argument
192 if (fd != -1) FD_SET(fd, &fds); in console_loop()
193 if (fd > max_fd) max_fd = fd; in console_loop()
205 if (fd != -1) in console_loop()
206 close(fd); in console_loop()
210 fd = newfd; in console_loop()
231 if (!write_sync(fd, msg, len)) { in console_loop()
232 close(fd); in console_loop()
233 fd = -1; in console_loop()
238 if (fd != -1 && FD_ISSET(fd, &fds)) { in console_loop()
242 len = read(fd, msg, sizeof(msg)); in console_loop()
248 close(fd); in console_loop()
249 fd = -1; in console_loop()
284 int fd; in console_lock() local
289 fd = open(lockfile, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); in console_lock()
290 if (fd < 0) in console_lock()
293 while (flock(fd, LOCK_EX | LOCK_NB)) { in console_lock()
299 if (fstat(fd, &fstab)) in console_lock()
309 close(fd); in console_lock()
312 lockfd = fd; in console_lock()