Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 107) sorted by relevance

12345

/bionic/libc/include/sys/
Dselect.h48 #define __FDELT(fd) ((fd) / NFDBITS) argument
49 #define __FDMASK(fd) (1UL << ((fd) % NFDBITS)) argument
66 #define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set)) argument
67 #define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set)) argument
68 #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set)) argument
70 #define FD_CLR(fd, set) (__FDS_BITS(set)[__FDELT(fd)] &= ~__FDMASK(fd)) argument
71 #define FD_SET(fd, set) (__FDS_BITS(set)[__FDELT(fd)] |= __FDMASK(fd)) argument
72 #define FD_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0) argument
/bionic/libc/upstream-openbsd/lib/libc/gen/
Ddaemon.c39 int fd; in daemon() local
56 if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { in daemon()
57 (void)dup2(fd, STDIN_FILENO); in daemon()
58 (void)dup2(fd, STDOUT_FILENO); in daemon()
59 (void)dup2(fd, STDERR_FILENO); in daemon()
60 if (fd > 2) in daemon()
61 (void)close(fd); in daemon()
/bionic/libc/bionic/
Dtermios.cpp67 int tcdrain(int fd) { in tcdrain() argument
70 return ioctl(fd, TCSBRK, static_cast<unsigned long>(1)); in tcdrain()
73 int tcflow(int fd, int action) { in tcflow() argument
74 return ioctl(fd, TCXONC, static_cast<unsigned long>(action)); in tcflow()
77 int tcflush(int fd, int queue) { in tcflush() argument
78 return ioctl(fd, TCFLSH, static_cast<unsigned long>(queue)); in tcflush()
81 int tcgetattr(int fd, termios* s) { in tcgetattr() argument
82 return ioctl(fd, TCGETS, s); in tcgetattr()
85 pid_t tcgetsid(int fd) { in tcgetsid() argument
87 if (ioctl(fd, TIOCGSID, &sid) == -1) { in tcgetsid()
[all …]
Dpty.cpp53 char* ptsname(int fd) { in ptsname() argument
56 int error = ptsname_r(fd, buf, sizeof(tls.ptsname_buf)); in ptsname()
60 int ptsname_r(int fd, char* buf, size_t len) { in ptsname_r() argument
67 if (ioctl(fd, TIOCGPTN, &pty_num) != 0) { in ptsname_r()
80 char* ttyname(int fd) { in ttyname() argument
83 int error = ttyname_r(fd, buf, sizeof(tls.ttyname_buf)); in ttyname()
87 int ttyname_r(int fd, char* buf, size_t len) { in ttyname_r() argument
93 if (!isatty(fd)) { in ttyname_r()
98 snprintf(path, sizeof(path), "/proc/self/fd/%d", fd); in ttyname_r()
112 int unlockpt(int fd) { in unlockpt() argument
[all …]
Dlegacy_32_bit_support.cpp51 int fcntl(int fd, int cmd, ...) { in fcntl() argument
58 return __fcntl64(fd, cmd, arg); in fcntl()
63 off64_t lseek64(int fd, off64_t off, int whence) { in lseek64() argument
67 if (__llseek(fd, off_hi, off_lo, &result, whence) < 0) { in lseek64()
74 ssize_t pread(int fd, void* buf, size_t byte_count, off_t offset) { in pread() argument
75 return pread64(fd, buf, byte_count, static_cast<off64_t>(offset)); in pread()
79 ssize_t pwrite(int fd, const void* buf, size_t byte_count, off_t offset) { in pwrite() argument
80 return pwrite64(fd, buf, byte_count, static_cast<off64_t>(offset)); in pwrite()
87 ssize_t preadv(int fd, const struct iovec* ios, int count, off_t offset) { in preadv() argument
88 return __preadv64(fd, ios, count, offset, 0); in preadv()
[all …]
Dposix_fadvise.cpp37 int posix_fadvise(int fd, off_t offset, off_t length, int advice) { in posix_fadvise() argument
38 return posix_fadvise64(fd, offset, length, advice); in posix_fadvise()
42 int posix_fadvise64(int fd, off64_t offset, off64_t length, int advice) { in posix_fadvise64() argument
44 return (__arm_fadvise64_64(fd, advice, offset, length) == 0) ? 0 : errno; in posix_fadvise64()
47 int posix_fadvise64(int fd, off64_t offset, off64_t length, int advice) { in posix_fadvise64() argument
49 return (__fadvise64(fd, offset, length, advice) == 0) ? 0 : errno; in posix_fadvise64()
Dlockf.cpp35 int lockf64(int fd, int cmd, off64_t length) { in lockf64() argument
46 return fcntl(fd, F_SETLK64, &fl); in lockf64()
51 return fcntl(fd, F_SETLKW64, &fl); in lockf64()
56 return fcntl(fd, F_SETLK64, &fl); in lockf64()
61 if (fcntl(fd, F_GETLK64, &fl) == -1) return -1; in lockf64()
71 int lockf(int fd, int cmd, off_t length) { in lockf() argument
72 return lockf64(fd, cmd, length); in lockf()
Dtmpfile.cpp65 int fd; in __tmpfile_dir() local
68 fd = mkstemp(path); in __tmpfile_dir()
69 if (fd == -1) { in __tmpfile_dir()
81 int rc = fstat(fd, &sb); in __tmpfile_dir()
84 close(fd); in __tmpfile_dir()
90 FILE* fp = fdopen(fd, "w+"); in __tmpfile_dir()
97 close(fd); in __tmpfile_dir()
Dpthread_setname_np.cpp62 int fd = __open_task_comm_fd(t, O_RDONLY); in pthread_getname_np() local
63 if (fd == -1) return errno; in pthread_getname_np()
65 ssize_t n = TEMP_FAILURE_RETRY(read(fd, buf, buf_size)); in pthread_getname_np()
66 close(fd); in pthread_getname_np()
94 int fd = __open_task_comm_fd(t, O_WRONLY); in pthread_setname_np() local
95 if (fd == -1) return errno; in pthread_setname_np()
97 ssize_t n = TEMP_FAILURE_RETRY(write(fd, thread_name, thread_name_len)); in pthread_setname_np()
98 close(fd); in pthread_setname_np()
Dposix_fallocate.cpp33 int posix_fallocate(int fd, off_t offset, off_t length) { in posix_fallocate() argument
35 return (fallocate(fd, 0, offset, length) == 0) ? 0 : errno; in posix_fallocate()
38 int posix_fallocate64(int fd, off64_t offset, off64_t length) { in posix_fallocate64() argument
40 return (fallocate64(fd, 0, offset, length) == 0) ? 0 : errno; in posix_fallocate64()
Dsys_time.cpp37 static int futimesat(int fd, const char* path, const timeval tv[2], int flags) { in futimesat() argument
43 return utimensat(fd, path, tv ? ts : nullptr, flags); in futimesat()
54 int futimesat(int fd, const char* path, const timeval tv[2]) { in futimesat() argument
55 return futimesat(fd, path, tv, 0); in futimesat()
58 int futimes(int fd, const timeval tv[2]) { in futimes() argument
64 return futimens(fd, tv ? ts : nullptr); in futimes()
Dfchmodat.cpp50 int fd = openat(dirfd, pathname, O_PATH | O_NOFOLLOW | O_CLOEXEC); in fchmodat() local
51 if (fd == -1) { in fchmodat()
60 int result = fchmod(fd, mode); in fchmodat()
62 close(fd); in fchmodat()
Dflistxattr.cpp38 ssize_t flistxattr(int fd, char *list, size_t size) { in flistxattr() argument
40 ssize_t result = ___flistxattr(fd, list, size); in flistxattr()
49 int fd_flag = fcntl(fd, F_GETFL); in flistxattr()
56 snprintf(buf, sizeof(buf), "/proc/self/fd/%d", fd); in flistxattr()
/bionic/tests/
Deventfd_test.cpp39 int fd = eventfd(initial_value, O_NONBLOCK); in TEST() local
40 ASSERT_NE(fd, -1); in TEST()
43 ASSERT_EQ(0, eventfd_read(fd, &value)); in TEST()
47 ASSERT_EQ(-1, eventfd_read(fd, &value)); in TEST()
51 ASSERT_EQ(0, eventfd_write(fd, 1)); in TEST()
52 ASSERT_EQ(0, eventfd_write(fd, 1)); in TEST()
53 ASSERT_EQ(0, eventfd_write(fd, 1)); in TEST()
55 ASSERT_EQ(0, eventfd_read(fd, &value)); in TEST()
58 close(fd); in TEST()
Dsys_xattr_test.cpp38 ASSERT_EQ(0, fsetxattr(tf.fd, "user.foo", "bar", 4, 0)); in TEST()
39 ASSERT_EQ(4, fgetxattr(tf.fd, "user.foo", buf, sizeof(buf))); in TEST()
46 ASSERT_EQ(0, fsetxattr(tf.fd, "user.foo", "", 0, 0)); in TEST()
47 ASSERT_EQ(0, fgetxattr(tf.fd, "user.foo", buf, sizeof(buf))); in TEST()
53 ASSERT_EQ(0, fsetxattr(tf.fd, "user.foo", "01234567890123456789", 21, 0)); in TEST()
54 ASSERT_EQ(-1, fgetxattr(tf.fd, "user.foo", buf, sizeof(buf))); in TEST()
70 int fd = open(tf.filename, O_PATH); in TEST() local
71 ASSERT_NE(-1, fd); in TEST()
73 int res = fsetxattr(fd, "user.foo", "bar", 4, 0); in TEST()
77 ASSERT_EQ(4, fgetxattr(fd, "user.foo", buf, sizeof(buf))); in TEST()
[all …]
Dfcntl_test.cpp34 int fd = open("/proc/version", O_RDONLY); in TEST() local
35 ASSERT_TRUE(fd != -1); in TEST()
37 int flags = fcntl(fd, F_GETFD); in TEST()
41 int rc = fcntl(fd, F_SETFD, FD_CLOEXEC); in TEST()
44 flags = fcntl(fd, F_GETFD); in TEST()
48 close(fd); in TEST()
52 int fd; in TEST() local
54 fd = open("/proc/version", O_RDONLY); in TEST()
55 ASSERT_TRUE(fd != -1); in TEST()
56 close(fd); in TEST()
[all …]
Dsys_sendfile_test.cpp28 ASSERT_EQ(5, TEMP_FAILURE_RETRY(write(src_file.fd, "hello", 5))); in TEST()
34 ssize_t rc = sendfile(dst_file.fd, src_file.fd, &offset, count); in TEST()
38 ASSERT_EQ(0, lseek(dst_file.fd, 0, SEEK_SET)); in TEST()
41 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); in TEST()
47 ASSERT_EQ(5, TEMP_FAILURE_RETRY(write(src_file.fd, "hello", 5))); in TEST()
53 ssize_t rc = sendfile64(dst_file.fd, src_file.fd, &offset, count); in TEST()
57 ASSERT_EQ(0, lseek(dst_file.fd, 0, SEEK_SET)); in TEST()
60 ASSERT_EQ(2, TEMP_FAILURE_RETRY(read(dst_file.fd, &buf, 2))); in TEST()
Dsys_mman_test.cpp41 void* map = mmap(NULL, 100, PROT_READ, MAP_SHARED, tf.fd, 1); in TEST()
48 void* map = mmap64(NULL, 100, PROT_READ, MAP_SHARED, tf.fd, 1); in TEST()
60 ASSERT_EQ(STR_SSIZE(STRING_MSG), write(tf.fd, STRING_MSG, sizeof(STRING_MSG))); in TEST()
62 void* map = mmap(NULL, sizeof(STRING_MSG), PROT_READ, MAP_SHARED, tf.fd, 0); in TEST()
74 ASSERT_EQ(STR_SSIZE(INITIAL_MSG), write(tf.fd, INITIAL_MSG, sizeof(INITIAL_MSG))); in TEST()
75 lseek(tf.fd, 0, SEEK_SET); in TEST()
77 void* map = mmap(NULL, sizeof(STRING_MSG), PROT_WRITE, MAP_SHARED, tf.fd, 0); in TEST()
79 close(tf.fd); in TEST()
88 ASSERT_EQ(STR_SSIZE(STRING_MSG), read(tf.fd, buf, sizeof(STRING_MSG))); in TEST()
103 ASSERT_EQ(STR_SSIZE(PAGE0_MSG), write(tf.fd, PAGE0_MSG, sizeof(PAGE0_MSG))); in TEST()
[all …]
Dsys_socket_test.cpp37 int fd = socket(PF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC | SOCK_NONBLOCK, 0); in ConnectFn() local
38 if (fd < 0) { in ConnectFn()
49 if (connect(fd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) < 0) { in ConnectFn()
53 else if (callback_fn != NULL && !callback_fn(fd)) { in ConnectFn()
57 close(fd); in ConnectFn()
63 bool (*callback_fn)(int fd), const char* sock_path) { in RunTest() argument
64 int fd = socket(PF_UNIX, SOCK_SEQPACKET, 0); in RunTest() local
65 ASSERT_NE(fd, -1) << strerror(errno); in RunTest()
73 …ASSERT_NE(-1, bind(fd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr))) << strerror(errno… in RunTest()
75 ASSERT_NE(-1, listen(fd, 1)) << strerror(errno); in RunTest()
[all …]
Dsys_statvfs_test.cpp54 int fd = open("/proc", O_RDONLY); in TEST() local
55 ASSERT_EQ(0, fstatvfs(fd, &sb)); in TEST()
56 close(fd); in TEST()
62 int fd = open("/proc", O_RDONLY); in TEST() local
63 ASSERT_EQ(0, fstatvfs64(fd, &sb)); in TEST()
64 close(fd); in TEST()
DTemporaryFile.h31 if (fd == -1) { in mk_fn()
41 close(fd); in ~GenericTemporaryFile()
46 close(fd); in reopen()
47 fd = open(filename, O_RDWR); in reopen()
50 int fd; variable
58 fd = mk_fn(filename); in init()
Dsys_vfs_test.cpp55 int fd = open("/proc", O_RDONLY); in TEST() local
56 ASSERT_EQ(0, fstatfs(fd, &sb)); in TEST()
57 close(fd); in TEST()
63 int fd = open("/proc", O_RDONLY); in TEST() local
64 ASSERT_EQ(0, fstatfs64(fd, &sb)); in TEST()
65 close(fd); in TEST()
/bionic/libc/include/android/
Dlegacy_termios_inlines.h42 static __inline int tcgetattr(int fd, struct termios *s) { in tcgetattr() argument
43 return ioctl(fd, TCGETS, s); in tcgetattr()
46 static __inline int tcsetattr(int fd, int __opt, const struct termios *s) { in tcsetattr() argument
47 return ioctl(fd, __opt, (void *)s); in tcsetattr()
50 static __inline int tcflow(int fd, int action) { in tcflow() argument
51 return ioctl(fd, TCXONC, (void *)(intptr_t)action); in tcflow()
54 static __inline int tcflush(int fd, int __queue) { in tcflush() argument
55 return ioctl(fd, TCFLSH, (void *)(intptr_t)__queue); in tcflush()
58 static __inline pid_t tcgetsid(int fd) { in tcgetsid() argument
60 return ioctl(fd, TIOCGSID, &_pid) ? (pid_t)-1 : _pid; in tcgetsid()
[all …]
/bionic/libc/kernel/uapi/linux/
Dkcm.h22 int fd; member
27 int fd; member
31 int fd; member
/bionic/libc/private/
Dbionic_fortify.h38 static inline void __check_fd_set(const char* fn, int fd, size_t set_size) { in __check_fd_set() argument
39 if (__predict_false(fd < 0)) { in __check_fd_set()
40 __fortify_fatal("%s: file descriptor %d < 0", fn, fd); in __check_fd_set()
42 if (__predict_false(fd >= FD_SETSIZE)) { in __check_fd_set()
43 __fortify_fatal("%s: file descriptor %d >= FD_SETSIZE %zu", fn, fd, set_size); in __check_fd_set()

12345