Lines Matching full:fd

44 int os_stat_fd(const int fd, struct uml_stat *ubuf)  in os_stat_fd()  argument
49 CATCH_EINTR(err = fstat64(fd, &sbuf)); in os_stat_fd()
89 int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) in os_ioctl_generic() argument
93 err = ioctl(fd, cmd, arg); in os_ioctl_generic()
101 int os_get_ifname(int fd, char* namebuf) in os_get_ifname() argument
103 if (ioctl(fd, SIOCGIFNAME, namebuf) < 0) in os_get_ifname()
109 int os_set_slip(int fd) in os_set_slip() argument
114 if (ioctl(fd, TIOCSETD, &disc) < 0) in os_set_slip()
118 if (ioctl(fd, SIOCSIFENCAP, &sencap) < 0) in os_set_slip()
124 int os_mode_fd(int fd, int mode) in os_mode_fd() argument
128 CATCH_EINTR(err = fchmod(fd, mode)); in os_mode_fd()
182 int fd, err, f = 0; in os_open_file() local
203 fd = open64(file, f, mode); in os_open_file()
204 if (fd < 0) in os_open_file()
207 if (flags.cl && fcntl(fd, F_SETFD, 1)) { in os_open_file()
209 close(fd); in os_open_file()
213 return fd; in os_open_file()
219 int fd, err; in os_connect_socket() local
224 fd = socket(AF_UNIX, SOCK_STREAM, 0); in os_connect_socket()
225 if (fd < 0) { in os_connect_socket()
230 err = connect(fd, (struct sockaddr *) &sock, sizeof(sock)); in os_connect_socket()
236 return fd; in os_connect_socket()
239 close(fd); in os_connect_socket()
244 int os_dup_file(int fd) in os_dup_file() argument
246 int new_fd = dup(fd); in os_dup_file()
254 void os_close_file(int fd) in os_close_file() argument
256 close(fd); in os_close_file()
259 int os_seek_file(int fd, unsigned long long offset) in os_seek_file() argument
263 actual = lseek64(fd, offset, SEEK_SET); in os_seek_file()
269 int os_read_file(int fd, void *buf, int len) in os_read_file() argument
271 int n = read(fd, buf, len); in os_read_file()
278 int os_pread_file(int fd, void *buf, int len, unsigned long long offset) in os_pread_file() argument
280 int n = pread(fd, buf, len, offset); in os_pread_file()
287 int os_write_file(int fd, const void *buf, int len) in os_write_file() argument
289 int n = write(fd, (void *) buf, len); in os_write_file()
296 int os_sync_file(int fd) in os_sync_file() argument
298 int n = fdatasync(fd); in os_sync_file()
305 int os_pwrite_file(int fd, const void *buf, int len, unsigned long long offset) in os_pwrite_file() argument
307 int n = pwrite(fd, (void *) buf, len, offset); in os_pwrite_file()
328 int fd; in os_file_size() local
331 fd = open(file, O_RDONLY, 0); in os_file_size()
332 if (fd < 0) { in os_file_size()
338 if (ioctl(fd, BLKGETSIZE, &blocks) < 0) { in os_file_size()
342 close(fd); in os_file_size()
346 close(fd); in os_file_size()
369 int os_set_exec_close(int fd) in os_set_exec_close() argument
373 CATCH_EINTR(err = fcntl(fd, F_SETFD, FD_CLOEXEC)); in os_set_exec_close()
409 int os_set_fd_async(int fd) in os_set_fd_async() argument
413 flags = fcntl(fd, F_GETFL); in os_set_fd_async()
418 if (fcntl(fd, F_SETFL, flags) < 0) { in os_set_fd_async()
421 "and O_NONBLOCK on fd # %d, errno = %d\n", fd, errno); in os_set_fd_async()
425 if ((fcntl(fd, F_SETSIG, SIGIO) < 0) || in os_set_fd_async()
426 (fcntl(fd, F_SETOWN, os_getpid()) < 0)) { in os_set_fd_async()
429 "(or F_SETSIG) fd %d, errno = %d\n", fd, errno); in os_set_fd_async()
436 int os_clear_fd_async(int fd) in os_clear_fd_async() argument
440 flags = fcntl(fd, F_GETFL); in os_clear_fd_async()
445 if (fcntl(fd, F_SETFL, flags) < 0) in os_clear_fd_async()
450 int os_set_fd_block(int fd, int blocking) in os_set_fd_block() argument
454 flags = fcntl(fd, F_GETFL); in os_set_fd_block()
463 if (fcntl(fd, F_SETFL, flags) < 0) in os_set_fd_block()
469 int os_accept_connection(int fd) in os_accept_connection() argument
473 new = accept(fd, NULL, 0); in os_accept_connection()
491 int os_shutdown_socket(int fd, int r, int w) in os_shutdown_socket() argument
504 err = shutdown(fd, what); in os_shutdown_socket()
512 * @fd: the FD to receive from
522 ssize_t os_rcv_fd_msg(int fd, int *fds, unsigned int n_fds, in os_rcv_fd_msg() argument
543 n = recvmsg(fd, &msg, 0); in os_rcv_fd_msg()
589 int os_lock_file(int fd, int excl) in os_lock_file() argument
598 err = fcntl(fd, F_SETLK, &lock); in os_lock_file()
603 err = fcntl(fd, F_GETLK, &lock); in os_lock_file()
631 int os_falloc_punch(int fd, unsigned long long offset, int len) in os_falloc_punch() argument
633 int n = fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, offset, len); in os_falloc_punch()
640 int os_falloc_zeroes(int fd, unsigned long long offset, int len) in os_falloc_zeroes() argument
642 int n = fallocate(fd, FALLOC_FL_ZERO_RANGE|FALLOC_FL_KEEP_SIZE, offset, len); in os_falloc_zeroes()
651 int fd = eventfd(initval, flags); in os_eventfd() local
653 if (fd < 0) in os_eventfd()
655 return fd; in os_eventfd()
658 int os_sendmsg_fds(int fd, const void *buf, unsigned int len, const int *fds, in os_sendmsg_fds() argument
686 err = sendmsg(fd, &msg, 0); in os_sendmsg_fds()
704 pollfds[i].fd = fds[i]; in os_poll()
712 /* Return the index of the available FD */ in os_poll()
721 void *os_mmap_rw_shared(int fd, size_t size) in os_mmap_rw_shared() argument
723 void *res = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in os_mmap_rw_shared()