/bionic/libc/bionic/ |
D | libgen.cpp | 39 static int __basename_r(const char* path, char* buffer, size_t buffer_size) { in __basename_r() argument 46 if (path == nullptr || *path == '\0') { in __basename_r() 53 endp = path + strlen(path) - 1; in __basename_r() 54 while (endp > path && *endp == '/') { in __basename_r() 59 if (endp == path && *endp == '/') { in __basename_r() 67 while (startp > path && *(startp - 1) != '/') { in __basename_r() 92 __LIBC32_LEGACY_PUBLIC__ int basename_r(const char* path, char* buffer, size_t buffer_size) { in basename_r() argument 93 return __basename_r(path, buffer, buffer_size); in basename_r() 96 static int __dirname_r(const char* path, char* buffer, size_t buffer_size) { in __dirname_r() argument 102 if (path == nullptr || *path == '\0') { in __dirname_r() [all …]
|
D | tmpfile.cpp | 58 char* path = nullptr; in __tmpfile_dir_legacy() local 59 if (asprintf(&path, "%s/tmp.XXXXXXXXXX", tmp_dir) == -1) { in __tmpfile_dir_legacy() 63 int fd = mkstemp(path); in __tmpfile_dir_legacy() 65 free(path); in __tmpfile_dir_legacy() 70 unlink(path); in __tmpfile_dir_legacy() 71 free(path); in __tmpfile_dir_legacy() 117 char* path = nullptr; in tempnam() local 118 if (asprintf(&path, "%s/%sXXXXXXXXXX", dir, prefix) == -1) return nullptr; in tempnam() 119 if (mktemp(path) == nullptr) { in tempnam() 120 free(path); in tempnam() [all …]
|
D | lfs64_support.cpp | 23 int mkstemp64(char* path) { in mkstemp64() argument 24 return mkstemp(path); in mkstemp64() 26 int mkostemp64(char* path, int flags) { in mkostemp64() argument 27 return mkostemp(path, flags); in mkostemp64() 29 int mkstemps64(char* path, int suffix_length) { in mkstemps64() argument 30 return mkstemps(path, suffix_length); in mkstemps64() 32 int mkostemps64(char* path, int suffix_length, int flags) { in mkostemps64() argument 33 return mkostemps(path, suffix_length, flags); in mkostemps64()
|
D | sys_time.cpp | 37 static int futimesat(int fd, const char* path, const timeval tv[2], int flags) { in futimesat() argument 43 return utimensat(fd, path, tv ? ts : nullptr, flags); in futimesat() 46 int utimes(const char* path, const timeval tv[2]) { in utimes() argument 47 return futimesat(AT_FDCWD, path, tv, 0); in utimes() 50 int lutimes(const char* path, const timeval tv[2]) { in lutimes() argument 51 return futimesat(AT_FDCWD, path, tv, AT_SYMLINK_NOFOLLOW); in lutimes() 54 int futimesat(int fd, const char* path, const timeval tv[2]) { in futimesat() argument 55 return futimesat(fd, path, tv, 0); in futimesat()
|
D | sysconf.cpp | 93 static long __sysconf_fread_long(const char* path) { in __sysconf_fread_long() argument 95 FILE* fp = fopen(path, "re"); in __sysconf_fread_long() 106 char path[64]; in __sysconf_caches() local 110 snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu0/cache/index%d/size", i); in __sysconf_caches() 111 c.size = __sysconf_fread_long(path) * 1024; in __sysconf_caches() 114 …snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu0/cache/index%d/ways_of_associativity", i… in __sysconf_caches() 115 c.assoc = __sysconf_fread_long(path); in __sysconf_caches() 117 … snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu0/cache/index%d/coherency_line_size", i); in __sysconf_caches() 118 c.linesize = __sysconf_fread_long(path); in __sysconf_caches() 120 snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu0/cache/index%d/level", i); in __sysconf_caches() [all …]
|
D | mkfifo.cpp | 33 int mkfifo(const char* path, mode_t mode) { in mkfifo() argument 34 return mkfifoat(AT_FDCWD, path, mode); in mkfifo() 37 int mkfifoat(int fd, const char* path, mode_t mode) { in mkfifoat() argument 38 return mknodat(fd, path, (mode & ~S_IFMT) | S_IFIFO, 0); in mkfifoat()
|
D | spawn.cpp | 81 char* path; member 87 fd = open(path, flags, mode); in Do() 98 if (chdir(path) == -1) _exit(127); in Do() 183 const char* path, in posix_spawn() argument 188 int exec_fn(const char* path, char* const argv[], char* const env[])) { in posix_spawn() argument 205 exec_fn(path, argv, env ? env : environ); in posix_spawn() 214 int posix_spawn(pid_t* pid, const char* path, const posix_spawn_file_actions_t* actions, in posix_spawn() argument 216 return posix_spawn(pid, path, actions, attr, argv, env, execve); in posix_spawn() 330 free(last->path); in posix_spawn_file_actions_destroy() 342 const char* path, in posix_spawn_add_file_action() argument [all …]
|
/bionic/tests/ |
D | ftw_test.cpp | 34 char path[PATH_MAX]; in MakeTree() local 36 snprintf(path, sizeof(path), "%s/dir", root); in MakeTree() 37 ASSERT_EQ(0, mkdir(path, 0755)) << path; in MakeTree() 38 snprintf(path, sizeof(path), "%s/dir/sub", root); in MakeTree() 39 ASSERT_EQ(0, mkdir(path, 0555)) << path; in MakeTree() 40 snprintf(path, sizeof(path), "%s/unreadable-dir", root); in MakeTree() 41 ASSERT_EQ(0, mkdir(path, 0000)) << path; in MakeTree() 43 snprintf(path, sizeof(path), "%s/dangler", root); in MakeTree() 44 ASSERT_EQ(0, symlink("/does-not-exist", path)); in MakeTree() 45 snprintf(path, sizeof(path), "%s/symlink", root); in MakeTree() [all …]
|
D | memtag_stack_dlopen_test.cpp | 47 std::string path = in TEST() local 51 eth.SetArgs({path.c_str(), nullptr}); in TEST() 53 eth.Run([&]() { execve(path.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "RAN"); in TEST() 65 std::string path = android::base::GetExecutableDirectory() + in TEST() local 69 eth.SetArgs({path.c_str(), nullptr}); in TEST() 71 eth.Run([&]() { execve(path.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "RAN"); in TEST() 84 std::string path = in TEST() local 90 eth.SetArgs({path.c_str(), lib_path.c_str(), nullptr}); in TEST() 92 eth.Run([&]() { execve(path.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "RAN"); in TEST() 105 std::string path = in TEST() local [all …]
|
D | sys_time_test.cpp | 31 ASSERT_EQ(0, utimes(tf.path, nullptr)); in TEST() 40 ASSERT_EQ(-1, utimes(tf.path, tv)); in TEST() 43 ASSERT_EQ(-1, utimes(tf.path, tv)); in TEST() 49 ASSERT_EQ(-1, utimes(tf.path, tv)); in TEST() 52 ASSERT_EQ(-1, utimes(tf.path, tv)); in TEST() 85 ASSERT_EQ(0, futimesat(AT_FDCWD, tf.path, nullptr)); in TEST() 94 ASSERT_EQ(-1, futimesat(AT_FDCWD, tf.path, tv)); in TEST() 97 ASSERT_EQ(-1, futimesat(AT_FDCWD, tf.path, tv)); in TEST() 103 ASSERT_EQ(-1, futimesat(AT_FDCWD, tf.path, tv)); in TEST() 106 ASSERT_EQ(-1, futimesat(AT_FDCWD, tf.path, tv)); in TEST() [all …]
|
D | sys_stat_test.cpp | 82 std::string path; in TEST() local 85 path = tf.path; in TEST() 88 ASSERT_EQ(0, mkfifo(path.c_str(), 0666)); in TEST() 90 ASSERT_EQ(0, stat(path.c_str(), &sb)); in TEST() 92 unlink(path.c_str()); in TEST() 180 ASSERT_EQ(0, fchmodat(AT_FDCWD, tf.path, 0751, 0)); in TEST() 181 AssertFileModeEquals(0751, tf.path); in TEST() 187 int result = fchmodat(AT_FDCWD, tf.path, 0751, AT_SYMLINK_NOFOLLOW); in TEST() 192 AssertFileModeEquals(0751, tf.path); in TEST() 205 snprintf(linkname, sizeof(linkname), "%s.link", tf.path); in TEST() [all …]
|
/bionic/libc/upstream-openbsd/lib/libc/stdio/ |
D | mktemp.c | 45 mktemp_internal(char *path, int slen, int mode, int flags) in mktemp_internal() argument 54 len = strlen(path); in mktemp_internal() 59 ep = path + len - slen; in mktemp_internal() 61 for (start = ep; start > path && start[-1] == 'X'; start--) in mktemp_internal() 92 if (lstat(path, &sb) != 0) in mktemp_internal() 96 fd = open(path, flags, S_IRUSR|S_IWUSR); in mktemp_internal() 101 if (mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR) == 0) in mktemp_internal() 114 _mktemp(char *path) in _mktemp() argument 116 if (mktemp_internal(path, 0, MKTEMP_NAME, 0) == -1) in _mktemp() 118 return(path); in _mktemp() [all …]
|
/bionic/libc/kernel/tools/ |
D | kernel.py | 7 import sys, cpp, re, os.path, time 89 hdr_dir = os.path.realpath(os.path.dirname(from_file)) 90 hdr_dir = hdr_dir.replace("%s/" % os.path.realpath(kernel_root), 106 def parseFile(self, path, arch=None, kernel_root=None): argument 108 if not os.path.exists(path): 115 f = open(path, "rt") 117 print("!!! can't read '%s'" % path) 128 if verboseSearch: print("::: " + path) 131 if verboseSearch: print("*** " + path) 133 list = cpp.BlockParser().parseFile(path) [all …]
|
D | update_all.py | 24 """ % { "progname" : os.path.basename(sys.argv[0]) }) 29 update_dir = os.path.join(get_kernel_dir(), update_rel_dir) 35 os.remove(os.path.join(root, entry)) 37 shutil.rmtree(os.path.join(root, entry)) 39 src_dir = os.path.normpath(os.path.join(original_dir, src_rel_dir)) 41 mod_src_dir = os.path.join(modified_dir, src_rel_dir) 42 update_dir = os.path.join(get_kernel_dir(), update_rel_dir) 47 _, ext = os.path.splitext(file) 50 src_file = os.path.normpath(os.path.join(root, file)) 53 if os.path.exists(os.path.join(mod_src_dir, rel_path)): [all …]
|
D | utils.py | 10 sys.stderr.write(os.path.basename(sys.argv[0]) + ": error: ") 16 return os.path.join(get_android_root(), "external/kernel-headers") 20 return os.path.join(get_kernel_headers_dir(), "original") 24 return os.path.join(get_kernel_headers_dir(), "modified") 28 return os.path.join(get_android_root(), "bionic/libc/kernel") 55 def create_file_path(path): argument 58 parent = os.path.dirname(path) 63 path = parent 68 if os.path.isdir(dir): 80 def readFile(self,path): argument [all …]
|
D | clean_header.py | 87 if not os.path.exists(src_file): 91 if not os.path.isfile(src_file): 149 """ % os.path.basename(sys.argv[0])) 185 for path in args: 186 dst_file = os.path.join(dst_dir, path) 187 src_file = os.path.join(src_dir, path) 188 new_data = cleanupFile(dst_file, src_file, path) 202 for path in args: 203 dst_file = os.path.join(dst_dir, path) 204 src_file = os.path.join(src_dir, path) [all …]
|
/bionic/linker/ |
D | linker_utils.cpp | 63 std::string dirname(const char* path) { in dirname() argument 64 const char* last_slash = strrchr(path, '/'); in dirname() 66 if (last_slash == path) { in dirname() 71 return std::string(path, last_slash - path); in dirname() 75 bool normalize_path(const char* path, std::string* normalized_path) { in normalize_path() argument 77 if (path[0] != '/') { in normalize_path() 78 PRINT("normalize_path - invalid input: \"%s\", the input path should be absolute", path); in normalize_path() 82 const size_t len = strlen(path) + 1; in normalize_path() 85 const char* in_ptr = path; in normalize_path() 146 const char* const path = normalized_path.c_str(); in parse_zip_path() local [all …]
|
D | linker_crt_pad_segment_test.cpp | 56 std::string path = GetTestElfPath(elf_path); in GetPadSegment() local 58 unique_fd fd{TEMP_FAILURE_RETRY(open(path.c_str(), O_CLOEXEC | O_RDWR))}; in GetPadSegment() 59 EXPECT_GE(fd.get(), 0) << "Failed to open " << path << ": " << strerror(errno); in GetPadSegment() 63 << "Failed to stat " << path << ": " << strerror(errno); in GetPadSegment() 66 EXPECT_TRUE(elf_reader.Read(path.c_str(), fd.get(), 0, file_stat.st_size)) in GetPadSegment()
|
D | linker_config_test.cpp | 110 static bool write_version(const std::string& path, uint32_t version) { in write_version() argument 112 return android::base::WriteStringToFile(content, path); in write_version() 170 android::base::WriteStringToFile(config_str, tmp_file.path); in run_linker_config_smoke_test() 174 std::string executable_path = std::string(tmp_dir.path) + "/some-binary"; in run_linker_config_smoke_test() 175 std::string version_file = std::string(tmp_dir.path) + "/.version"; in run_linker_config_smoke_test() 185 ASSERT_TRUE(Config::read_binary_config(tmp_file.path, in run_linker_config_smoke_test() 291 android::base::WriteStringToFile(config_str, tmp_file.path); in TEST() 295 std::string executable_path = std::string(tmp_dir.path) + "/some-binary"; in TEST() 299 ASSERT_FALSE(Config::read_binary_config(tmp_file.path, in TEST() 306 ASSERT_EQ(std::string(tmp_file.path) + ":6: " in TEST() [all …]
|
/bionic/libc/tzcode/ |
D | bionic.cpp | 100 char* path; in make_path() local 101 if (asprintf(&path, "%s/%s", path_prefix, path_suffix) == -1) { in make_path() 105 return path; in make_path() 131 static int __bionic_open_tzdata_path(const char* path, in __bionic_open_tzdata_path() argument 134 int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC)); in __bionic_open_tzdata_path() 145 __FUNCTION__, path, (bytes_read == -1) ? strerror(errno) : "short read"); in __bionic_open_tzdata_path() 151 … fprintf(stderr, "%s: bad magic in \"%s\": \"%.6s\"\n", __FUNCTION__, path, header.tzdata_version); in __bionic_open_tzdata_path() 157 …fprintf(stderr, "%s: couldn't seek to index in \"%s\": %s\n", __FUNCTION__, path, strerror(errno)); in __bionic_open_tzdata_path() 164 __FUNCTION__, path, ntohl(header.data_offset), ntohl(header.index_offset)); in __bionic_open_tzdata_path() 170 fprintf(stderr, "%s: invalid index size in \"%s\": %zd\n", __FUNCTION__, path, index_size); in __bionic_open_tzdata_path() [all …]
|
/bionic/libc/tools/ |
D | symbols.py | 60 lib_dir = os.path.join(out_dir, 'obj') 64 static_lib_dir = os.path.join( 67 '{}_intermediates'.format(os.path.splitext(f)[0])) 69 os.path.join(static_lib_dir, f), 76 lib_dir = os.path.join(out_dir, 'system/lib64') 77 if not os.path.isdir(lib_dir): 78 lib_dir = os.path.join(out_dir, 'system/lib') 80 lib_dir = os.path.join(out_dir, 'apex/com.android.runtime/lib64/bionic/') 81 if not os.path.isdir(lib_dir): 82 lib_dir = os.path.join(out_dir, 'apex/com.android.runtime/lib/bionic/') [all …]
|
D | generate_notice.py | 26 path = Path(path_str.lower()) 38 if path.suffix in uninteresting_extensions: 40 if path.name in {"notice", "readme", "pylintrc"}: 43 if path.match("*~"): 132 def do_file(path: str) -> None: 133 raw = Path(path).read_bytes() 137 warn("bad UTF-8 in %s" % path) 143 warn_verbose("ignoring short file %s" % path) 148 warn_verbose("ignoring public domain file %s" % path) 151 (path, len(lines))) [all …]
|
/bionic/tools/versioner/src/ |
D | Utils.h | 34 static inline std::string dirname(const std::string& path) { in dirname() argument 35 std::unique_ptr<char, decltype(&free)> path_copy(strdup(path.c_str()), free); in dirname() 39 static inline bool is_directory(const std::string& path) { in is_directory() argument 41 if (stat(path.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) { in is_directory() 47 static inline bool mkdirs(const std::string& path) { in mkdirs() argument 48 if (is_directory(path)) { in mkdirs() 52 std::string parent = dirname(path); in mkdirs() 53 if (parent == path) { in mkdirs() 61 if (mkdir(path.c_str(), 0700) != 0) { in mkdirs() 65 return is_directory(path); in mkdirs()
|
/bionic/tools/versioner/ |
D | run_tests.py | 21 def run_test(test_name, path): argument 22 os.chdir(path) 27 if os.path.exists("expected_fail"): 63 root_dir = os.path.dirname(os.path.realpath(__file__)) 64 test_dir = os.path.join(root_dir, "tests") 79 path = os.path.join(test_dir, test) variable 80 if not os.path.isdir(path): 82 if not run_test(test, path):
|
/bionic/benchmarks/linker_relocation/regen/ |
D | dump_relocs.py | 67 def get_elf_soname(path: Path) -> str: 68 if path in g_path_to_soname_cache: return g_path_to_soname_cache[path] 69 out = do_readelf_query(['-d', str(path)]) 76 result = os.path.basename(path) 77 g_path_to_soname_cache[path] = result 81 def get_elf_needed(path: Path) -> List[str]: 83 out = do_readelf_query(['-d', str(path)]) 105 def get_dyn_symbols(path: Path) -> DynSymbols: 115 out = do_readelf_query(['--dyn-syms', str(path)]) 152 def scan_relocations(path: Path, syms: DynSymbols) -> Relocations: [all …]
|