| /tools/testing/selftests/openat2/ |
| D | resolve_test.c | 112 const char *path; member 117 const char *path; member 139 .path = "/", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 142 .path = "cheeky/absself", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 145 .path = "abscheeky/absself", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 148 .path = "..", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 151 .path = "../root/", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 154 .path = "cheeky/self", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 157 .path = "abscheeky/self", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() 160 .path = "cheeky/garbageself", .how.resolve = RESOLVE_BENEATH, in test_openat2_opath_tests() [all …]
|
| D | helpers.c | 22 int raw_openat2(int dfd, const char *path, void *how, size_t size) in raw_openat2() argument 24 int ret = syscall(__NR_openat2, dfd, path, how, size); in raw_openat2() 28 int sys_openat2(int dfd, const char *path, struct open_how *how) in sys_openat2() argument 30 return raw_openat2(dfd, path, how, sizeof(*how)); in sys_openat2() 33 int sys_openat(int dfd, const char *path, struct open_how *how) in sys_openat() argument 35 int ret = openat(dfd, path, how->flags, how->mode); in sys_openat() 47 int touchat(int dfd, const char *path) in touchat() argument 49 int fd = openat(dfd, path, O_CREAT, 0700); in touchat() 71 bool fdequal(int fd, int dfd, const char *path) in fdequal() argument 79 if (!path) in fdequal() [all …]
|
| /tools/perf/util/ |
| D | trace-event-info.c | 90 char *path = get_events_file("header_page"); in record_header_files() local 94 if (!path) { in record_header_files() 99 if (stat(path, &st) < 0) { in record_header_files() 100 pr_debug("can't read '%s'", path); in record_header_files() 109 if (record_file(path, 8) < 0) { in record_header_files() 114 put_events_file(path); in record_header_files() 116 path = get_events_file("header_event"); in record_header_files() 117 if (!path) { in record_header_files() 123 if (stat(path, &st) < 0) { in record_header_files() 124 pr_debug("can't read '%s'", path); in record_header_files() [all …]
|
| D | path.c | 13 static char *cleanup_path(char *path) in cleanup_path() argument 16 if (!memcmp(path, "./", 2)) { in cleanup_path() 17 path += 2; in cleanup_path() 18 while (*path == '/') in cleanup_path() 19 path++; in cleanup_path() 21 return path; in cleanup_path() 61 char path[PATH_MAX]; in is_directory() local 64 snprintf(path, sizeof(path), "%s/%s", base_path, dent->d_name); in is_directory() 65 if (stat(path, &st)) in is_directory() 73 char path[PATH_MAX]; in is_executable_file() local [all …]
|
| D | data.c | 27 zfree(&files[nr].path); in close_dir() 53 ret = asprintf(&file->path, "%s/data.%d", data->path, i); in perf_data__create_dir() 60 ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); in perf_data__create_dir() 110 dir = opendir(data->path); in perf_data__open_dir() 116 char path[PATH_MAX]; in perf_data__open_dir() local 119 snprintf(path, sizeof(path), "%s/%s", data->path, dent->d_name); in perf_data__open_dir() 120 if (stat(path, &st)) in perf_data__open_dir() 135 file->path = strdup(path); in perf_data__open_dir() 136 if (!file->path) in perf_data__open_dir() 139 ret = open(file->path, O_RDONLY); in perf_data__open_dir() [all …]
|
| D | util.c | 94 int mkdir_p(char *path, mode_t mode) in mkdir_p() argument 98 char *d = path; in mkdir_p() 103 if (stat(path, &st) == 0) in mkdir_p() 110 err = stat(path, &st) && mkdir(path, mode); in mkdir_p() 117 return (stat(path, &st) && mkdir(path, mode)) ? -1 : 0; in mkdir_p() 151 static int rm_rf_depth_pat(const char *path, int depth, const char **pat) in rm_rf_depth_pat() argument 160 ret = lstat(path, &statbuf); in rm_rf_depth_pat() 166 return unlink(path); in rm_rf_depth_pat() 169 dir = opendir(path); in rm_rf_depth_pat() 184 path, d->d_name); in rm_rf_depth_pat() [all …]
|
| /tools/lib/api/fs/ |
| D | fs.c | 94 char *path; member 158 char path[PATH_MAX + 1]; in fs__read_mounts() local 165 path, type) == 2) { in fs__read_mounts() 168 fs->path = strdup(path); in fs__read_mounts() 170 return fs->path != NULL; in fs__read_mounts() 196 fs->path = strdup(*ptr); in fs__check_mounts() 197 if (!fs->path) in fs__check_mounts() 236 fs->path = strdup(override_path); in fs__env_override() 237 if (!fs->path) in fs__env_override() 247 assert(!fs->path); in fs__init_once() [all …]
|
| /tools/testing/selftests/mm/ |
| D | thp_settings.c | 46 int read_file(const char *path, char *buf, size_t buflen) in read_file() argument 51 fd = open(path, O_RDONLY); in read_file() 67 int write_file(const char *path, const char *buf, size_t buflen) in write_file() argument 72 fd = open(path, O_WRONLY); in write_file() 74 printf("open(%s)\n", path); in write_file() 90 const unsigned long read_num(const char *path) in read_num() argument 94 if (read_file(path, buf, sizeof(buf)) < 0) { in read_num() 102 void write_num(const char *path, unsigned long num) in write_num() argument 107 if (!write_file(path, buf, strlen(buf) + 1)) { in write_num() 108 perror(path); in write_num() [all …]
|
| /tools/power/cpupower/utils/helpers/ |
| D | misc.c | 54 char path[SYSFS_PATH_MAX]; in cpupower_intel_get_perf_bias() local 61 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/power/energy_perf_bias", cpu); in cpupower_intel_get_perf_bias() 63 if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0) in cpupower_intel_get_perf_bias() 75 char path[SYSFS_PATH_MAX]; in cpupower_intel_set_perf_bias() local 81 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/power/energy_perf_bias", cpu); in cpupower_intel_set_perf_bias() 84 if (cpupower_write_sysfs(path, linebuf, 3) <= 0) in cpupower_intel_set_perf_bias() 92 char path[SYSFS_PATH_MAX]; in cpupower_set_epp() local 95 snprintf(path, sizeof(path), in cpupower_set_epp() 98 if (!is_valid_path(path)) in cpupower_set_epp() 103 if (cpupower_write_sysfs(path, linebuf, 30) <= 0) in cpupower_set_epp() [all …]
|
| D | sysfs.c | 18 unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) in sysfs_read_file() argument 23 fd = open(path, O_RDONLY); in sysfs_read_file() 49 char path[SYSFS_PATH_MAX]; in sysfs_is_cpu_online() local 57 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u", cpu); in sysfs_is_cpu_online() 59 if (stat(path, &statbuf) != 0) in sysfs_is_cpu_online() 66 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/online", cpu); in sysfs_is_cpu_online() 67 if (stat(path, &statbuf) != 0) in sysfs_is_cpu_online() 70 fd = open(path, O_RDONLY); in sysfs_is_cpu_online() 107 char path[SYSFS_PATH_MAX]; in sysfs_idlestate_file_exists() local 111 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuidle/state%u/%s", in sysfs_idlestate_file_exists() [all …]
|
| /tools/hv/ |
| D | vmbus_testing | 30 if not os.path.isdir(debugfs_hyperv_path): 78 path = args.path if "path" in arg_set else None 79 if (path and path[-1] == "/"): 80 path = path[:-1] 81 validate_args_path(path, arg_set, file_map) 82 if (path and "enable_single" in arg_set): 83 state_path = locate_state(path, file_map) 93 set_delay_values(path, file_map, args.delay_time, 98 disable_testing_single_device(path, file_map) 102 get_device_test_values(path, file_map) [all …]
|
| /tools/testing/selftests/damon/ |
| D | _damon_sysfs.py | 18 def write_file(path, string): argument 22 with open(path, 'w') as f: 28 def read_file(path): argument 32 with open(path, 'r') as f: 56 return os.path.join(self.scheme.sysfs_dir(), 'access_pattern') 60 os.path.join(self.sysfs_dir(), 'sz', 'min'), self.size[0]) 64 os.path.join(self.sysfs_dir(), 'sz', 'max'), self.size[1]) 67 err = write_file(os.path.join(self.sysfs_dir(), 'nr_accesses', 'min'), 71 err = write_file(os.path.join(self.sysfs_dir(), 'nr_accesses', 'max'), 76 os.path.join(self.sysfs_dir(), 'age', 'min'), self.age[0]) [all …]
|
| /tools/testing/selftests/devices/probe/ |
| D | test_discoverable_devices.py | 25 this_dir = os.path.dirname(os.path.realpath(__file__)) 26 sys.path.append(os.path.join(this_dir, "../../kselftest/")) 41 for path, dirs, _ in os.walk(sysfs_devices): 44 pci_controllers.append(os.path.join(path, d)) 53 usb_controllers.append(os.path.realpath(d.path)) 64 with open(os.path.join(sysfs_dev_dir, "uevent")) as f: 69 sysfs_dev_dir = os.path.dirname(sysfs_dev_dir) 80 with open(os.path.join(sysfs_dev_dir, "uevent")) as f: 85 sysfs_dev_dir = os.path.dirname(sysfs_dev_dir) 89 with open(os.path.join(sysfs_dev_dir, "firmware_node", "uid")) as f: [all …]
|
| /tools/power/cpupower/lib/ |
| D | cpupower.c | 17 int is_valid_path(const char *path) in is_valid_path() argument 19 if (access(path, F_OK) == -1) in is_valid_path() 24 unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen) in cpupower_read_sysfs() argument 29 fd = open(path, O_RDONLY); in cpupower_read_sysfs() 45 unsigned int cpupower_write_sysfs(const char *path, char *buf, size_t buflen) in cpupower_write_sysfs() argument 50 fd = open(path, O_WRONLY); in cpupower_write_sysfs() 56 perror(path); in cpupower_write_sysfs() 76 char path[SYSFS_PATH_MAX]; in cpupower_is_cpu_online() local 84 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u", cpu); in cpupower_is_cpu_online() 86 if (stat(path, &statbuf) != 0) in cpupower_is_cpu_online() [all …]
|
| /tools/lib/subcmd/ |
| D | exec-cmd.c | 34 static int is_absolute_path(const char *path) in is_absolute_path() argument 36 return path[0] == '/'; in is_absolute_path() 57 static const char *make_nonrelative_path(char *buf, size_t sz, const char *path) in make_nonrelative_path() argument 59 if (is_absolute_path(path)) { in make_nonrelative_path() 60 if (strlcpy(buf, path, sz) >= sz) in make_nonrelative_path() 61 die("Too long path: %.*s", 60, path); in make_nonrelative_path() 68 if (strlen(cwd) + strlen(path) + 2 >= sz) in make_nonrelative_path() 69 die("Too long path: %.*s", 60, path); in make_nonrelative_path() 72 strcat(buf, path); in make_nonrelative_path() 77 char *system_path(const char *path) in system_path() argument [all …]
|
| /tools/perf/tests/ |
| D | api-io.c | 37 static int make_test_file(char path[PATH_MAX], const char *contents) in make_test_file() 42 strcpy(path, TEMPL); in make_test_file() 43 fd = mkstemp(path); in make_test_file() 51 unlink(path); in make_test_file() 58 static int setup_test(char path[PATH_MAX], const char *contents, in setup_test() 61 if (make_test_file(path, contents)) in setup_test() 64 io->fd = open(path, O_RDONLY); in setup_test() 66 pr_debug("Failed to open '%s'\n", path); in setup_test() 67 unlink(path); in setup_test() 74 unlink(path); in setup_test() [all …]
|
| /tools/testing/selftests/lsm/ |
| D | common.c | 24 char *path; in read_proc_attr() local 27 path = calloc(len, 1); in read_proc_attr() 28 if (path == NULL) in read_proc_attr() 30 sprintf(path, "%s%s", PROCATTR, attr); in read_proc_attr() 32 fd = open(path, O_RDONLY); in read_proc_attr() 33 free(path); in read_proc_attr() 46 path = strchr(value, '\n'); in read_proc_attr() 47 if (path) in read_proc_attr() 48 *path = '\0'; in read_proc_attr()
|
| /tools/testing/selftests/efivarfs/ |
| D | open-unlink.c | 13 static int set_immutable(const char *path, int immutable) in set_immutable() argument 20 fd = open(path, O_RDONLY); in set_immutable() 44 static int get_immutable(const char *path) in get_immutable() argument 51 fd = open(path, O_RDONLY); in get_immutable() 70 const char *path; in main() local 79 path = argv[1]; in main() 89 fd = open(path, O_WRONLY | O_CREAT, 0600); in main() 103 rc = get_immutable(path); in main() 108 rc = set_immutable(path, 0); in main() 115 fd = open(path, O_RDONLY); in main() [all …]
|
| /tools/testing/selftests/sched_ext/ |
| D | util.c | 14 static ssize_t read_text(const char *path, char *buf, size_t max_len) in read_text() argument 19 fd = open(path, O_RDONLY); in read_text() 33 static ssize_t write_text(const char *path, char *buf, ssize_t len) in write_text() argument 38 fd = open(path, O_WRONLY | O_APPEND); in write_text() 47 long file_read_long(const char *path) in file_read_long() argument 52 if (read_text(path, buf, sizeof(buf)) <= 0) in file_read_long() 58 int file_write_long(const char *path, long val) in file_write_long() argument 67 if (write_text(path, buf, sizeof(buf)) <= 0) in file_write_long()
|
| /tools/testing/selftests/nsfs/ |
| D | pidns.c | 44 char path[] = "/proc/0123456789/ns/pid"; in main() local 55 snprintf(path, sizeof(path), "/proc/%d/ns/%s", pid, ns_strs[i]); in main() 56 ns = open(path, O_RDONLY); in main() 58 return pr_err("Unable to open %s", path); in main() 64 snprintf(path, sizeof(path), "/proc/self/ns/%s", ns_strs[i]); in main() 65 if (stat(path, &st2)) in main() 66 return pr_err("Unable to stat %s", path); in main()
|
| /tools/testing/selftests/memfd/ |
| D | fuse_mnt.c | 27 static int memfd_getattr(const char *path, struct stat *st) in memfd_getattr() argument 31 if (!strcmp(path, "/")) { in memfd_getattr() 34 } else if (!strcmp(path, memfd_path)) { in memfd_getattr() 45 static int memfd_readdir(const char *path, in memfd_readdir() argument 51 if (strcmp(path, "/")) in memfd_readdir() 61 static int memfd_open(const char *path, struct fuse_file_info *fi) in memfd_open() argument 63 if (strcmp(path, memfd_path)) in memfd_open() 75 static int memfd_read(const char *path, in memfd_read() argument 83 if (strcmp(path, memfd_path) != 0) in memfd_read()
|
| /tools/include/nolibc/ |
| D | sys.h | 124 int sys_chdir(const char *path) in sys_chdir() argument 126 return my_syscall1(__NR_chdir, path); in sys_chdir() 130 int chdir(const char *path) in chdir() argument 132 return __sysret(sys_chdir(path)); in chdir() 141 int sys_chmod(const char *path, mode_t mode) in sys_chmod() argument 144 return my_syscall4(__NR_fchmodat, AT_FDCWD, path, mode, 0); in sys_chmod() 146 return my_syscall2(__NR_chmod, path, mode); in sys_chmod() 148 return __nolibc_enosys(__func__, path, mode); in sys_chmod() 153 int chmod(const char *path, mode_t mode) in chmod() argument 155 return __sysret(sys_chmod(path, mode)); in chmod() [all …]
|
| /tools/testing/selftests/bpf/progs/ |
| D | verifier_vfs_accept.c | 58 int BPF_PROG(path_d_path_from_path_argument, struct path *path) in BPF_PROG() argument 62 ret = bpf_path_d_path(path, buf, sizeof(buf)); in BPF_PROG() 72 struct path *path; in BPF_PROG() local 79 path = &file->f_path; in BPF_PROG() 80 ret = bpf_path_d_path(path, buf, sizeof(buf)); in BPF_PROG()
|
| D | cgrp_kfunc_failure.c | 33 int BPF_PROG(cgrp_kfunc_acquire_untrusted, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 52 int BPF_PROG(cgrp_kfunc_acquire_no_null_check, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 68 int BPF_PROG(cgrp_kfunc_acquire_fp, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 70 struct cgroup *acquired, *stack_cgrp = (struct cgroup *)&path; in BPF_PROG() 96 int BPF_PROG(cgrp_kfunc_acquire_trusted_walked, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 110 int BPF_PROG(cgrp_kfunc_acquire_null, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 124 int BPF_PROG(cgrp_kfunc_acquire_unreleased, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 138 int BPF_PROG(cgrp_kfunc_xchg_unreleased, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 158 int BPF_PROG(cgrp_kfunc_rcu_get_release, struct cgroup *cgrp, const char *path) in BPF_PROG() argument 179 int BPF_PROG(cgrp_kfunc_release_untrusted, struct cgroup *cgrp, const char *path) in BPF_PROG() argument [all …]
|
| /tools/verification/dot2/ |
| D | dot2k.py | 34 if os.path.exists(self.monitor_templates_dir) == True: 42 if os.path.exists(kernel_path) == True: 46 if os.path.exists("/usr/share/dot2/dot2k_templates/") == True: 53 def __open_file(self, path): argument 55 fd = open(path) 57 raise Exception("Cannot open the file: %s" % path) 149 path = "%s/%s" % (self.name, file_name) 151 file = open(path, 'w') 155 print("Fail creating file: %s" % path) 162 path = "%s/%s" % (self.name, "main.c") [all …]
|