/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 | data.c | 25 zfree(&files[nr].path); in close_dir() 50 ret = asprintf(&file->path, "%s/data.%d", data->path, i); in perf_data__create_dir() 54 ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); in perf_data__create_dir() 93 dir = opendir(data->path); in perf_data__open_dir() 99 char path[PATH_MAX]; in perf_data__open_dir() local 102 snprintf(path, sizeof(path), "%s/%s", data->path, dent->d_name); in perf_data__open_dir() 103 if (stat(path, &st)) in perf_data__open_dir() 118 file->path = strdup(path); in perf_data__open_dir() 119 if (!file->path) in perf_data__open_dir() 122 ret = open(file->path, O_RDONLY); in perf_data__open_dir() [all …]
|
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 | 37 static char *cleanup_path(char *path) in cleanup_path() argument 40 if (!memcmp(path, "./", 2)) { in cleanup_path() 41 path += 2; in cleanup_path() 42 while (*path == '/') in cleanup_path() 43 path++; in cleanup_path() 45 return path; in cleanup_path() 86 char path[PATH_MAX]; in is_directory() local 89 sprintf(path, "%s/%s", base_path, dent->d_name); in is_directory() 90 if (stat(path, &st)) in is_directory()
|
D | util.c | 91 int mkdir_p(char *path, mode_t mode) in mkdir_p() argument 95 char *d = path; in mkdir_p() 100 if (stat(path, &st) == 0) in mkdir_p() 107 err = stat(path, &st) && mkdir(path, mode); in mkdir_p() 114 return (stat(path, &st) && mkdir(path, mode)) ? -1 : 0; in mkdir_p() 148 static int rm_rf_depth_pat(const char *path, int depth, const char **pat) in rm_rf_depth_pat() argument 157 ret = lstat(path, &statbuf); in rm_rf_depth_pat() 163 return unlink(path); in rm_rf_depth_pat() 166 dir = opendir(path); in rm_rf_depth_pat() 181 path, d->d_name); in rm_rf_depth_pat() [all …]
|
/tools/testing/selftests/bpf/ |
D | cgroup_helpers.c | 32 #define format_cgroup_path(buf, path) \ argument 34 CGROUP_WORK_DIR, path) 46 char path[PATH_MAX + 1]; in enable_all_controllers() local 52 snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); in enable_all_controllers() 53 fd = open(path, O_RDONLY); in enable_all_controllers() 55 log_err("Opening cgroup.controllers: %s", path); in enable_all_controllers() 62 log_err("Reading cgroup.controllers: %s", path); in enable_all_controllers() 72 snprintf(path, sizeof(path), "%s/cgroup.subtree_control", cgroup_path); in enable_all_controllers() 73 cfd = open(path, O_RDWR); in enable_all_controllers() 75 log_err("Opening cgroup.subtree_control: %s", path); in enable_all_controllers() [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/lib/api/fs/ |
D | fs.c | 91 char path[PATH_MAX]; member 161 fs->path, type) == 2) { in fs__read_mounts() 192 strcpy(fs->path, *ptr); in fs__check_mounts() 232 strncpy(fs->path, override_path, sizeof(fs->path) - 1); in fs__env_override() 233 fs->path[sizeof(fs->path) - 1] = '\0'; in fs__env_override() 240 return fs->path; in fs__get_mountpoint() 243 return fs->path; in fs__get_mountpoint() 246 return fs->path; in fs__get_mountpoint() 256 return (const char *)fs->path; in fs__mountpoint() 287 return (const char *)fs->path; in fs__mount() [all …]
|
/tools/perf/tests/ |
D | topology.c | 16 static int get_temp(char *path) in get_temp() argument 20 strcpy(path, TEMPL); in get_temp() 22 fd = mkstemp(path); in get_temp() 32 static int session_write_header(char *path) in session_write_header() argument 36 .path = path, in session_write_header() 61 static int check_cpu_topology(char *path, struct perf_cpu_map *map) in check_cpu_topology() argument 65 .path = path, in check_cpu_topology() 117 char path[PATH_MAX]; in test__session_topology() local 121 TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); in test__session_topology() 123 pr_debug("templ file: %s\n", path); in test__session_topology() [all …]
|
D | api-io.c | 36 static int make_test_file(char path[PATH_MAX], const char *contents) in make_test_file() 41 strcpy(path, TEMPL); in make_test_file() 42 fd = mkstemp(path); in make_test_file() 50 unlink(path); in make_test_file() 57 static int setup_test(char path[PATH_MAX], const char *contents, in setup_test() 60 if (make_test_file(path, contents)) in setup_test() 63 io->fd = open(path, O_RDONLY); in setup_test() 65 pr_debug("Failed to open '%s'\n", path); in setup_test() 66 unlink(path); in setup_test() 73 unlink(path); in setup_test() [all …]
|
D | genelf.c | 28 char path[PATH_MAX]; in test__jit_write_elf() local 31 strcpy(path, TEMPL); in test__jit_write_elf() 33 fd = mkstemp(path); in test__jit_write_elf() 39 pr_info("Writing jit code to: %s\n", path); in test__jit_write_elf() 45 unlink(path); in test__jit_write_elf()
|
/tools/lib/subcmd/ |
D | exec-cmd.c | 31 static int is_absolute_path(const char *path) in is_absolute_path() argument 33 return path[0] == '/'; in is_absolute_path() 55 static const char *make_nonrelative_path(const char *path) in make_nonrelative_path() argument 59 if (is_absolute_path(path)) { in make_nonrelative_path() 60 if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) in make_nonrelative_path() 61 die("Too long path: %.*s", 60, path); in make_nonrelative_path() 66 if (snprintf(buf, PATH_MAX, "%s/%s", cwd, path) >= PATH_MAX) in make_nonrelative_path() 67 die("Too long path: %.*s", 60, path); in make_nonrelative_path() 72 char *system_path(const char *path) in system_path() argument 76 if (is_absolute_path(path)) in system_path() [all …]
|
/tools/power/cpupower/utils/helpers/ |
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/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/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()
|
D | owner.c | 30 char path[128]; in main() local 55 snprintf(path, sizeof(path), "/proc/%d/ns/uts", pid); in main() 56 ns = open(path, O_RDONLY); in main() 58 return pr_err("Unable to open %s", path); in main() 67 snprintf(path, sizeof(path), "/proc/%d/ns/user", pid); in main() 68 if (stat(path, &st2)) 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/power/cpupower/lib/ |
D | cpupower.c | 17 unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen) in cpupower_read_sysfs() argument 22 fd = open(path, O_RDONLY); in cpupower_read_sysfs() 48 char path[SYSFS_PATH_MAX]; in cpupower_is_cpu_online() local 56 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u", cpu); in cpupower_is_cpu_online() 58 if (stat(path, &statbuf) != 0) in cpupower_is_cpu_online() 65 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/online", cpu); in cpupower_is_cpu_online() 66 if (stat(path, &statbuf) != 0) in cpupower_is_cpu_online() 69 fd = open(path, O_RDONLY); in cpupower_is_cpu_online() 93 char path[SYSFS_PATH_MAX]; in sysfs_topology_read_file() local 95 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s", in sysfs_topology_read_file() [all …]
|
D | cpuidle.c | 33 char path[SYSFS_PATH_MAX]; in cpuidle_state_file_exists() local 37 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuidle/state%u/%s", in cpuidle_state_file_exists() 39 if (stat(path, &statbuf) != 0) in cpuidle_state_file_exists() 56 char path[SYSFS_PATH_MAX]; in cpuidle_state_read_file() local 60 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuidle/state%u/%s", in cpuidle_state_read_file() 63 fd = open(path, O_RDONLY); in cpuidle_state_read_file() 91 char path[SYSFS_PATH_MAX]; in cpuidle_state_write_file() local 95 snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpuidle/state%u/%s", in cpuidle_state_write_file() 98 fd = open(path, O_WRONLY); in cpuidle_state_write_file() 317 char path[SYSFS_PATH_MAX]; in sysfs_cpuidle_read_file() local [all …]
|
/tools/virtio/virtio-trace/ |
D | README | 43 of CPUs and a control path, so FIFO (named pipe) should be created as follows: 45 # mkfifo /tmp/virtio-trace/trace-path-cpu{0,1,2,...,X}.{in,out} 46 # mkfifo /tmp/virtio-trace/agent-ctl-path.{in,out} 49 trace-path-cpu{0,1,2}.{in.out} 51 agent-ctl-path.{in,out}. 58 ##control path## 59 -chardev pipe,id=charchannel0,path=/tmp/virtio-trace/agent-ctl-path\ 61 id=channel0,name=agent-ctl-path\ 62 ##data path## 63 -chardev pipe,id=charchannel1,path=/tmp/virtio-trace/trace-path-cpu0\ [all …]
|
/tools/testing/selftests/ia64/ |
D | aliasing-test.c | 24 static int map_mem(char *path, off_t offset, size_t length, int touch) in map_mem() argument 30 fd = open(path, O_RDWR); in map_mem() 32 perror(path); in map_mem() 36 if (fnmatch("/proc/bus/pci/*", path, 0) == 0) { in map_mem() 62 static int scan_tree(char *path, char *file, off_t offset, size_t length, int touch) in scan_tree() argument 69 n = scandir(path, &namelist, 0, alphasort); in scan_tree() 83 path2 = malloc(strlen(path) + strlen(name) + 3); in scan_tree() 84 strcpy(path2, path); in scan_tree() 119 static int read_rom(char *path) in read_rom() argument 124 fd = open(path, O_RDWR); in read_rom() [all …]
|
/tools/perf/arch/ |
D | common.c | 95 char *path, *tmp = NULL; in lookup_path() local 106 path = strtok_r(env, ":", &tmp); in lookup_path() 107 while (path) { in lookup_path() 108 scnprintf(buf, sizeof(buf), "%s/%s", path, name); in lookup_path() 113 path = strtok_r(NULL, ":", &tmp); in lookup_path() 133 const char *name, const char **path) in perf_env__lookup_binutils_path() argument 197 *path = buf; in perf_env__lookup_binutils_path() 201 *path = NULL; in perf_env__lookup_binutils_path() 205 int perf_env__lookup_objdump(struct perf_env *env, const char **path) in perf_env__lookup_objdump() argument 214 return perf_env__lookup_binutils_path(env, "objdump", path); in perf_env__lookup_objdump()
|
/tools/testing/selftests/powerpc/ |
D | utils.c | 144 char path[PATH_MAX] = "/sys/"; in read_sysfs_file() local 147 strncat(path, fpath, PATH_MAX - strlen(path) - 1); in read_sysfs_file() 149 if ((fd = open(path, O_RDONLY)) < 0) in read_sysfs_file() 165 char path[PATH_MAX]; in read_debugfs_file() local 168 strcpy(path, "/sys/kernel/debug/"); in read_debugfs_file() 169 strncat(path, debugfs_file, PATH_MAX - strlen(path) - 1); in read_debugfs_file() 171 if ((fd = open(path, O_RDONLY)) < 0) in read_debugfs_file() 187 char path[PATH_MAX]; in write_debugfs_file() local 190 strcpy(path, "/sys/kernel/debug/"); in write_debugfs_file() 191 strncat(path, debugfs_file, PATH_MAX - strlen(path) - 1); in write_debugfs_file() [all …]
|
/tools/perf/ |
D | builtin-help.c | 123 static void exec_woman_emacs(const char *path, const char *page) in exec_woman_emacs() argument 129 if (!path) in exec_woman_emacs() 130 path = "emacsclient"; in exec_woman_emacs() 132 execlp(path, "emacsclient", "-e", man_page, NULL); in exec_woman_emacs() 135 exec_failed(path); in exec_woman_emacs() 139 static void exec_man_konqueror(const char *path, const char *page) in exec_man_konqueror() argument 148 if (path) { in exec_man_konqueror() 149 const char *file = strrchr(path, '/'); in exec_man_konqueror() 151 char *new = strdup(path); in exec_man_konqueror() 156 path = new; in exec_man_konqueror() [all …]
|