Home
last modified time | relevance | path

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

12345678910>>...70

/kernel/linux/linux-5.10/tools/testing/selftests/memfd/
Dmemfd_test.c39 int r, fd; in mfd_assert_new() local
41 fd = sys_memfd_create(name, flags); in mfd_assert_new()
42 if (fd < 0) { in mfd_assert_new()
48 r = ftruncate(fd, sz); in mfd_assert_new()
54 return fd; in mfd_assert_new()
59 int r, fd; in mfd_assert_reopen_fd() local
64 fd = open(path, O_RDWR); in mfd_assert_reopen_fd()
65 if (fd < 0) { in mfd_assert_reopen_fd()
70 return fd; in mfd_assert_reopen_fd()
86 static unsigned int mfd_assert_get_seals(int fd) in mfd_assert_get_seals() argument
[all …]
Dfuse_test.c45 int r, fd; in mfd_assert_new() local
47 fd = sys_memfd_create(name, flags); in mfd_assert_new()
48 if (fd < 0) { in mfd_assert_new()
54 r = ftruncate(fd, sz); in mfd_assert_new()
60 return fd; in mfd_assert_new()
63 static __u64 mfd_assert_get_seals(int fd) in mfd_assert_get_seals() argument
67 r = fcntl(fd, F_GET_SEALS); in mfd_assert_get_seals()
69 printf("GET_SEALS(%d) failed: %m\n", fd); in mfd_assert_get_seals()
76 static void mfd_assert_has_seals(int fd, __u64 seals) in mfd_assert_has_seals() argument
80 s = mfd_assert_get_seals(fd); in mfd_assert_has_seals()
[all …]
/kernel/linux/linux-5.10/drivers/clk/
Dclk-fractional-divider.c17 static inline u32 clk_fd_readl(struct clk_fractional_divider *fd) in clk_fd_readl() argument
19 if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) in clk_fd_readl()
20 return ioread32be(fd->reg); in clk_fd_readl()
22 return readl(fd->reg); in clk_fd_readl()
25 static inline void clk_fd_writel(struct clk_fractional_divider *fd, u32 val) in clk_fd_writel() argument
27 if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) in clk_fd_writel()
28 iowrite32be(val, fd->reg); in clk_fd_writel()
30 writel(val, fd->reg); in clk_fd_writel()
36 struct clk_fractional_divider *fd = to_clk_fd(hw); in clk_fd_recalc_rate() local
42 if (fd->lock) in clk_fd_recalc_rate()
[all …]
/kernel/linux/linux-5.10/fs/hfsplus/
Dbfind.c15 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument
19 fd->tree = tree; in hfs_find_init()
20 fd->bnode = NULL; in hfs_find_init()
24 fd->search_key = ptr; in hfs_find_init()
25 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init()
44 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
46 hfs_bnode_put(fd->bnode); in hfs_find_exit()
47 kfree(fd->search_key); in hfs_find_exit()
49 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
50 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit()
[all …]
/kernel/linux/linux-5.10/tools/testing/selftests/wireguard/qemu/
Dinit.c59 int fd; in seed_rng() local
72 fd = open("/dev/urandom", O_WRONLY); in seed_rng()
73 if (fd < 0) in seed_rng()
76 if (ioctl(fd, RNDADDENTROPY, &entropy) < 0) in seed_rng()
79 close(fd); in seed_rng()
111 int fd; in enable_logging() local
113 fd = open("/proc/sys/kernel/printk", O_WRONLY); in enable_logging()
114 if (fd >= 0) { in enable_logging()
115 if (write(fd, "9\n", 2) != 2) in enable_logging()
117 close(fd); in enable_logging()
[all …]
/kernel/linux/linux-5.10/fs/hfs/
Dbfind.c15 int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) in hfs_find_init() argument
21 fd->tree = tree; in hfs_find_init()
22 fd->bnode = NULL; in hfs_find_init()
26 fd->search_key = ptr; in hfs_find_init()
27 fd->key = ptr + tree->max_key_len + 2; in hfs_find_init()
46 void hfs_find_exit(struct hfs_find_data *fd) in hfs_find_exit() argument
48 hfs_bnode_put(fd->bnode); in hfs_find_exit()
49 kfree(fd->search_key); in hfs_find_exit()
51 fd->tree->cnid, __builtin_return_address(0)); in hfs_find_exit()
52 mutex_unlock(&fd->tree->tree_lock); in hfs_find_exit()
[all …]
/kernel/linux/linux-5.10/include/linux/
Dfile.h36 struct fd { struct
43 static inline void fdput(struct fd fd) in fdput() argument
45 if (fd.flags & FDPUT_FPUT) in fdput()
46 fput(fd.file); in fdput()
49 extern struct file *fget(unsigned int fd);
50 extern struct file *fget_many(unsigned int fd, unsigned int refs);
51 extern struct file *fget_raw(unsigned int fd);
52 extern struct file *fget_task(struct task_struct *task, unsigned int fd);
53 extern unsigned long __fdget(unsigned int fd);
54 extern unsigned long __fdget_raw(unsigned int fd);
[all …]
/kernel/linux/linux-5.10/drivers/scsi/
Dfdomain.c118 static inline void fdomain_make_bus_idle(struct fdomain *fd) in fdomain_make_bus_idle() argument
120 outb(0, fd->base + REG_BCTL); in fdomain_make_bus_idle()
121 outb(0, fd->base + REG_MCTL); in fdomain_make_bus_idle()
122 if (fd->chip == tmc18c50 || fd->chip == tmc18c30) in fdomain_make_bus_idle()
125 fd->base + REG_ACTL); in fdomain_make_bus_idle()
127 outb(ACTL_RESET | PARITY_MASK, fd->base + REG_ACTL); in fdomain_make_bus_idle()
181 struct fdomain *fd = shost_priv(sh); in fdomain_select() local
183 outb(BCTL_BUSEN | BCTL_SEL, fd->base + REG_BCTL); in fdomain_select()
184 outb(BIT(sh->this_id) | BIT(target), fd->base + REG_SCSI_DATA_NOACK); in fdomain_select()
187 outb(PARITY_MASK, fd->base + REG_ACTL); in fdomain_select()
[all …]
/kernel/linux/linux-5.10/tools/perf/tests/
Dwp.c14 #define WP_TEST_ASSERT_VAL(fd, text, val) \ argument
17 wp_read(fd, &count, sizeof(long long)); \
24 static int wp_read(int fd, long long *count, int size) in wp_read() argument
26 int ret = read(fd, count, size); in wp_read()
53 int fd; in __event() local
57 fd = sys_perf_event_open(&attr, 0, -1, -1, in __event()
59 if (fd < 0) in __event()
62 return fd; in __event()
67 int fd; in wp_ro_test() local
70 fd = __event(HW_BREAKPOINT_R, (void *)&data1, sizeof(data1)); in wp_ro_test()
[all …]
/kernel/linux/linux-5.10/tools/testing/vsock/
Dvsock_test.c35 int fd; in test_stream_connection_reset() local
37 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_connection_reset()
41 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_connection_reset()
55 close(fd); in test_stream_connection_reset()
71 int fd; in test_stream_bind_only_client() local
76 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_client()
80 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_bind_only_client()
97 close(fd); in test_stream_bind_only_client()
112 int fd; in test_stream_bind_only_server() local
114 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_server()
[all …]
/kernel/linux/linux-5.10/fs/
Dfile.c36 kvfree(fdt->fd); in __free_fdtable()
84 memcpy(nfdt->fd, ofdt->fd, cpy); in copy_fdtable()
85 memset((char *)nfdt->fd + cpy, 0, set); in copy_fdtable()
139 fdt->fd = data; in alloc_fdtable()
155 kvfree(fdt->fd); in alloc_fdtable()
249 static inline void __set_close_on_exec(unsigned int fd, struct fdtable *fdt) in __set_close_on_exec() argument
251 __set_bit(fd, fdt->close_on_exec); in __set_close_on_exec()
254 static inline void __clear_close_on_exec(unsigned int fd, struct fdtable *fdt) in __clear_close_on_exec() argument
256 if (test_bit(fd, fdt->close_on_exec)) in __clear_close_on_exec()
257 __clear_bit(fd, fdt->close_on_exec); in __clear_close_on_exec()
[all …]
/kernel/linux/build/test/unittest/accesstokenid/
Daccesstokenid_test.cpp72 int fd; in GenRand64() local
74 fd = open("/dev/random", O_RDONLY); in GenRand64()
75 if (fd > 0) { in GenRand64()
76 read(fd, &randvalue, sizeof(unsigned long long)); in GenRand64()
78 close(fd); in GenRand64()
88 int fd = open(dev_accesstokenid, O_RDWR); in GetTokenid() local
89 if (fd < 0) { in GetTokenid()
94 int ret = ioctl(fd, ACCESS_TOKENID_GET_TOKENID, token); in GetTokenid()
97 close(fd); in GetTokenid()
101 close(fd); in GetTokenid()
[all …]
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/
Dtest_maps.c40 int fd; in test_hashmap() local
42 fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value), in test_hashmap()
44 if (fd < 0) { in test_hashmap()
52 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); in test_hashmap()
56 assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) == -1 && in test_hashmap()
61 assert(bpf_map_update_elem(fd, &key, &value, -1) == -1 && in test_hashmap()
65 assert(bpf_map_lookup_elem(fd, &key, &value) == 0 && value == 1234); in test_hashmap()
69 assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == ENOENT); in test_hashmap()
72 assert(bpf_map_update_elem(fd, &key, &value, BPF_EXIST) == -1 && in test_hashmap()
77 assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) == 0); in test_hashmap()
[all …]
/kernel/linux/linux-5.10/tools/testing/selftests/net/
Dipv6_flowlabel_mgr.c48 static int flowlabel_get(int fd, uint32_t label, uint8_t share, uint16_t flags) in flowlabel_get() argument
61 return setsockopt(fd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &req, sizeof(req)); in flowlabel_get()
64 static int flowlabel_put(int fd, uint32_t label) in flowlabel_put() argument
71 return setsockopt(fd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &req, sizeof(req)); in flowlabel_put()
74 static void run_tests(int fd) in run_tests() argument
80 expect_fail(flowlabel_get(fd, 1, IPV6_FL_S_ANY, 0)); in run_tests()
83 expect_fail(flowlabel_put(fd, 1)); in run_tests()
86 expect_fail(flowlabel_get(fd, 0x1FFFFF, IPV6_FL_S_ANY, in run_tests()
90 expect_pass(flowlabel_get(fd, 1, IPV6_FL_S_ANY, IPV6_FL_F_CREATE)); in run_tests()
92 expect_pass(flowlabel_get(fd, 1, IPV6_FL_S_ANY, 0)); in run_tests()
[all …]
Dreuseaddr_ports_exhausted.c58 int fd, ret; in bind_port() local
60 fd = socket(AF_INET, SOCK_STREAM, 0); in bind_port()
61 ASSERT_NE(-1, fd) TH_LOG("failed to open socket."); in bind_port()
63 ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)); in bind_port()
66 ret = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &reuseport, sizeof(int)); in bind_port()
73 if (bind(fd, (struct sockaddr *)&local_addr, len) == -1) { in bind_port()
74 close(fd); in bind_port()
78 return fd; in bind_port()
84 int i, j, fd[2]; in TEST() local
90 fd[j] = bind_port(_metadata, opts->reuseaddr[j], opts->reuseport[j]); in TEST()
[all …]
/kernel/liteos_a/testsuites/unittest/extended/liteipc/smoke/
Dliteipc_test_001.cpp52 int fd = open(LITEIPC_DRIVER, O_WRONLY | O_CLOEXEC); in LiteIpcTest() local
53 ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); in LiteIpcTest()
54 ret = close(fd); in LiteIpcTest()
56 fd = open(LITEIPC_DRIVER, O_RDONLY | O_CREAT); in LiteIpcTest()
57 ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); in LiteIpcTest()
58 ret = close(fd); in LiteIpcTest()
60 fd = open(LITEIPC_DRIVER, O_RDWR | O_SYNC); in LiteIpcTest()
61 ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); in LiteIpcTest()
64 retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); in LiteIpcTest()
66 retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0); in LiteIpcTest()
[all …]
/kernel/linux/linux-5.10/fs/jffs2/
Dbuild.c56 struct jffs2_full_dirent *fd; in jffs2_build_inode_pass1() local
61 for(fd = ic->scan_dents; fd; fd = fd->next) { in jffs2_build_inode_pass1()
63 if (!fd->ino) in jffs2_build_inode_pass1()
68 child_ic = jffs2_get_ino_cache(c, fd->ino); in jffs2_build_inode_pass1()
71 fd->name, fd->ino, ic->ino); in jffs2_build_inode_pass1()
72 jffs2_mark_node_obsolete(c, fd->raw); in jffs2_build_inode_pass1()
74 fd->ic = NULL; in jffs2_build_inode_pass1()
79 fd->ic = child_ic; in jffs2_build_inode_pass1()
83 if (fd->type == DT_DIR) { in jffs2_build_inode_pass1()
89 dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); in jffs2_build_inode_pass1()
[all …]
/kernel/linux/linux-5.10/arch/um/os-Linux/
Dfile.c43 int os_stat_fd(const int fd, struct uml_stat *ubuf) in os_stat_fd() argument
48 CATCH_EINTR(err = fstat64(fd, &sbuf)); in os_stat_fd()
88 int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg) in os_ioctl_generic() argument
92 err = ioctl(fd, cmd, arg); in os_ioctl_generic()
100 int os_get_ifname(int fd, char* namebuf) in os_get_ifname() argument
102 if (ioctl(fd, SIOCGIFNAME, namebuf) < 0) in os_get_ifname()
108 int os_set_slip(int fd) in os_set_slip() argument
113 if (ioctl(fd, TIOCSETD, &disc) < 0) in os_set_slip()
117 if (ioctl(fd, SIOCSIFENCAP, &sencap) < 0) in os_set_slip()
123 int os_mode_fd(int fd, int mode) in os_mode_fd() argument
[all …]
/kernel/linux/linux-5.10/drivers/clk/ti/
Dfapll.c78 struct fapll_data *fd; member
86 static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) in ti_fapll_clock_is_bypass() argument
88 u32 v = readl_relaxed(fd->base); in ti_fapll_clock_is_bypass()
90 if (fd->bypass_bit_inverted) in ti_fapll_clock_is_bypass()
96 static void ti_fapll_set_bypass(struct fapll_data *fd) in ti_fapll_set_bypass() argument
98 u32 v = readl_relaxed(fd->base); in ti_fapll_set_bypass()
100 if (fd->bypass_bit_inverted) in ti_fapll_set_bypass()
104 writel_relaxed(v, fd->base); in ti_fapll_set_bypass()
107 static void ti_fapll_clear_bypass(struct fapll_data *fd) in ti_fapll_clear_bypass() argument
109 u32 v = readl_relaxed(fd->base); in ti_fapll_clear_bypass()
[all …]
/kernel/linux/linux-5.10/tools/testing/selftests/efivarfs/
Dopen-unlink.c16 int fd; in set_immutable() local
20 fd = open(path, O_RDONLY); in set_immutable()
21 if (fd < 0) in set_immutable()
22 return fd; in set_immutable()
24 rc = ioctl(fd, FS_IOC_GETFLAGS, &flags); in set_immutable()
27 close(fd); in set_immutable()
37 rc = ioctl(fd, FS_IOC_SETFLAGS, &flags); in set_immutable()
39 close(fd); in set_immutable()
47 int fd; in get_immutable() local
51 fd = open(path, O_RDONLY); in get_immutable()
[all …]
/kernel/linux/linux-5.10/drivers/infiniband/hw/hfi1/
Duser_exp_rcv.c57 struct hfi1_filedata *fd);
59 static int set_rcvarray_entry(struct hfi1_filedata *fd,
68 static int program_rcvarray(struct hfi1_filedata *fd, struct tid_user_buf *,
73 static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo,
75 static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node);
86 int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd, in hfi1_user_exp_rcv_init() argument
91 fd->entry_to_rb = kcalloc(uctxt->expected_count, in hfi1_user_exp_rcv_init()
94 if (!fd->entry_to_rb) in hfi1_user_exp_rcv_init()
98 fd->invalid_tid_idx = 0; in hfi1_user_exp_rcv_init()
99 fd->invalid_tids = kcalloc(uctxt->expected_count, in hfi1_user_exp_rcv_init()
[all …]
/kernel/linux/linux-5.10/samples/timers/
Dhpet_example.c82 int fd; in hpet_open_close() local
89 fd = open(argv[0], O_RDONLY); in hpet_open_close()
90 if (fd < 0) in hpet_open_close()
93 close(fd); in hpet_open_close()
102 int fd; in hpet_info() local
109 fd = open(argv[0], O_RDONLY); in hpet_info()
110 if (fd < 0) { in hpet_info()
115 if (ioctl(fd, HPET_INFO, &info) < 0) { in hpet_info()
126 close(fd); in hpet_info()
134 int iterations, i, fd; in hpet_poll() local
[all …]
/kernel/linux/linux-5.10/arch/um/drivers/
Dport_kern.c24 int fd; member
38 int fd; member
48 int fd; in pipe_interrupt() local
50 fd = os_rcv_fd(conn->socket[0], &conn->helper_pid); in pipe_interrupt()
51 if (fd < 0) { in pipe_interrupt()
52 if (fd == -EAGAIN) in pipe_interrupt()
56 -fd); in pipe_interrupt()
57 os_close_file(conn->fd); in pipe_interrupt()
62 conn->fd = fd; in pipe_interrupt()
79 int fd, socket[2], pid; in port_accept() local
[all …]
/kernel/uniproton/src/fs/
Dfs.c41 int close(int fd) in close() argument
43 S32 ret = OsVfsClose(fd); in close()
47 ssize_t read(int fd, void *buf, size_t nbyte) in read() argument
49 ssize_t ret = OsVfsRead(fd, buf, nbyte); in read()
53 ssize_t write(int fd, const void *buf, size_t nbyte) in write() argument
55 ssize_t ret = OsVfsWrite(fd, buf, nbyte); in write()
59 off_t lseek(int fd, off_t offset, int whence) in lseek() argument
61 return OsVfsLseek(fd, offset, whence); in lseek()
88 int fsync(int fd) in fsync() argument
90 S32 ret = OsVfsSync(fd); in fsync()
[all …]
/kernel/linux/linux-5.10/tools/testing/selftests/sync/
Dsync.c58 int sync_wait(int fd, int timeout) in sync_wait() argument
62 fds.fd = fd; in sync_wait()
84 static struct sync_file_info *sync_file_info(int fd) in sync_file_info() argument
94 err = ioctl(fd, SYNC_IOC_FILE_INFO, info); in sync_file_info()
114 err = ioctl(fd, SYNC_IOC_FILE_INFO, info); in sync_file_info()
131 int sync_fence_size(int fd) in sync_fence_size() argument
134 struct sync_file_info *info = sync_file_info(fd); in sync_fence_size()
146 int sync_fence_count_with_status(int fd, int status) in sync_fence_count_with_status() argument
150 struct sync_file_info *info = sync_file_info(fd); in sync_fence_count_with_status()
171 int sw_sync_timeline_inc(int fd, unsigned int count) in sw_sync_timeline_inc() argument
[all …]

12345678910>>...70