/base/hiviewdfx/hiview_lite/ |
D | hiview_file.c | 40 boolean InitHiviewFile(HiviewFile *fp, HiviewFileType type, uint32 size) in InitHiviewFile() argument 42 if (fp == NULL || fp->path == NULL) { in InitHiviewFile() 46 fp->fhandle = HIVIEW_FileOpen(fp->path); in InitHiviewFile() 47 if (fp->fhandle < 0) { in InitHiviewFile() 58 HiviewFileHeader *pHeader = &(fp->header); in InitHiviewFile() 62 fp->configSize = size; in InitHiviewFile() 64 if (ReadFileHeader(fp) == FALSE) { in InitHiviewFile() 86 if (WriteFileHeader(fp) == FALSE) { in InitHiviewFile() 100 boolean WriteFileHeader(HiviewFile *fp) in WriteFileHeader() argument 102 if (fp == NULL || fp->fhandle < 0) { in WriteFileHeader() [all …]
|
D | hiview_file.h | 105 boolean InitHiviewFile(HiviewFile *fp, HiviewFileType type, uint32 size); 113 boolean WriteFileHeader(HiviewFile *fp); 121 boolean ReadFileHeader(HiviewFile *fp); 132 int32 WriteToFile(HiviewFile *fp, const uint8 *data, uint32 len); 143 int32 ReadFromFile(HiviewFile *fp, uint8 *data, uint32 readLen); 151 uint32 GetFileUsedSize(HiviewFile *fp); 159 uint32 GetFileFreeSize(HiviewFile *fp); 167 int32 CloseHiviewFile(HiviewFile *fp); 177 int8 ProcFile(HiviewFile *fp, const char *dest, FileProcMode mode); 186 void RegisterFileWatcher(HiviewFile *fp, FileProc func, const char *path); [all …]
|
/base/startup/init/services/param/adapter/ |
D | param_persistadp.c | 41 FILE *fp = fopen(tmpPath, "r"); in LoadPersistParam() local 42 if (fp == NULL) { in LoadPersistParam() 44 fp = fopen(tmpPath, "r"); in LoadPersistParam() 47 … PARAM_CHECK(fp != NULL, return -1, "No valid persist parameter file %s", PARAM_PERSIST_SAVE_PATH); in LoadPersistParam() 52 (void)fclose(fp); in LoadPersistParam() 56 while (fgets(buffer, buffSize, fp) != NULL) { in LoadPersistParam() 62 (void)fclose(fp); in LoadPersistParam() 72 FILE *fp = fopen(path, "a+"); in SavePersistParam() local 74 if (fp != NULL) { in SavePersistParam() 75 ret = fprintf(fp, "%s=%s\n", name, value); in SavePersistParam() [all …]
|
/base/security/device_auth/deps_adapter/os_adapter/impl/src/linux/ |
D | hc_file.c | 99 FILE *fp = (FILE *)file.pfd; in HcFileSize() local 100 if (fp != NULL) { in HcFileSize() 101 if (fseek(fp, 0L, SEEK_END) != 0) { in HcFileSize() 104 int size = ftell(fp); in HcFileSize() 105 if (fseek(fp, 0L, SEEK_SET) != 0) { in HcFileSize() 116 FILE *fp = (FILE *)file.pfd; in HcFileRead() local 117 if (fp == NULL || dstSize < 0 || dst == NULL) { in HcFileRead() 124 int readCount = fread(dstBuffer + total, 1, dstSize - total, fp); in HcFileRead() 125 if (ferror(fp) != 0) { in HcFileRead() 139 FILE *fp = (FILE *)file.pfd; in HcFileWrite() local [all …]
|
/base/update/updater/interfaces/kits/misc_info/ |
D | misc_info.cpp | 31 FILE* fp = fopen(realPath, "rb+"); in WriteUpdaterMessage() local 33 if (fp == nullptr) { in WriteUpdaterMessage() 38 size_t ret = fwrite(&boot, sizeof(UpdateMessage), 1, fp); in WriteUpdaterMessage() 41 fclose(fp); in WriteUpdaterMessage() 45 int res = fclose(fp); in WriteUpdaterMessage() 60 FILE* fp = fopen(realPath, "rb"); in ReadUpdaterMessage() local 62 if (fp == nullptr) { in ReadUpdaterMessage() 68 size_t ret = fread(&tempBoot, sizeof(UpdateMessage), 1, fp); in ReadUpdaterMessage() 71 fclose(fp); in ReadUpdaterMessage() 75 int res = fclose(fp); in ReadUpdaterMessage()
|
/base/security/device_auth/deps_adapter/os_adapter/impl/src/liteos/mini/ |
D | hc_file.c | 74 int fp = file.fileHandle.fd; in HcFileRead() local 75 if (fp == HAL_FAILED || dstSize < 0 || dst == NULL) { in HcFileRead() 78 int ret = UtilsFileRead(fp, (char *)dst, dstSize); in HcFileRead() 85 int fp = file.fileHandle.fd; in HcFileWrite() local 86 if (fp == HAL_FAILED || srcSize < 0 || src == NULL) { in HcFileWrite() 89 int ret = UtilsFileWrite(fp, src, srcSize); in HcFileWrite() 96 int fp = file.fileHandle.fd; in HcFileClose() local 97 if (fp < 0) { in HcFileClose() 100 int ret = UtilsFileClose(fp); in HcFileClose()
|
D | hc_file_posix.c | 104 int fp = file.fileHandle.fd; in HcFileSize() local 105 int size = lseek(fp, 0, SEEK_END); in HcFileSize() 106 (void)lseek(fp, 0, SEEK_SET); in HcFileSize() 112 int fp = file.fileHandle.fd; in HcFileRead() local 113 if (fp == -1 || dstSize < 0 || dst == NULL) { in HcFileRead() 120 int readCount = read(fp, dstBuffer + total, dstSize - total); in HcFileRead() 137 int fp = file.fileHandle.fd; in HcFileWrite() local 138 if (fp == -1 || srcSize < 0 || src == NULL) { in HcFileWrite() 145 int writeCount = write(fp, srcBuffer + total, srcSize - total); in HcFileWrite() 157 int fp = file.fileHandle.fd; in HcFileClose() local [all …]
|
/base/hiviewdfx/hilog_lite/services/apphilogcat/ |
D | hiview_applogcat.c | 40 int FlushAndSync(FILE *fp); 44 FILE *fp = fopen(filename, "r"); in FileSize() local 45 if (!fp) { in FileSize() 50 int ret = fseek(fp, 0L, SEEK_END); in FileSize() 52 size = ftell(fp); in FileSize() 54 fclose(fp); in FileSize() 59 static FILE *FileClear(FILE **fp, const char *filename) in FileClear() argument 61 if (*fp != NULL) { in FileClear() 62 fclose(*fp); in FileClear() 64 *fp = fopen(filename, "w"); in FileClear() [all …]
|
/base/startup/init/services/modules/reboot/ |
D | reboot_misc.c | 40 FILE *fp = fopen(realPath, "rb+"); in RBMiscWriteUpdaterMessage() local 43 if (fp != NULL) { in RBMiscWriteUpdaterMessage() 44 size_t writeLen = fwrite(boot, sizeof(struct RBMiscUpdateMessage), 1, fp); in RBMiscWriteUpdaterMessage() 46 (void)fclose(fp); in RBMiscWriteUpdaterMessage() 55 FILE *fp = NULL; in RBMiscReadUpdaterMessage() local 58 fp = fopen(realPath, "rb"); in RBMiscReadUpdaterMessage() 62 fp = fopen(path, "rb"); in RBMiscReadUpdaterMessage() 64 if (fp != NULL) { in RBMiscReadUpdaterMessage() 65 size_t readLen = fread(boot, 1, sizeof(struct RBMiscUpdateMessage), fp); in RBMiscReadUpdaterMessage() 66 (void)fclose(fp); in RBMiscReadUpdaterMessage()
|
/base/customization/enterprise_device_management/test/unittest/src/ |
D | cmd_utils.cpp | 23 FILE *fp = popen(cmd.c_str(), "r"); in ExecCmdSync() local 24 if (fp != nullptr) { in ExecCmdSync() 25 pclose(fp); in ExecCmdSync() 26 fp = nullptr; in ExecCmdSync()
|
/base/hiviewdfx/hiview/adapter/utility/platform/ohos/ |
D | common_utils.cpp | 95 FILE* fp = popen(cmd.c_str(), "r"); in GetPidByName() local 96 if (fp != nullptr) { in GetPidByName() 97 while (fgets(buffer, sizeof(buffer) - 1, fp) != nullptr) {} in GetPidByName() 100 pclose(fp); in GetPidByName() 125 FILE* fp = popen(cmd.c_str(), "r"); in WriteCommandResultToFile() local 126 if (fp != nullptr) { in WriteCommandResultToFile() 127 while (fgets(buffer, sizeof(buffer), fp) != nullptr) { in WriteCommandResultToFile() 130 pclose(fp); in WriteCommandResultToFile()
|
/base/hiviewdfx/hiview/utility/common_utils/ |
D | calc_fingerprint.cpp | 64 FILE *fp = nullptr; in CalcFileSha() local 65 fp = fopen(filePath.c_str(), "rb"); in CalcFileSha() 66 if (fp == nullptr) { in CalcFileSha() 75 while ((n = fread(buffer, 1, sizeof(buffer), fp))) { in CalcFileSha() 78 if (fclose(fp)) { in CalcFileSha() 81 fp = nullptr; in CalcFileSha()
|
/base/hiviewdfx/hiview/test/moduletest/common/ |
D | hiview_plugin_platform_module_test.cpp | 30 FILE* fp = popen(cmd.c_str(), "r"); in GetCmdResultFromPopen() local 31 if (fp == nullptr) { in GetCmdResultFromPopen() 37 while (!feof(fp)) { in GetCmdResultFromPopen() 38 if (fgets(buffer, bufSize - 1, fp) != NULL) { in GetCmdResultFromPopen() 42 pclose(fp); in GetCmdResultFromPopen()
|
/base/account/os_account/frameworks/common/file_operator/src/ |
D | account_file_operator.cpp | 85 FILE *fp = fopen(path.c_str(), "wb"); in InputFileByPathAndContent() local 86 if (fp == nullptr) { in InputFileByPathAndContent() 90 size_t num = fwrite(content.c_str(), sizeof(char), content.length(), fp); in InputFileByPathAndContent() 93 fclose(fp); in InputFileByPathAndContent() 96 if (fflush(fp) != 0) { in InputFileByPathAndContent() 98 fclose(fp); in InputFileByPathAndContent() 101 if (fsync(fileno(fp)) != 0) { in InputFileByPathAndContent() 103 fclose(fp); in InputFileByPathAndContent() 106 fclose(fp); in InputFileByPathAndContent()
|
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/ |
D | hks_test_file_operator.c | 102 FILE *fp = fopen(filePath, "rb"); in FileRead() local 103 if (fp == NULL) { in FileRead() 108 uint32_t size = fread(buf, 1, len, fp); in FileRead() 109 if (fclose(fp) < 0) { in FileRead() 147 FILE *fp = fopen(filePath, "wb+"); in FileWrite() local 148 if (fp == NULL) { in FileWrite() 155 fclose(fp); in FileWrite() 159 uint32_t size = fwrite(buf, 1, len, fp); in FileWrite() 162 fclose(fp); in FileWrite() 166 if (fclose(fp) < 0) { in FileWrite()
|
/base/security/appverify/interfaces/innerkits/appverify_lite/src/ |
D | app_verify_hap.c | 111 static int ComputeDigestsWithOptionalBlock(const int digestAlgorithm, int fp, const SignatureInfo *… in ComputeDigestsWithOptionalBlock() argument 140 rawBuf = GetSignBlockByType(signInfo, fp, PROFILE_BLOCK_WITHSIGN_TYPE, &rawLen, &blockHead); in ComputeDigestsWithOptionalBlock() 188 static int UpdateSmallBlock(int readLen, const int fp, mbedtls_md_context_t *mdCtx) in UpdateSmallBlock() argument 195 int len = read(fp, onceBuf, sizeof(char) * onceRead); in UpdateSmallBlock() 209 static int ComputerFileHash(const SignatureInfo *signInfo, int digestAlgorithm, const int fp, in ComputerFileHash() argument 214 lseek(fp, 0, SEEK_SET); in ComputerFileHash() 228 ret = UpdateSmallBlock(readLen, fp, mdCtx); in ComputerFileHash() 250 static int ComputerCoreDirHash(const SignatureInfo *signInfo, int digestAlgorithm, const int fp, in ComputerCoreDirHash() argument 259 lseek(fp, signInfo->hapCoreDirOffset, SEEK_SET); in ComputerCoreDirHash() 260 int len = read(fp, dirBuf, sizeof(char) * centralDirSize); in ComputerCoreDirHash() [all …]
|
D | app_file.c | 61 file->fp = *handle; in InitVerify() 72 if (file->fp == FILE_OPEN_FAIL_ERROR_NUM) { in HapMMap() 78 lseek(file->fp, offset, SEEK_SET); in HapMMap() 86 MAP_SHARED, file->fp, mmapInfo->mmapPosition)); in HapMMap()
|
/base/hiviewdfx/hiview/adapter/service/idl/test/unittest/common/ |
D | hiview_sa_test.cpp | 80 FILE* fp = popen("hidumper -s 1201", "r"); variable 81 if (fp != nullptr) { 82 fgets(buffer, sizeof(buffer), fp); 84 pclose(fp);
|
/base/security/selinux/interfaces/policycoreutils/src/ |
D | param_checker.c | 42 FILE *fp = fopen(filename, "r"); in GetProcessNameFromPid() local 43 if (fp == NULL) { in GetProcessNameFromPid() 47 while (fgets(buff, BUF_SIZE - 1, fp) != NULL) { in GetProcessNameFromPid() 50 (void)fclose(fp); in GetProcessNameFromPid() 53 (void)fclose(fp); in GetProcessNameFromPid() 57 (void)fclose(fp); in GetProcessNameFromPid()
|
/base/update/updater/test/unittest/updaterkits_test/ |
D | updaterkits_unittest.cpp | 46 auto fp = std::unique_ptr<FILE, decltype(&fclose)>(fopen(MISC_FILE.c_str(), "wb+"), fclose); variable 47 EXPECT_NE(fp, nullptr); 60 auto fp = std::unique_ptr<FILE, decltype(&fclose)>(fopen(MISC_FILE.c_str(), "wb+"), fclose); variable 61 EXPECT_NE(fp, nullptr);
|
/base/security/huks/test/unittest/huks_lite_test/common/ |
D | hks_test_file_operator.c | 112 FILE *fp = fopen(filePath, "rb"); in FileRead() local 113 if (fp == NULL) { in FileRead() 118 uint32_t size = fread(buf, 1, len, fp); in FileRead() 119 if (fclose(fp) < 0) { in FileRead() 157 FILE *fp = fopen(filePath, "wb+"); in FileWrite() local 158 if (fp == NULL) { in FileWrite() 165 fclose(fp); in FileWrite() 169 uint32_t size = fwrite(buf, 1, len, fp); in FileWrite() 172 fclose(fp); in FileWrite() 176 if (fclose(fp) < 0) { in FileWrite()
|
/base/hiviewdfx/hidumper/frameworks/native/src/executor/ |
D | cmd_dumper.cpp | 116 FILE* fp = popen((CMD_PREFIX + cmd).c_str(), "r"); in GetCmdInterface() local 117 if (fp == nullptr) { in GetCmdInterface() 121 ret = GetLineData(fp, dumpDatas); in GetCmdInterface() 123 pclose(fp); in GetCmdInterface() 127 DumpStatus CMDDumper::GetLineData(FILE* fp, StringMatrix dumpDatas) in GetLineData() argument 133 read = getline(&line_buffer, &len, fp); in GetLineData() 143 if (feof(fp) == 0) { // ferror() in GetLineData()
|
/base/hiviewdfx/faultloggerd/tools/process_dump/ |
D | dfx_config.cpp | 166 FILE *fp = nullptr; in ReadConfig() local 168 fp = fopen(FAULTLOGGER_CONF_PATH, "r"); in ReadConfig() 169 if (fp == nullptr) { in ReadConfig() 172 while (!feof(fp)) { in ReadConfig() 177 if (fgets(codeBuffer, CONF_LINE_SIZE -1, fp) == nullptr) { in ReadConfig() 196 (void)fclose(fp); in ReadConfig()
|
/base/hiviewdfx/hidumper/test/unittest/common/ |
D | hidumper_privacy_test.cpp | 53 FILE *fp = popen(cmd.c_str(), "r"); in IsExistInCmdResult() local 54 while (getline(&buffer, &len, fp) != -1) { in IsExistInCmdResult() 61 pclose(fp); in IsExistInCmdResult()
|
/base/security/huks/utils/file_operator/ |
D | hks_file_operator.c | 99 FILE *fp = fopen(filePath, "rb"); in FileRead() local 100 HKS_IF_NULL_LOGE_RETURN(fp, 0, "failed to open file, errno = 0x%" LOG_PUBLIC "x", errno) in FileRead() 102 uint32_t size = fread(buf, 1, len, fp); in FileRead() 103 if (fclose(fp) < 0) { in FileRead() 139 FILE *fp = fopen(filePath, "wb+"); in FileWrite() local 140 …HKS_IF_NULL_LOGE_RETURN(fp, HKS_ERROR_OPEN_FILE_FAIL, "open file fail, errno = 0x%" LOG_PUBLIC "x"… in FileWrite() 144 fclose(fp); in FileWrite() 148 uint32_t size = fwrite(buf, 1, len, fp); in FileWrite() 151 fclose(fp); in FileWrite() 155 if (fflush(fp) < 0) { in FileWrite() [all …]
|