/system/vold/ |
D | Process.cpp | 42 int Process::readSymLink(const char *path, char *link, size_t max) { in readSymLink() argument 46 if (lstat(path, &s) < 0) in readSymLink() 52 length = readlink(path, link, max- 1); in readSymLink() 59 int Process::pathMatchesMountPoint(const char* path, const char* mountPoint) { in pathMatchesMountPoint() argument 61 if (length > 1 && strncmp(path, mountPoint, length) == 0) { in pathMatchesMountPoint() 67 return (path[length] == 0 || path[length] == '/'); in pathMatchesMountPoint() 87 char path[PATH_MAX]; in checkFileDescriptorSymLinks() local 88 snprintf(path, sizeof(path), "/proc/%d/fd", pid); in checkFileDescriptorSymLinks() 89 DIR *dir = opendir(path); in checkFileDescriptorSymLinks() 94 int parent_length = strlen(path); in checkFileDescriptorSymLinks() [all …]
|
D | FileDeviceUtils.cpp | 43 std::string BlockDeviceForPath(const std::string &path) in BlockDeviceForPath() argument 56 path.size() > l && in BlockDeviceForPath() 57 path[l] == '/' && in BlockDeviceForPath() 58 path.compare(0, l, mnt->mnt_dir) == 0) { in BlockDeviceForPath() 64 LOG(ERROR) <<"Didn't find a mountpoint to match path " << path; in BlockDeviceForPath() 67 LOG(DEBUG) << "For path " << path << " block device is " << result; in BlockDeviceForPath() 71 std::unique_ptr<struct fiemap> PathFiemap(const std::string &path, uint32_t extent_count) in PathFiemap() argument 74 path.c_str(), O_RDONLY | O_CLOEXEC, 0))); in PathFiemap() 77 PLOG(DEBUG) << "Unable to open " << path; in PathFiemap() 79 PLOG(ERROR) << "Unable to open " << path; in PathFiemap() [all …]
|
D | Process.h | 24 static int killProcessesWithOpenFiles(const char *path, int signal); 26 static int checkSymLink(int pid, const char *path, const char *name); 27 static int checkFileMaps(int pid, const char *path); 28 static int checkFileMaps(int pid, const char *path, char *openFilename, size_t max); 33 static int readSymLink(const char *path, char *link, size_t max); 34 static int pathMatchesMountPoint(const char *path, const char *mountPoint); 39 void vold_killProcessesWithOpenFiles(const char *path, int signal);
|
/system/core/libprocessgroup/ |
D | processgroup.cpp | 104 static int convertUidToPath(char *path, size_t size, uid_t uid) in convertUidToPath() argument 106 return snprintf(path, size, "%s/%s%d", in convertUidToPath() 112 static int convertUidPidToPath(char *path, size_t size, uid_t uid, int pid) in convertUidPidToPath() argument 114 return snprintf(path, size, "%s/%s%d/%s%d", in convertUidPidToPath() 123 char path[PROCESSGROUP_MAX_PATH_LEN] = {0}; in Open() local 124 convertUidPidToPath(path, sizeof(path), uid, pid); in Open() 125 strlcat(path, PROCESSGROUP_CGROUP_PROCS_FILE, sizeof(path)); in Open() 127 int fd = open(path, O_RDONLY); in Open() 132 LOG(VERBOSE) << "Initialized context for " << path; in Open() 188 char path[PROCESSGROUP_MAX_PATH_LEN] = {0}; in removeProcessGroup() local [all …]
|
/system/core/healthd/ |
D | BatteryMonitor.cpp | 135 int BatteryMonitor::readFromFile(const String8& path, std::string* buf) { in readFromFile() argument 136 if (android::base::ReadFileToString(path.c_str(), buf)) { in readFromFile() 142 BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String8& path) { in readPowerSupplyType() argument 162 if (readFromFile(path, &buf) <= 0) in readPowerSupplyType() 174 bool BatteryMonitor::getBooleanField(const String8& path) { in getBooleanField() argument 178 if (readFromFile(path, &buf) > 0) in getBooleanField() 185 int BatteryMonitor::getIntField(const String8& path) { in getIntField() argument 189 if (readFromFile(path, &buf) > 0) in getIntField() 250 String8 path; in update() local 251 path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, in update() [all …]
|
/system/core/base/ |
D | file.cpp | 70 bool ReadFileToString(const std::string& path, std::string* content, bool follow_symlinks) { in ReadFileToString() argument 74 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags))); in ReadFileToString() 95 static bool CleanUpAfterFailedWrite(const std::string& path) { in CleanUpAfterFailedWrite() argument 98 unlink(path.c_str()); in CleanUpAfterFailedWrite() 104 bool WriteStringToFile(const std::string& content, const std::string& path, in WriteStringToFile() argument 109 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode))); in WriteStringToFile() 119 return CleanUpAfterFailedWrite(path); in WriteStringToFile() 123 return CleanUpAfterFailedWrite(path); in WriteStringToFile() 127 return CleanUpAfterFailedWrite(path); in WriteStringToFile() 133 bool WriteStringToFile(const std::string& content, const std::string& path, in WriteStringToFile() argument [all …]
|
D | file_test.cpp | 40 ASSERT_TRUE(android::base::WriteStringToFile("abc", tf.path)) in TEST() 43 ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s)) in TEST() 52 ASSERT_EQ(0, unlink(link.path)); in TEST() 53 ASSERT_EQ(0, symlink(target.path, link.path)); in TEST() 54 ASSERT_FALSE(android::base::WriteStringToFile("foo", link.path, false)); in TEST() 56 ASSERT_TRUE(android::base::WriteStringToFile("foo", link.path, true)); in TEST() 59 ASSERT_FALSE(android::base::ReadFileToString(link.path, &s)); in TEST() 61 ASSERT_TRUE(android::base::ReadFileToString(link.path, &s, true)); in TEST() 72 ASSERT_TRUE(android::base::WriteStringToFile("abc", tf.path, 0660, in TEST() 76 ASSERT_EQ(0, stat(tf.path, &sb)); in TEST() [all …]
|
/system/tools/aidl/ |
D | import_resolver.cpp | 36 for (string path : import_paths) { in ImportResolver() local 37 if (path.empty()) { in ImportResolver() 38 path = "."; in ImportResolver() 40 if (path[path.size() - 1] != OS_PATH_SEPARATOR) { in ImportResolver() 41 path += OS_PATH_SEPARATOR; in ImportResolver() 43 import_paths_.push_back(std::move(path)); in ImportResolver() 59 for (string path : import_paths_) { in FindImportFile() local 60 path = path + relative_path; in FindImportFile() 61 if (io_delegate_.FileIsReadable(path)) { in FindImportFile() 62 return path; in FindImportFile()
|
D | io_delegate.cpp | 44 bool IoDelegate::GetAbsolutePath(const string& path, string* absolute_path) { in GetAbsolutePath() argument 48 DWORD path_len = GetFullPathName(path.c_str(), sizeof(buf), buf, nullptr); in GetAbsolutePath() 50 LOG(ERROR) << "Failed to GetFullPathName(" << path << ")"; in GetAbsolutePath() 59 if (path.empty()) { in GetAbsolutePath() 64 if (path[0] == OS_PATH_SEPARATOR) { in GetAbsolutePath() 65 *absolute_path = path; in GetAbsolutePath() 78 *absolute_path += path; in GetAbsolutePath() 110 bool IoDelegate::FileIsReadable(const string& path) const { in FileIsReadable() 113 return (0 == _access(path.c_str(), 0)) && // mode 0=exist in FileIsReadable() 114 (0 == _access(path.c_str(), 4)); // mode 4=readable in FileIsReadable() [all …]
|
/system/core/init/ |
D | devices.cpp | 53 static bool FindPciDevicePrefix(const std::string& path, std::string* result) { in FindPciDevicePrefix() argument 56 if (!StartsWith(path, "/devices/pci")) return false; in FindPciDevicePrefix() 63 auto end = path.find('/', start); in FindPciDevicePrefix() 66 end = path.find('/', end + 1); in FindPciDevicePrefix() 76 *result = path.substr(start, length); in FindPciDevicePrefix() 84 static bool FindVbdDevicePrefix(const std::string& path, std::string* result) { in FindVbdDevicePrefix() argument 87 if (!StartsWith(path, "/devices/vbd-")) return false; in FindVbdDevicePrefix() 94 auto end = path.find('/', start); in FindVbdDevicePrefix() 100 *result = path.substr(start, length); in FindVbdDevicePrefix() 128 bool Permissions::Match(const std::string& path) const { in Match() [all …]
|
D | util_test.cpp | 47 EXPECT_TRUE(WriteFile(tf.path, s, &err)) << strerror(errno); in TEST() 49 EXPECT_NE(-1, fchmodat(AT_FDCWD, tf.path, 0620, AT_SYMLINK_NOFOLLOW)) << strerror(errno); in TEST() 50 EXPECT_FALSE(ReadFile(tf.path, &s, &err)) << strerror(errno); in TEST() 51 EXPECT_EQ("Skipping insecure file '"s + tf.path + "'", err); in TEST() 60 EXPECT_TRUE(WriteFile(tf.path, s, &err)) << strerror(errno); in TEST() 62 EXPECT_NE(-1, fchmodat(AT_FDCWD, tf.path, 0602, AT_SYMLINK_NOFOLLOW)) << strerror(errno); in TEST() 63 EXPECT_FALSE(ReadFile(tf.path, &s, &err)) << strerror(errno); in TEST() 64 EXPECT_EQ("Skipping insecure file '"s + tf.path + "'", err); in TEST() 100 EXPECT_TRUE(WriteFile(tf.path, contents, &err)) << strerror(errno); in TEST() 104 EXPECT_TRUE(ReadFile(tf.path, &read_back_contents, &err)) << strerror(errno); in TEST() [all …]
|
/system/core/libcutils/ |
D | fs.c | 41 static int fs_prepare_path_impl(const char* path, mode_t mode, uid_t uid, gid_t gid, in fs_prepare_path_impl() argument 46 if (TEMP_FAILURE_RETRY(lstat(path, &sb)) == -1) { in fs_prepare_path_impl() 50 ALOGE("Failed to lstat(%s): %s", path, strerror(errno)); in fs_prepare_path_impl() 58 ALOGE("Not a %s: %s", (prepare_as_dir ? "directory" : "regular file"), path); in fs_prepare_path_impl() 71 path, uid, gid, sb.st_uid, sb.st_gid); in fs_prepare_path_impl() 75 path, mode, (sb.st_mode & ALL_PERMS)); in fs_prepare_path_impl() 82 ? TEMP_FAILURE_RETRY(mkdir(path, mode)) in fs_prepare_path_impl() 83 : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY, 0644)); in fs_prepare_path_impl() 87 (prepare_as_dir ? "mkdir" : "open"), path, strerror(errno)); in fs_prepare_path_impl() 93 ALOGW("Failed to close file after create %s: %s", path, strerror(errno)); in fs_prepare_path_impl() [all …]
|
D | canned_fs_config.c | 30 const char* path; member 42 return strcmp(((Path*)a)->path, ((Path*)b)->path); in path_compare() 68 p->path = strdup(rootdir ? "" : strtok(line, " ")); in load_canned_fs_config() 95 void canned_fs_config(const char* path, int dir, const char* target_out_path, in canned_fs_config() argument 99 key.path = path; in canned_fs_config() 100 if (path[0] == '/') key.path++; // canned paths lack the leading '/' in canned_fs_config() 103 fprintf(stderr, "failed to find [%s] in canned fs_config\n", path); in canned_fs_config() 117 fs_config(path, dir, target_out_path, &c_uid, &c_gid, &c_mode, &c_capabilities); in canned_fs_config() 119 if (c_uid != *uid) printf("%s uid %d %d\n", path, *uid, c_uid); in canned_fs_config() 120 if (c_gid != *gid) printf("%s gid %d %d\n", path, *gid, c_gid); in canned_fs_config() [all …]
|
/system/extras/simpleperf/ |
D | cmd_report_sample_test.cpp | 37 {"-i", GetTestData(PERF_DATA_WITH_SYMBOLS), "-o", tmpfile.path})); in TEST() 43 "-o", tmpfile.path, "--show-callchain"})); in TEST() 50 "-o", tmpfile.path, "--protobuf"})); in TEST() 52 {"--dump-protobuf-report", tmpfile.path, "-o", tmpfile2.path})); in TEST() 54 ASSERT_TRUE(android::base::ReadFileToString(tmpfile2.path, &data)); in TEST() 62 "-o", tmpfile.path, "--protobuf"})); in TEST() 63 ASSERT_TRUE(ReportSampleCmd()->Run({"--dump-protobuf-report", tmpfile.path, "-o", in TEST() 64 tmpfile2.path})); in TEST() 67 ASSERT_TRUE(android::base::ReadFileToString(tmpfile2.path, &data)); in TEST() 75 "-o", tmpfile.path, "--protobuf"})); in TEST() [all …]
|
/system/tools/hidl/ |
D | Hash.cpp | 30 const Hash &Hash::getHash(const std::string &path) { in getHash() argument 33 auto it = hashes.find(path); in getHash() 35 if (hashes.find(path) == hashes.end()) { in getHash() 36 it = hashes.insert(it, {path, Hash(path)}); in getHash() 42 static std::vector<uint8_t> sha256File(const std::string &path) { in sha256File() argument 43 std::ifstream stream(path); in sha256File() 56 Hash::Hash(const std::string &path) in Hash() argument 57 : mPath(path), in Hash() 58 mHash(sha256File(path)) {} in Hash() 93 static const HashFile *parse(const std::string &path, std::string *err) { in parse() [all …]
|
/system/media/audio_route/ |
D | audio_route.c | 82 struct mixer_path *path; member 127 static void path_print(struct audio_route *ar, struct mixer_path *path) 132 ALOGE("Path: %s, length: %d", path->name, path->length); 133 for (i = 0; i < path->length; i++) { 134 struct mixer_ctl *ctl = index_to_ctl(ar, path->setting[i].ctl_index); 138 for (j = 0; j < path->setting[i].num_values; j++) 139 ALOGE(" id=%d value=0x%02x", j, path->setting[i].value.bytes[j]); 141 for (j = 0; j < path->setting[i].num_values; j++) 142 ALOGE(" id=%d value=%d", j, path->setting[i].value.enumerated[j]); 144 for (j = 0; j < path->setting[i].num_values; j++) [all …]
|
/system/tpm/tpm_manager/server/ |
D | local_data_store_impl.cc | 40 FilePath path(kTpmLocalDataFile); in Read() local 41 if (!base::PathExists(path)) { in Read() 46 if (base::GetPosixFilePermissions(path, &permissions) && in Read() 48 base::SetPosixFilePermissions(path, kLocalDataPermissions); in Read() 51 if (!ReadFileToString(path, &file_data)) { in Read() 68 FilePath path(kTpmLocalDataFile); in Write() local 69 if (!base::CreateDirectory(path.DirName())) { in Write() 70 LOG(ERROR) << "Cannot create directory: " << path.DirName().value(); in Write() 73 if (!base::ImportantFileWriter::WriteFileAtomically(path, file_data)) { in Write() 74 LOG(ERROR) << "Failed to write file: " << path.value(); in Write() [all …]
|
/system/update_engine/payload_consumer/ |
D | file_writer_unittest.cc | 41 string path; in TEST() local 42 ASSERT_TRUE(utils::MakeTempFile("FileWriterTest-XXXXXX", &path, nullptr)); in TEST() 43 ScopedPathUnlinker path_unlinker(path); in TEST() 46 EXPECT_EQ(0, file_writer.Open(path.c_str(), in TEST() 51 EXPECT_TRUE(utils::ReadFile(path, &actual_data)); in TEST() 59 const string path("/tmp/ENOENT/FileWriterTest"); in TEST() local 60 EXPECT_EQ(-ENOENT, file_writer.Open(path.c_str(), in TEST() 66 string path; in TEST() local 67 ASSERT_TRUE(utils::MakeTempFile("FileWriterTest-XXXXXX", &path, nullptr)); in TEST() 68 ScopedPathUnlinker path_unlinker(path); in TEST() [all …]
|
D | mtd_file_descriptor.cc | 49 std::unique_ptr<UbiVolumeInfo> GetUbiVolumeInfo(const string& path) { in GetUbiVolumeInfo() argument 50 base::FilePath device_node(path); in GetUbiVolumeInfo() 99 bool MtdFileDescriptor::IsMtd(const char* path) { in IsMtd() argument 101 return mtd_node_info(path, &size, nullptr, nullptr) == 0; in IsMtd() 104 bool MtdFileDescriptor::Open(const char* path, int flags, mode_t mode) { in Open() argument 115 EintrSafeFileDescriptor::Open(path, flags | O_CLOEXEC, mode)); in Open() 118 write_ctx_.reset(mtd_write_descriptor(fd_, path)); in Open() 121 read_ctx_.reset(mtd_read_descriptor(fd_, path)); in Open() 132 bool MtdFileDescriptor::Open(const char* path, int flags) { in Open() argument 135 return Open(path, flags, 0777 & ~cur); in Open() [all …]
|
/system/extras/simpleperf/scripts/ |
D | utils.py | 24 import os.path 29 return os.path.dirname(os.path.realpath(__file__)) 75 arch_dir = os.path.join(get_script_dir(), "bin", "android", arch) 76 if not os.path.isdir(arch_dir): 78 binary_path = os.path.join(arch_dir, binary_name) 79 if not os.path.isfile(binary_path): 85 dir = os.path.join(get_script_dir(), 'bin') 91 dir = os.path.join(dir, 'windows') 95 dir = os.path.join(dir, 'darwin') 97 dir = os.path.join(dir, 'linux') [all …]
|
/system/core/adb/ |
D | adb_auth_host.cpp | 99 std::string path(private_key_path + ".pub"); in write_public_keyfile() local 100 if (!android::base::WriteStringToFile(content, path)) { in write_public_keyfile() 101 PLOG(ERROR) << "Failed to write public key to '" << path << "'"; in write_public_keyfile() 201 static bool read_keys(const std::string& path, bool allow_dir = true) { in read_keys() argument 202 LOG(INFO) << "read_keys '" << path << "'..."; in read_keys() 205 if (stat(path.c_str(), &st) != 0) { in read_keys() 206 PLOG(ERROR) << "failed to stat '" << path << "'"; in read_keys() 211 return read_key_file(path); in read_keys() 216 LOG(WARNING) << "refusing to recurse into directory '" << path << "'"; in read_keys() 220 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir); in read_keys() [all …]
|
D | file_sync_service.cpp | 50 static bool should_use_fs_config(const std::string& path) { in should_use_fs_config() argument 52 return android::base::StartsWith(path, "/system/") || in should_use_fs_config() 53 android::base::StartsWith(path, "/vendor/") || in should_use_fs_config() 54 android::base::StartsWith(path, "/oem/"); in should_use_fs_config() 57 static bool update_capabilities(const char* path, uint64_t capabilities) { in update_capabilities() argument 60 removexattr(path, XATTR_NAME_CAPS); in update_capabilities() 70 return setxattr(path, XATTR_NAME_CAPS, &cap_data, sizeof(cap_data), 0) != -1; in update_capabilities() 73 static bool secure_mkdirs(const std::string& path) { in secure_mkdirs() argument 79 if (path[0] != '/') return false; in secure_mkdirs() 81 std::vector<std::string> path_components = android::base::Split(path, "/"); in secure_mkdirs() [all …]
|
/system/tools/hidl/c2hal/test/ |
D | build_all.py | 20 from os.path import isfile, join as path_join 29 path = args.path 32 success, failure = genFiles(path, is_open_gl) 48 def genFiles(path, is_open_gl): argument 52 for header in sorted(headers(path)): 62 command += [path_join(path, header)] 73 def headers(path): argument 75 for item in listdir(path): 76 if not isfile(path_join(path, item)):
|
/system/update_engine/payload_generator/ |
D | mapfile_filesystem_unittest.cc | 64 temp_file_.path(), temp_mapfile_.path()); in TEST_F() 79 test_utils::WriteFileString(temp_mapfile_.path(), text); in TEST_F() 80 EXPECT_EQ(0, HANDLE_EINTR(truncate(temp_file_.path().c_str(), 4096 * 20))); in TEST_F() 83 temp_file_.path(), temp_mapfile_.path()); in TEST_F() 111 test_utils::WriteFileString(temp_mapfile_.path(), "/some/file 1-4\n"); in TEST_F() 112 EXPECT_EQ(0, HANDLE_EINTR(truncate(temp_file_.path().c_str(), 4096 * 3))); in TEST_F() 115 temp_file_.path(), temp_mapfile_.path()); in TEST_F() 123 test_utils::WriteFileString(temp_mapfile_.path(), "/some/file 2-1\n"); in TEST_F() 124 EXPECT_EQ(0, HANDLE_EINTR(truncate(temp_file_.path().c_str(), 4096 * 3))); in TEST_F() 127 temp_file_.path(), temp_mapfile_.path()); in TEST_F()
|
/system/update_engine/ |
D | p2p_manager.cc | 167 bool DeleteP2PFile(const FilePath& path, const string& reason); 321 bool P2PManagerImpl::DeleteP2PFile(const FilePath& path, in DeleteP2PFile() argument 323 LOG(INFO) << "Deleting p2p file " << path.value() in DeleteP2PFile() 325 if (unlink(path.value().c_str()) != 0) { in DeleteP2PFile() 326 PLOG(ERROR) << "Error deleting p2p file " << path.value(); in DeleteP2PFile() 507 FilePath path = FileGetPath(file_id); in FileShare() local 508 if (!path.empty()) { in FileShare() 513 LOG(ERROR) << "Existing p2p file " << path.value() in FileShare() 543 path = GetPath(file_id, kNonVisible); in FileShare() 544 int fd = open(path.value().c_str(), O_CREAT | O_RDWR, 0644); in FileShare() [all …]
|