Lines Matching refs:fd
36 int os_stat_fd(const int fd, struct uml_stat *ubuf) in os_stat_fd() argument
41 CATCH_EINTR(err = fstat64(fd, &sbuf)); in os_stat_fd()
81 int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) in os_ioctl_generic() argument
85 err = ioctl(fd, cmd, arg); in os_ioctl_generic()
93 int os_get_ifname(int fd, char* namebuf) in os_get_ifname() argument
95 if (ioctl(fd, SIOCGIFNAME, namebuf) < 0) in os_get_ifname()
101 int os_set_slip(int fd) in os_set_slip() argument
106 if (ioctl(fd, TIOCSETD, &disc) < 0) in os_set_slip()
110 if (ioctl(fd, SIOCSIFENCAP, &sencap) < 0) in os_set_slip()
116 int os_mode_fd(int fd, int mode) in os_mode_fd() argument
120 CATCH_EINTR(err = fchmod(fd, mode)); in os_mode_fd()
174 int fd, err, f = 0; in os_open_file() local
195 fd = open64(file, f, mode); in os_open_file()
196 if (fd < 0) in os_open_file()
199 if (flags.cl && fcntl(fd, F_SETFD, 1)) { in os_open_file()
201 close(fd); in os_open_file()
205 return fd; in os_open_file()
211 int fd, err; in os_connect_socket() local
216 fd = socket(AF_UNIX, SOCK_STREAM, 0); in os_connect_socket()
217 if (fd < 0) { in os_connect_socket()
222 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); in os_connect_socket()
228 return fd; in os_connect_socket()
231 close(fd); in os_connect_socket()
236 void os_close_file(int fd) in os_close_file() argument
238 close(fd); in os_close_file()
240 int os_fsync_file(int fd) in os_fsync_file() argument
242 if (fsync(fd) < 0) in os_fsync_file()
247 int os_seek_file(int fd, unsigned long long offset) in os_seek_file() argument
251 actual = lseek64(fd, offset, SEEK_SET); in os_seek_file()
257 int os_read_file(int fd, void *buf, int len) in os_read_file() argument
259 int n = read(fd, buf, len); in os_read_file()
266 int os_write_file(int fd, const void *buf, int len) in os_write_file() argument
268 int n = write(fd, (void *) buf, len); in os_write_file()
275 int os_sync_file(int fd) in os_sync_file() argument
277 int n = fsync(fd); in os_sync_file()
297 int fd; in os_file_size() local
300 fd = open(file, O_RDONLY, 0); in os_file_size()
301 if (fd < 0) { in os_file_size()
307 if (ioctl(fd, BLKGETSIZE, &blocks) < 0) { in os_file_size()
311 close(fd); in os_file_size()
315 close(fd); in os_file_size()
338 int os_set_exec_close(int fd) in os_set_exec_close() argument
342 CATCH_EINTR(err = fcntl(fd, F_SETFD, FD_CLOEXEC)); in os_set_exec_close()
378 int os_set_fd_async(int fd) in os_set_fd_async() argument
382 flags = fcntl(fd, F_GETFL); in os_set_fd_async()
387 if (fcntl(fd, F_SETFL, flags) < 0) { in os_set_fd_async()
390 "and O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); in os_set_fd_async()
394 if ((fcntl(fd, F_SETSIG, SIGIO) < 0) || in os_set_fd_async()
395 (fcntl(fd, F_SETOWN, os_getpid()) < 0)) { in os_set_fd_async()
398 "(or F_SETSIG) fd %d, errno = %d\n", fd, errno); in os_set_fd_async()
405 int os_clear_fd_async(int fd) in os_clear_fd_async() argument
409 flags = fcntl(fd, F_GETFL); in os_clear_fd_async()
414 if (fcntl(fd, F_SETFL, flags) < 0) in os_clear_fd_async()
419 int os_set_fd_block(int fd, int blocking) in os_set_fd_block() argument
423 flags = fcntl(fd, F_GETFL); in os_set_fd_block()
432 if (fcntl(fd, F_SETFL, flags) < 0) in os_set_fd_block()
438 int os_accept_connection(int fd) in os_accept_connection() argument
442 new = accept(fd, NULL, 0); in os_accept_connection()
460 int os_shutdown_socket(int fd, int r, int w) in os_shutdown_socket() argument
473 err = shutdown(fd, what); in os_shutdown_socket()
479 int os_rcv_fd(int fd, int *helper_pid_out) in os_rcv_fd() argument
497 n = recvmsg(fd, &msg, 0); in os_rcv_fd()
551 int os_lock_file(int fd, int excl) in os_lock_file() argument
560 err = fcntl(fd, F_SETLK, &lock); in os_lock_file()
565 err = fcntl(fd, F_GETLK, &lock); in os_lock_file()