Home
last modified time | relevance | path

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

12345678910>>...176

/third_party/ltp/testcases/kernel/syscalls/memfd_create/
Dmemfd_create01.c23 static void test_basic(int fd) in test_basic() argument
26 CHECK_MFD_HAS_SEALS(fd, 0); in test_basic()
27 CHECK_MFD_ADD_SEALS(fd, F_SEAL_SHRINK | F_SEAL_WRITE); in test_basic()
28 CHECK_MFD_HAS_SEALS(fd, F_SEAL_SHRINK | F_SEAL_WRITE); in test_basic()
31 CHECK_MFD_ADD_SEALS(fd, F_SEAL_SHRINK | F_SEAL_WRITE); in test_basic()
32 CHECK_MFD_HAS_SEALS(fd, F_SEAL_SHRINK | F_SEAL_WRITE); in test_basic()
35 CHECK_MFD_ADD_SEALS(fd, F_SEAL_GROW | F_SEAL_SEAL); in test_basic()
36 CHECK_MFD_HAS_SEALS(fd, F_SEAL_SHRINK | F_SEAL_GROW | in test_basic()
40 CHECK_MFD_FAIL_ADD_SEALS(fd, F_SEAL_GROW); in test_basic()
41 CHECK_MFD_FAIL_ADD_SEALS(fd, 0); in test_basic()
[all …]
Dmemfd_create_common.h41 #define CHECK_MMAP(addr, length, prot, flags, fd, offset) \ argument
43 (flags), (fd), (offset))
45 #define CHECK_MMAP_FAIL(addr, length, prot, flags, fd, offset) \ argument
47 (flags), (fd), (offset))
52 #define CHECK_MFD_HAS_SEALS(fd, seals) \ argument
53 check_mfd_has_seals(__FILE__, __LINE__, (fd), (seals));
55 #define CHECK_MFD_ADD_SEALS(fd, seals) \ argument
56 ({int r = SAFE_FCNTL((fd), F_ADD_SEALS, (seals)); \
58 (fd), (seals)); r; })
60 #define CHECK_MFD_FAIL_ADD_SEALS(fd, seals) \ argument
[all …]
Dmemfd_create_common.c32 int check_fallocate(const char *filename, const int lineno, int fd, in check_fallocate() argument
37 r = fallocate(fd, mode, offset, len); in check_fallocate()
40 "fallocate(%d, %d, %ld, %ld) failed", fd, mode, in check_fallocate()
45 "fallocate(%d, %d, %ld, %ld) succeeded", fd, mode, in check_fallocate()
51 int check_fallocate_fail(const char *filename, const int lineno, int fd, in check_fallocate_fail() argument
56 r = fallocate(fd, mode, offset, len); in check_fallocate_fail()
60 fd, mode, offset, len); in check_fallocate_fail()
66 "fallocate(%d, %d, %ld, %ld) failed as expected", fd, in check_fallocate_fail()
72 void check_ftruncate(const char *filename, const int lineno, int fd, in check_ftruncate() argument
75 safe_ftruncate(filename, lineno, fd, length); in check_ftruncate()
[all …]
/third_party/boost/boost/interprocess/detail/
Dfile_locking_helpers.hpp57 int fd; member
68 inline bool lock_locking_file(int fd) in lock_locking_file() argument
72 ret = _locking(fd, _LK_LOCK, 1/*lock_file_contents_length()*/); in lock_locking_file()
77 inline bool try_lock_locking_file(int fd) in try_lock_locking_file() argument
79 return 0 == _locking(fd, _LK_NBLCK , 1); in try_lock_locking_file()
88 int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); in open_or_create_and_lock_file() local
89 if(fd < 0){ in open_or_create_and_lock_file()
91 return fd; in open_or_create_and_lock_file()
93 if(!try_lock_locking_file(fd)){ in open_or_create_and_lock_file()
94 _close(fd); in open_or_create_and_lock_file()
[all …]
/third_party/ltp/testcases/kernel/security/tomoyo/
Dtomoyo_new_file_test.c96 int fd; in stage_file_test() local
190 fd = open("/dev/null", O_RDONLY); in stage_file_test()
191 show_result(fd, 1); in stage_file_test()
192 if (fd != EOF) in stage_file_test()
193 close(fd); in stage_file_test()
195 fd = open("/dev/null", O_RDONLY); in stage_file_test()
196 show_result(fd, 0); in stage_file_test()
197 if (fd != EOF) in stage_file_test()
198 close(fd); in stage_file_test()
202 fd = open("/dev/null", O_RDONLY); in stage_file_test()
[all …]
Dtomoyo_rewrite_test.c58 int fd; in stage_rewrite_test() local
77 fd = open(REWRITE_PATH, O_RDONLY); in stage_rewrite_test()
78 show_result(fd); in stage_rewrite_test()
79 close(fd); in stage_rewrite_test()
82 fd = open(REWRITE_PATH, O_WRONLY | O_APPEND); in stage_rewrite_test()
83 show_result(fd); in stage_rewrite_test()
84 close(fd); in stage_rewrite_test()
88 fd = open(REWRITE_PATH, O_WRONLY); in stage_rewrite_test()
89 show_result(fd); in stage_rewrite_test()
90 close(fd); in stage_rewrite_test()
[all …]
/third_party/musl/libc-test/src/functionalext/supplement/linux/
Dinotify.c25 int fd; member
36 static int inotify_add_watch_test(int fd, uint32_t mask) in inotify_add_watch_test() argument
39 return inotify_add_watch(fd, "/data", mask); in inotify_add_watch_test()
42 static int inotify_rm_watch_test(int fd, int wd) in inotify_rm_watch_test() argument
45 return inotify_rm_watch(fd, wd); in inotify_rm_watch_test()
50 int fd = inotify_init_test(); in inotify_test() local
51 EXPECT_NE(msg, fd, ERREXPECT); in inotify_test()
52 if (fd == -1) { in inotify_test()
57 struct inotify_test data[TEST_DATA_COUNT] = {{.fd = fd, .wd = -1, .mask = IN_ACCESS}, in inotify_test()
58 {.fd = fd, .wd = -1, .mask = IN_MODIFY}, in inotify_test()
[all …]
Dflock.c28 int fd = open("/data/test.txt", O_RDWR | O_CREAT, 0666); in flock_0100() local
29 EXPECT_NE("flock_0100", fd, -1); in flock_0100()
30 lseek(fd, 2, SEEK_SET); in flock_0100()
32 result = flock(fd, LOCK_SH); in flock_0100()
34 close(fd); in flock_0100()
46 int fd = open("/data/test.txt", O_RDWR | O_CREAT, 0666); in flock_0200() local
47 EXPECT_NE("flock_0200", fd, -1); in flock_0200()
48 lseek(fd, 2, SEEK_SET); in flock_0200()
50 result = flock(fd, LOCK_SH | LOCK_NB); in flock_0200()
52 close(fd); in flock_0200()
[all …]
/third_party/e2fsprogs/tests/progs/
Drandom_exercise.c51 int fd; in get_random_fd() local
54 fd = ((int) random()) % MAXFDS; in get_random_fd()
55 if (fd > 2) in get_random_fd()
56 return fd; in get_random_fd()
60 unsigned int get_inode_num(int fd) in get_inode_num() argument
64 if (fstat(fd, &st) < 0) { in get_inode_num()
75 int fd; in create_random_file() local
84 fd = open(template, O_RDONLY, 0600); in create_random_file()
86 template, fd); in create_random_file()
89 fd = open(template, O_CREAT|O_RDWR, 0600); in create_random_file()
[all …]
/third_party/weston/shared/
Dos-compatibility.c44 os_fd_set_cloexec(int fd) in os_fd_set_cloexec() argument
48 if (fd == -1) in os_fd_set_cloexec()
51 flags = fcntl(fd, F_GETFD); in os_fd_set_cloexec()
55 if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) in os_fd_set_cloexec()
62 set_cloexec_or_close(int fd) in set_cloexec_or_close() argument
64 if (os_fd_set_cloexec(fd) != 0) { in set_cloexec_or_close()
65 close(fd); in set_cloexec_or_close()
68 return fd; in set_cloexec_or_close()
100 int fd; in os_epoll_create_cloexec() local
103 fd = epoll_create1(EPOLL_CLOEXEC); in os_epoll_create_cloexec()
[all …]
/third_party/grpc/src/core/lib/iomgr/
Dev_poll_posix.cc62 grpc_fd* fd; member
71 grpc_fd* fd; member
79 int fd; member
149 static uint32_t fd_begin_poll(grpc_fd* fd, grpc_pollset* pollset,
159 static bool fd_is_orphaned(grpc_fd* fd);
162 static void fd_ref(grpc_fd* fd, const char* reason, const char* file, int line);
163 static void fd_unref(grpc_fd* fd, const char* reason, const char* file,
165 #define GRPC_FD_REF(fd, reason) fd_ref(fd, reason, __FILE__, __LINE__) argument
166 #define GRPC_FD_UNREF(fd, reason) fd_unref(fd, reason, __FILE__, __LINE__) argument
168 static void fd_ref(grpc_fd* fd);
[all …]
/third_party/ltp/testcases/kernel/syscalls/eventfd/
Deventfd01.c85 static int clear_counter(int fd) in clear_counter() argument
90 ret = read(fd, &dummy, sizeof(dummy)); in clear_counter()
111 static int set_counter(int fd, uint64_t val) in set_counter() argument
115 ret = clear_counter(fd); in set_counter()
119 ret = write(fd, &val, sizeof(val)); in set_counter()
131 static void read_test(int fd, uint64_t required) in read_test() argument
136 ret = read(fd, &val, sizeof(val)); in read_test()
152 static void read_eagain_test(int fd) in read_eagain_test() argument
157 ret = clear_counter(fd); in read_eagain_test()
163 ret = read(fd, &val, sizeof(val)); in read_eagain_test()
[all …]
/third_party/ltp/testcases/kernel/syscalls/close_range/
Dclose_range02.c23 static int try_close_range(int fd, int flags) in try_close_range() argument
27 TEST(close_range(fd, fd, flags)); in try_close_range()
45 int fd = -1, res; in run() local
49 fd = SAFE_OPEN("/", O_PATH); in run()
50 SAFE_DUP2(fd, 100); in run()
52 TST_EXP_PASS(close_range(fd, 100, 0), in run()
53 "close_range(%d, 100, 0)", fd); in run()
54 TST_EXP_FAIL(fcntl(fd, F_GETFD), EBADF, in run()
55 "fcntl(%d, F_GETFD)", fd); in run()
68 fd = SAFE_OPEN("/", O_PATH); in run()
[all …]
/third_party/ltp/testcases/kernel/input/
Dinput_helper.c40 int ret, fd = -1; in try_open_device() local
46 fd = open(path, O_RDONLY); in try_open_device()
48 if (fd < 0 && errno == ENOENT) in try_open_device()
51 if (fd < 0) { in try_open_device()
56 ret = ioctl(fd, EVIOCGNAME(sizeof(name)), name); in try_open_device()
65 return fd; in try_open_device()
66 close(fd); in try_open_device()
74 int fd; in open_device() local
78 fd = try_open_device(); in open_device()
79 if (fd > 0) in open_device()
[all …]
/third_party/musl/libc-test/src/functionalext/supplement/unistd/
Dlseek.c39 int fd = open("lseek64_function_test.c", O_RDWR | O_CREAT); in lseek64_0100() local
40 if (fd < 0) { in lseek64_0100()
45 lseek64(fd, 0, SEEK_SET); in lseek64_0100()
46 offset = lseek64(fd, DataArry[i], SEEK_SET); in lseek64_0100()
51 close(fd); in lseek64_0100()
66 int fd = open("/data/readtest.txt", O_RDWR | O_CREAT); in lseek_0100() local
67 EXPECT_STRLT("lseek_0100", 0, fd); in lseek_0100()
68 int retwrite = write(fd, wrstring, sizeof(wrstring)); in lseek_0100()
69 off_t data = lseek(fd, 0L, SEEK_SET); in lseek_0100()
71 close(fd); in lseek_0100()
[all …]
Dfaccessat.c33 int fd = open(ptr, O_RDWR | O_CREAT); in faccessat_0100() local
34 EXPECT_TRUE("faccessat_0100", fd >= 0); in faccessat_0100()
35 int isExist = faccessat(fd, ptr, F_OK, 0); in faccessat_0100()
37 close(fd); in faccessat_0100()
50 int fd = -1; in faccessat_0200() local
51 int isExist = faccessat(fd, ptr, F_OK, 0); in faccessat_0200()
53 close(fd); in faccessat_0200()
66 int fd = open(ptr, O_RDWR | O_CREAT, 00040); in faccessat_0300() local
67 EXPECT_TRUE("faccessat_0300", fd >= 0); in faccessat_0300()
68 int isRead = faccessat(fd, ptr, R_OK, 0); in faccessat_0300()
[all …]
/third_party/wayland_standard/src/
Dwayland-os.c39 set_cloexec_or_close(int fd) in set_cloexec_or_close() argument
43 if (fd == -1) in set_cloexec_or_close()
46 flags = fcntl(fd, F_GETFD); in set_cloexec_or_close()
50 if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) in set_cloexec_or_close()
53 return fd; in set_cloexec_or_close()
56 close(fd); in set_cloexec_or_close()
63 int fd; in wl_os_socket_cloexec() local
65 fd = socket(domain, type | SOCK_CLOEXEC, protocol); in wl_os_socket_cloexec()
66 if (fd >= 0) in wl_os_socket_cloexec()
67 return fd; in wl_os_socket_cloexec()
[all …]
/third_party/musl/libc-test/src/functionalext/supplement/fcntl/
Dopen.c32 int fd = open(path, O_RDONLY + O_CREAT); in open_0100() local
33 int len = write(fd, s, sizeof(s)); in open_0100()
34 ssize_t size = read(fd, buffer, sizeof(buffer)); in open_0100()
35 EXPECT_EQ("open_0100", fd, 4); in open_0100()
39 close(fd); in open_0100()
50 int fd = open(path, O_RDONLY); in open_0200() local
51 EXPECT_EQ("open_0200", fd, -1); in open_0200()
63 int fd = open(path, O_WRONLY + O_CREAT); in open_0300() local
64 ssize_t size = read(fd, buffer, sizeof(buffer)); in open_0300()
65 EXPECT_EQ("open_0300", fd, 4); in open_0300()
[all …]
/third_party/ltp/testcases/open_posix_testsuite/include/
Dmq_send.h14 int sync_pipe_create(int fd[]) in sync_pipe_create() argument
16 return pipe (fd); in sync_pipe_create()
19 int sync_pipe_close(int fd[]) in sync_pipe_close() argument
23 if (fd[0] != -1) in sync_pipe_close()
24 r = close (fd[0]); in sync_pipe_close()
25 if (fd[1] != -1) in sync_pipe_close()
26 r |= close (fd[1]); in sync_pipe_close()
30 int sync_pipe_wait(int fd[]) in sync_pipe_wait() argument
35 if (fd[1] != -1) { in sync_pipe_wait()
36 close (fd[1]); in sync_pipe_wait()
[all …]
/third_party/toybox/toys/pending/
Dopenvt.c46 int i, fd; local
49 fd = open(console_name[i], O_RDWR);
50 if (fd >= 0) {
52 if (!ioctl(fd, KDGKBTYPE, &arg)) return fd;
53 close(fd);
58 for (fd = 0; fd < 3; fd++) {
60 if (0 == ioctl(fd, KDGKBTYPE, &arg)) return fd;
66 int xvtnum(int fd) in xvtnum() argument
70 ret = ioctl(fd, VT_OPENQRY, (int *)&TT.vt_num); in xvtnum()
78 int fd, vt_fd, ret = 0; in openvt_main() local
[all …]
/third_party/wayland_standard/cursor/
Dos-compatibility.c45 set_cloexec_or_close(int fd) in set_cloexec_or_close() argument
49 if (fd == -1) in set_cloexec_or_close()
52 flags = fcntl(fd, F_GETFD); in set_cloexec_or_close()
56 if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) in set_cloexec_or_close()
59 return fd; in set_cloexec_or_close()
62 close(fd); in set_cloexec_or_close()
70 int fd; in create_tmpfile_cloexec() local
73 fd = mkostemp(tmpname, O_CLOEXEC); in create_tmpfile_cloexec()
74 if (fd >= 0) in create_tmpfile_cloexec()
77 fd = mkstemp(tmpname); in create_tmpfile_cloexec()
[all …]
/third_party/ntfs-3g/libntfs-3g/
Dwin32_io.c689 static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) in ntfs_device_win32_getgeo() argument
705 fd->geo_cylinders = ((DISK_GEOMETRY*)&b)->Cylinders.QuadPart; in ntfs_device_win32_getgeo()
706 fd->geo_sectors = ((DISK_GEOMETRY*)&b)->SectorsPerTrack; in ntfs_device_win32_getgeo()
707 fd->geo_size = ((DISK_GEOMETRY_EX*)&b)->DiskSize.QuadPart; in ntfs_device_win32_getgeo()
708 fd->geo_sector_size = NTFS_BLOCK_SIZE; in ntfs_device_win32_getgeo()
711 fd->geo_cylinders = ddi->Int13.MaxCylinders; in ntfs_device_win32_getgeo()
712 fd->geo_sectors = ddi->Int13.SectorsPerTrack; in ntfs_device_win32_getgeo()
713 fd->geo_heads = ddi->Int13.MaxHeads; in ntfs_device_win32_getgeo()
716 fd->geo_cylinders = ddi->ExInt13.ExCylinders; in ntfs_device_win32_getgeo()
717 fd->geo_sectors = ddi->ExInt13.ExSectorsPerTrack; in ntfs_device_win32_getgeo()
[all …]
/third_party/musl/libc-test/src/functionalext/supplement/temp/
Dmkostemp.c29 int fd = mkostemp(tmpfile, O_APPEND); in mkostemp_0100() local
30 EXPECT_TRUE("mkostemp_0100", fd != -1); in mkostemp_0100()
31 if (fd != -1) { in mkostemp_0100()
32 int cnt = write(fd, tmpfile, strlen(tmpfile)); in mkostemp_0100()
34 close(fd); in mkostemp_0100()
52 int fd = mkostemp(tmpfile, O_CLOEXEC); in mkostemp_0200() local
53 EXPECT_TRUE("mkostemp_0200", fd != -1); in mkostemp_0200()
54 if (fd != -1) { in mkostemp_0200()
55 int cnt = write(fd, tmpfile, strlen(tmpfile)); in mkostemp_0200()
57 close(fd); in mkostemp_0200()
[all …]
/third_party/libdrm/
Dxf86drm.h128 int fd; member
133 extern int drmIoctl(int fd, unsigned long request, void *arg);
135 extern drmHashEntry *drmGetEntry(int fd);
522 #define DRM_LIGHT_LOCK(fd,lock,context) \ argument
526 if (__ret) drmGetLock(fd,context,0); \
531 #define DRM_LIGHT_LOCK_COUNT(fd,lock,context,count) \ argument
535 if (__ret) drmGetLock(fd,context,0); \
539 #define DRM_LOCK(fd,lock,context,flags) \ argument
541 if (flags) drmGetLock(fd,context,flags); \
542 else DRM_LIGHT_LOCK(fd,lock,context); \
[all …]
/third_party/ltp/testcases/kernel/syscalls/fsconfig/
Dfsconfig02.c10 static int fd = -1, temp_fd = -1, invalid_fd = -1; variable
15 int *fd; member
23 {"invalid-cmd", &fd, 100, "rw", NULL, &aux_0, EOPNOTSUPP},
24 {"set-flag-key", &fd, FSCONFIG_SET_FLAG, NULL, NULL, &aux_0, EINVAL},
25 {"set-flag-value", &fd, FSCONFIG_SET_FLAG, "rw", "foo", &aux_0, EINVAL},
26 {"set-flag-aux", &fd, FSCONFIG_SET_FLAG, "rw", NULL, &aux_1, EINVAL},
27 …{"set-string-key", &fd, FSCONFIG_SET_STRING, NULL, "#grand.central.org:root.cell.", &aux_0, EINVAL…
28 {"set-string-value", &fd, FSCONFIG_SET_STRING, "source", NULL, &aux_0, EINVAL},
29 …{"set-string-aux", &fd, FSCONFIG_SET_STRING, "source", "#grand.central.org:root.cell.", &aux_1, EI…
30 {"set-binary-key", &fd, FSCONFIG_SET_BINARY, NULL, "foo", &aux_1, EINVAL},
[all …]

12345678910>>...176