/bionic/libc/include/sys/ |
D | select.h | 47 #define __FDELT(fd) ((fd) / NFDBITS) argument 48 #define __FDMASK(fd) (1UL << ((fd) % NFDBITS)) argument 65 #define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set)) argument 66 #define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set)) argument 67 #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set)) argument 69 #define FD_CLR(fd, set) (__FDS_BITS(set)[__FDELT(fd)] &= ~__FDMASK(fd)) argument 70 #define FD_SET(fd, set) (__FDS_BITS(set)[__FDELT(fd)] |= __FDMASK(fd)) argument 71 #define FD_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0) argument
|
/bionic/libc/bionic/ |
D | __FD_chk.cpp | 33 extern "C" int __FD_ISSET_chk(int fd, fd_set* set, size_t set_size) { in __FD_ISSET_chk() argument 34 if (__predict_false(fd < 0)) { in __FD_ISSET_chk() 37 if (__predict_false(fd >= FD_SETSIZE)) { in __FD_ISSET_chk() 43 return FD_ISSET(fd, set); in __FD_ISSET_chk() 46 extern "C" void __FD_CLR_chk(int fd, fd_set* set, size_t set_size) { in __FD_CLR_chk() argument 47 if (__predict_false(fd < 0)) { in __FD_CLR_chk() 50 if (__predict_false(fd >= FD_SETSIZE)) { in __FD_CLR_chk() 56 FD_CLR(fd, set); in __FD_CLR_chk() 59 extern "C" void __FD_SET_chk(int fd, fd_set* set, size_t set_size) { in __FD_SET_chk() argument 60 if (__predict_false(fd < 0)) { in __FD_SET_chk() [all …]
|
D | termios.cpp | 67 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 …]
|
D | pty.cpp | 56 char* ptsname(int fd) { in ptsname() argument 58 int error = ptsname_r(fd, buf, g_ptsname_tls_buffer.size()); in ptsname() 62 int ptsname_r(int fd, char* buf, size_t len) { in ptsname_r() argument 69 if (ioctl(fd, TIOCGPTN, &pty_num) != 0) { in ptsname_r() 82 char* ttyname(int fd) { in ttyname() argument 84 int error = ttyname_r(fd, buf, g_ttyname_tls_buffer.size()); in ttyname() 88 int ttyname_r(int fd, char* buf, size_t len) { in ttyname_r() argument 94 if (!isatty(fd)) { in ttyname_r() 99 snprintf(path, sizeof(path), "/proc/self/fd/%d", fd); in ttyname_r() 113 int unlockpt(int fd) { in unlockpt() argument [all …]
|
D | legacy_32_bit_support.cpp | 51 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 …]
|
D | posix_fadvise.cpp | 37 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()
|
D | lockf.cpp | 35 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()
|
D | tmpfile.cpp | 65 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()
|
D | posix_fallocate.cpp | 33 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()
|
D | fchmodat.cpp | 50 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()
|
D | flistxattr.cpp | 38 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/libc/upstream-openbsd/lib/libc/gen/ |
D | daemon.c | 39 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/tests/ |
D | eventfd_test.cpp | 39 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()
|
D | sys_xattr_test.cpp | 38 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 …]
|
D | fcntl_test.cpp | 25 int fd = open("/proc/version", O_RDONLY); in TEST() local 26 ASSERT_TRUE(fd != -1); in TEST() 28 int flags = fcntl(fd, F_GETFD); in TEST() 32 int rc = fcntl(fd, F_SETFD, FD_CLOEXEC); in TEST() 35 flags = fcntl(fd, F_GETFD); in TEST() 39 close(fd); in TEST() 43 int fd; in TEST() local 45 fd = open("/proc/version", O_RDONLY); in TEST() 46 ASSERT_TRUE(fd != -1); in TEST() 47 close(fd); in TEST() [all …]
|
D | sys_sendfile_test.cpp | 28 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()
|
D | sys_mman_test.cpp | 41 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 …]
|
D | sys_uio_test.cpp | 30 ASSERT_EQ(10, writev(tf.fd, ios, 2)); in TEST() 32 ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)); in TEST() 37 ASSERT_EQ(10, readv(tf.fd, ios, 2)); in TEST() 50 ASSERT_EQ(5, write_fn(tf.fd, ios, 1, 5)); in TestPreadVPwriteV() 51 ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_CUR)); in TestPreadVPwriteV() 54 ASSERT_EQ(5, write_fn(tf.fd, ios, 1, 0)); in TestPreadVPwriteV() 55 ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_CUR)); in TestPreadVPwriteV() 57 ASSERT_EQ(5, read_fn(tf.fd, ios, 1, 5)); in TestPreadVPwriteV() 59 ASSERT_EQ(5, read_fn(tf.fd, ios, 1, 0)); in TestPreadVPwriteV()
|
D | sys_socket_test.cpp | 37 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 …]
|
D | TemporaryFile.h | 31 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()
|
D | sys_statvfs_test.cpp | 54 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()
|
D | stdlib_test.cpp | 250 int flags = fcntl(tf.fd, F_GETFD); in TEST() 257 int flags = fcntl(tf.fd, F_GETFD); in TEST() 265 ASSERT_EQ(0, fstat64(tf.fd, &sb)); in TEST() 266 ASSERT_EQ(O_LARGEFILE, fcntl(tf.fd, F_GETFL) & O_LARGEFILE); in TEST() 272 ASSERT_EQ(0, fstat(tf.fd, &sb)); in TEST() 373 int fd = getpt(); in TEST() local 374 ASSERT_NE(-1, fd); in TEST() 377 ASSERT_EQ(0, grantpt(fd)); in TEST() 381 ASSERT_EQ(0, ptsname_r(fd, name_r, sizeof(name_r))); in TEST() 385 close(fd); in TEST() [all …]
|
D | unistd_test.cpp | 156 ASSERT_EQ(0, close(tf.fd)); in TEST() 166 ASSERT_EQ(0, close(tf.fd)); in TEST() 176 ASSERT_EQ(0, ftruncate(tf.fd, 123)); in TEST() 177 ASSERT_EQ(0, close(tf.fd)); in TEST() 186 ASSERT_EQ(0, ftruncate64(tf.fd, 123)); in TEST() 187 ASSERT_EQ(0, close(tf.fd)); in TEST() 197 ASSERT_EQ(-1, ftruncate(tf.fd, -123)); in TEST() 216 int fd = open("/proc/version", O_RDONLY); in TEST() local 217 ASSERT_TRUE(fd != -1); in TEST() 220 ASSERT_EQ(5, read(fd, buf, 5)); in TEST() [all …]
|
D | sys_vfs_test.cpp | 55 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/ |
D | legacy_termios_inlines.h | 39 static __inline int tcgetattr(int fd, struct termios *s) { in tcgetattr() argument 40 return ioctl(fd, TCGETS, s); in tcgetattr() 43 static __inline int tcsetattr(int fd, int __opt, const struct termios *s) { in tcsetattr() argument 44 return ioctl(fd, __opt, (void *)s); in tcsetattr() 47 static __inline int tcflow(int fd, int action) { in tcflow() argument 48 return ioctl(fd, TCXONC, (void *)(intptr_t)action); in tcflow() 51 static __inline int tcflush(int fd, int __queue) { in tcflush() argument 52 return ioctl(fd, TCFLSH, (void *)(intptr_t)__queue); in tcflush() 55 static __inline pid_t tcgetsid(int fd) { in tcgetsid() argument 57 return ioctl(fd, TIOCGSID, &_pid) ? (pid_t)-1 : _pid; in tcgetsid() [all …]
|