Lines Matching refs:fd
39 int os_stat_fd(const int fd, struct uml_stat *ubuf) in os_stat_fd() argument
44 CATCH_EINTR(err = fstat64(fd, &sbuf)); in os_stat_fd()
84 int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) in os_ioctl_generic() argument
88 err = ioctl(fd, cmd, arg); in os_ioctl_generic()
96 int os_get_ifname(int fd, char* namebuf) in os_get_ifname() argument
98 if (ioctl(fd, SIOCGIFNAME, namebuf) < 0) in os_get_ifname()
104 int os_set_slip(int fd) in os_set_slip() argument
109 if (ioctl(fd, TIOCSETD, &disc) < 0) in os_set_slip()
113 if (ioctl(fd, SIOCSIFENCAP, &sencap) < 0) in os_set_slip()
119 int os_mode_fd(int fd, int mode) in os_mode_fd() argument
123 CATCH_EINTR(err = fchmod(fd, mode)); in os_mode_fd()
177 int fd, err, f = 0; in os_open_file() local
198 fd = open64(file, f, mode); in os_open_file()
199 if (fd < 0) in os_open_file()
202 if (flags.cl && fcntl(fd, F_SETFD, 1)) { in os_open_file()
204 close(fd); in os_open_file()
208 return fd; in os_open_file()
214 int fd, err; in os_connect_socket() local
219 fd = socket(AF_UNIX, SOCK_STREAM, 0); in os_connect_socket()
220 if (fd < 0) { in os_connect_socket()
225 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); in os_connect_socket()
231 return fd; in os_connect_socket()
234 close(fd); in os_connect_socket()
239 void os_close_file(int fd) in os_close_file() argument
241 close(fd); in os_close_file()
243 int os_fsync_file(int fd) in os_fsync_file() argument
245 if (fsync(fd) < 0) in os_fsync_file()
250 int os_seek_file(int fd, unsigned long long offset) in os_seek_file() argument
254 actual = lseek64(fd, offset, SEEK_SET); in os_seek_file()
260 int os_read_file(int fd, void *buf, int len) in os_read_file() argument
262 int n = read(fd, buf, len); in os_read_file()
269 int os_pread_file(int fd, void *buf, int len, unsigned long long offset) in os_pread_file() argument
271 int n = pread(fd, buf, len, offset); in os_pread_file()
278 int os_write_file(int fd, const void *buf, int len) in os_write_file() argument
280 int n = write(fd, (void *) buf, len); in os_write_file()
287 int os_sync_file(int fd) in os_sync_file() argument
289 int n = fsync(fd); in os_sync_file()
296 int os_pwrite_file(int fd, const void *buf, int len, unsigned long long offset) in os_pwrite_file() argument
298 int n = pwrite(fd, (void *) buf, len, offset); in os_pwrite_file()
319 int fd; in os_file_size() local
322 fd = open(file, O_RDONLY, 0); in os_file_size()
323 if (fd < 0) { in os_file_size()
329 if (ioctl(fd, BLKGETSIZE, &blocks) < 0) { in os_file_size()
333 close(fd); in os_file_size()
337 close(fd); in os_file_size()
360 int os_set_exec_close(int fd) in os_set_exec_close() argument
364 CATCH_EINTR(err = fcntl(fd, F_SETFD, FD_CLOEXEC)); in os_set_exec_close()
400 int os_set_fd_async(int fd) in os_set_fd_async() argument
404 flags = fcntl(fd, F_GETFL); in os_set_fd_async()
409 if (fcntl(fd, F_SETFL, flags) < 0) { in os_set_fd_async()
412 "and O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); in os_set_fd_async()
416 if ((fcntl(fd, F_SETSIG, SIGIO) < 0) || in os_set_fd_async()
417 (fcntl(fd, F_SETOWN, os_getpid()) < 0)) { in os_set_fd_async()
420 "(or F_SETSIG) fd %d, errno = %d\n", fd, errno); in os_set_fd_async()
427 int os_clear_fd_async(int fd) in os_clear_fd_async() argument
431 flags = fcntl(fd, F_GETFL); in os_clear_fd_async()
436 if (fcntl(fd, F_SETFL, flags) < 0) in os_clear_fd_async()
441 int os_set_fd_block(int fd, int blocking) in os_set_fd_block() argument
445 flags = fcntl(fd, F_GETFL); in os_set_fd_block()
454 if (fcntl(fd, F_SETFL, flags) < 0) in os_set_fd_block()
460 int os_accept_connection(int fd) in os_accept_connection() argument
464 new = accept(fd, NULL, 0); in os_accept_connection()
482 int os_shutdown_socket(int fd, int r, int w) in os_shutdown_socket() argument
495 err = shutdown(fd, what); in os_shutdown_socket()
501 int os_rcv_fd(int fd, int *helper_pid_out) in os_rcv_fd() argument
519 n = recvmsg(fd, &msg, 0); in os_rcv_fd()
573 int os_lock_file(int fd, int excl) in os_lock_file() argument
582 err = fcntl(fd, F_SETLK, &lock); in os_lock_file()
587 err = fcntl(fd, F_GETLK, &lock); in os_lock_file()
615 int os_falloc_punch(int fd, unsigned long long offset, int len) in os_falloc_punch() argument
617 int n = fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, offset, len); in os_falloc_punch()
626 int fd = eventfd(initval, flags); in os_eventfd() local
628 if (fd < 0) in os_eventfd()
630 return fd; in os_eventfd()
633 int os_sendmsg_fds(int fd, const void *buf, unsigned int len, const int *fds, in os_sendmsg_fds() argument
661 err = sendmsg(fd, &msg, 0); in os_sendmsg_fds()