Home
last modified time | relevance | path

Searched refs:fp (Results 1 – 25 of 113) sorted by relevance

12345

/base/hiviewdfx/hiview_lite/
Dhiview_file.c40 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 …]
Dhiview_file.h105 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/
Dparam_persistadp.c37 FILE *fp = fopen(fileName, "r"); in LoadPersistParam_() local
38 PARAM_CHECK(fp != NULL, return, "No valid persist parameter file %s", fileName); in LoadPersistParam_()
41 while (fgets(buffer, buffSize, fp) != NULL) { in LoadPersistParam_()
47 (void)fclose(fp); in LoadPersistParam_()
71 FILE *fp = fopen(path, "a+"); in SavePersistParam() local
73 if (fp != NULL) { in SavePersistParam()
74 ret = fprintf(fp, "%s=%s\n", name, value); in SavePersistParam()
75 (void)fclose(fp); in SavePersistParam()
89 FILE *fp = fopen(path, "w"); in BatchSavePersistParamBegin() local
90 if (fp == NULL) { in BatchSavePersistParamBegin()
[all …]
/base/security/device_auth/deps_adapter/os_adapter/impl/src/linux/
Dhc_file.c97 FILE *fp = (FILE *)file.pfd; in HcFileSize() local
98 if (fp != NULL) { in HcFileSize()
99 if (fseek(fp, 0L, SEEK_END) != 0) { in HcFileSize()
102 int size = ftell(fp); in HcFileSize()
103 if (fseek(fp, 0L, SEEK_SET) != 0) { in HcFileSize()
114 FILE *fp = (FILE *)file.pfd; in HcFileRead() local
115 if (fp == NULL || dstSize < 0 || dst == NULL) { in HcFileRead()
123 int readCount = fread(dstBuffer + total, 1, dstSize - total, fp); in HcFileRead()
124 if (ferror(fp) != 0) { in HcFileRead()
138 FILE *fp = (FILE *)file.pfd; in HcFileWrite() local
[all …]
/base/update/updater/interfaces/kits/misc_info/
Dmisc_info.cpp31 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/
Dhc_file.c74 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()
Dhc_file_posix.c116 int fp = file.fileHandle.fd; in HcFileSize() local
117 int size = lseek(fp, 0, SEEK_END); in HcFileSize()
118 (void)lseek(fp, 0, SEEK_SET); in HcFileSize()
124 int fp = file.fileHandle.fd; in HcFileRead() local
125 if (fp == -1 || dstSize < 0 || dst == NULL) { in HcFileRead()
133 int readCount = read(fp, dstBuffer + total, dstSize - total); in HcFileRead()
150 int fp = file.fileHandle.fd; in HcFileWrite() local
151 if (fp == -1 || srcSize < 0 || src == NULL) { in HcFileWrite()
159 int writeCount = write(fp, srcBuffer + total, srcSize - total); in HcFileWrite()
172 int fp = file.fileHandle.fd; in HcFileClose() local
[all …]
/base/hiviewdfx/hilog_lite/services/apphilogcat/
Dhiview_applogcat.c40 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/powermgr/thermal_manager/test/common/src/
Dthermal_test.cpp36 FILE *fp = fopen(path.c_str(), "w+"); in WriteFile() local
37 if (fp == nullptr) { in WriteFile()
40 size_t num = fwrite(buf.c_str(), sizeof(char), buf.length(), fp); in WriteFile()
43 fclose(fp); in WriteFile()
46 fclose(fp); in WriteFile()
52 FILE *fp = fopen(path.c_str(), "r"); in ReadFile() local
53 if (fp == nullptr) { in ReadFile()
57 fseek(fp, 0, SEEK_END); in ReadFile()
58 int32_t fileSize = static_cast<int32_t>(ftell(fp)); in ReadFile()
60 fseek(fp, 0, SEEK_SET); in ReadFile()
[all …]
/base/startup/init/services/modules/reboot/
Dreboot_misc.c40 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/security/dlp_permission_service/services/dlp_permission/sa/adapt/
Dfile_operator.cpp58 FILE* fp = fopen(path.c_str(), "wb"); in InputFileByPathAndContent() local
59 if (fp == nullptr) { in InputFileByPathAndContent()
63 size_t num = fwrite(content.c_str(), sizeof(char), content.length(), fp); in InputFileByPathAndContent()
66 fclose(fp); in InputFileByPathAndContent()
69 if (fflush(fp) != 0) { in InputFileByPathAndContent()
71 fclose(fp); in InputFileByPathAndContent()
74 if (fsync(fileno(fp)) != 0) { in InputFileByPathAndContent()
76 fclose(fp); in InputFileByPathAndContent()
79 fclose(fp); in InputFileByPathAndContent()
/base/sensors/miscdevice/utils/src/
Dfile_utils.cpp126 FILE* fp = fopen(filePath.c_str(), "r"); in ReadFile() local
127 CHKPS(fp); in ReadFile()
130 while (fgets(buf, sizeof(buf), fp) != nullptr) { in ReadFile()
133 if (fclose(fp) != 0) { in ReadFile()
154 FILE* fp = fdopen(rawFd.fd, "r"); in ReadFd() local
155 CHKPS(fp); in ReadFd()
156 if (fseek(fp, rawFd.offset, SEEK_SET) != 0) { in ReadFd()
158 if (fclose(fp) != 0) { in ReadFd()
168 fgets(buf, onceRead + 1, fp); in ReadFd()
170 alreadyRead = ftell(fp) - rawFd.offset; in ReadFd()
[all …]
/base/hiviewdfx/hiview/utility/common_utils/
Dcalc_fingerprint.cpp64 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/
Dhiview_plugin_platform_module_test.cpp30 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/
Daccount_file_operator.cpp85 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/update/updateservice/services/core/ability/utils/src/
Dsha256_utils.cpp68 FILE *fp = fopen(canonicalPath, "rb"); in GetDigestFromFile() local
70 if (fp == NULL) { in GetDigestFromFile()
73 (void)fseek(fp, 0, SEEK_END); in GetDigestFromFile()
74 long fLen = ftell(fp); in GetDigestFromFile()
75 (void)fseek(fp, 0, SEEK_SET); in GetDigestFromFile()
81 while (!feof(fp) && fLen > 0) { in GetDigestFromFile()
83 int count = (int)fread(buffer, 1, readCount, fp); in GetDigestFromFile()
93 (void)fclose(fp); in GetDigestFromFile()
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/
Dhks_test_file_operator.c102 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/hiviewdfx/hiview/base/utility/
Dcommon_utils.cpp94 FILE* fp = popen(cmd.c_str(), "r"); in GetPidByName() local
95 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()
128 while (fgets(buffer, sizeof(buffer), fp) != nullptr) { in WriteCommandResultToFile()
131 pclose(fp); in WriteCommandResultToFile()
/base/hiviewdfx/hiview/adapter/service/idl/test/unittest/common/
Dhiview_sa_test.cpp80 FILE* fp = popen("hidumper -s 1201", "r"); variable
82 ASSERT_NE(fp, nullptr);
83 fgets(buffer, sizeof(buffer), fp);
85 pclose(fp);
/base/hiviewdfx/hidumper/test/unittest/common/
Dhidumper_test_utils.cpp32 FILE *fp = popen(cmd.c_str(), "r"); in IsExistInCmdResult() local
34 while (getline(&buffer, &len, fp) != -1) { in IsExistInCmdResult()
41 pclose(fp); in IsExistInCmdResult()
/base/security/appverify/interfaces/innerkits/appverify_lite/src/
Dapp_verify_hap.c111 static int32_t ComputeDigestsWithOptionalBlock(const int32_t digestAlgorithm, int32_t fp, const Sig… in ComputeDigestsWithOptionalBlock() argument
140 rawBuf = GetSignBlockByType(signInfo, fp, PROFILE_BLOCK_WITHSIGN_TYPE, &rawLen, &blockHead); in ComputeDigestsWithOptionalBlock()
189 static int32_t UpdateSmallBlock(int32_t readLen, const int32_t fp, mbedtls_md_context_t *mdCtx) in UpdateSmallBlock() argument
196 int32_t len = read(fp, onceBuf, sizeof(char) * onceRead); in UpdateSmallBlock()
210 … int32_t ComputerFileHash(const SignatureInfo *signInfo, int32_t digestAlgorithm, const int32_t fp, in ComputerFileHash() argument
215 lseek(fp, 0, SEEK_SET); in ComputerFileHash()
229 ret = UpdateSmallBlock(readLen, fp, mdCtx); in ComputerFileHash()
251 …t32_t ComputerCoreDirHash(const SignatureInfo *signInfo, int32_t digestAlgorithm, const int32_t fp, in ComputerCoreDirHash() argument
260 lseek(fp, signInfo->hapCoreDirOffset, SEEK_SET); in ComputerCoreDirHash()
261 int32_t len = read(fp, dirBuf, sizeof(char) * centralDirSize); in ComputerCoreDirHash()
[all …]
/base/hiviewdfx/faultloggerd/frameworks/unwinder/
Ddfx_config.cpp127 FILE *fp = nullptr; in ReadConfig() local
129 fp = fopen(FAULTLOGGER_CONF_PATH, "r"); in ReadConfig()
130 if (fp == nullptr) { in ReadConfig()
133 while (!feof(fp)) { in ReadConfig()
135 if (fgets(codeBuffer, CONF_LINE_SIZE - 1, fp) == nullptr) { in ReadConfig()
152 (void)fclose(fp); in ReadConfig()
/base/time/time_service/utils/native/src/
Dtime_file_utils.cpp71 FILE *fp = fopen(path, "r"); in GetNameByPid() local
72 if (fp == nullptr) { in GetNameByPid()
76 char c = static_cast<char>(fgetc(fp)); in GetNameByPid()
85 (void)fclose(fp); in GetNameByPid()
/base/update/updater/test/unittest/flow_update/update_bin/
Dbin_flow_update_unittest.cpp72 FILE* fp = fopen(PKG_PATH, "rb"); variable
73 if (fp == nullptr) {
76 EXPECT_NE(fp, nullptr);
82 while ((len = fread(buf, 1, sizeof(buf), fp)) != 0) {
/base/update/updater/test/unittest/updaterkits_test/
Dupdaterkits_unittest.cpp46 auto fp = std::unique_ptr<FILE, decltype(&fclose)>(fopen(MISC_FILE.c_str(), "wb+"), fclose); variable
47 EXPECT_NE(fp, nullptr);
69 auto fp = std::unique_ptr<FILE, decltype(&fclose)>(fopen(MISC_FILE.c_str(), "wb+"), fclose); variable
70 EXPECT_NE(fp, nullptr);

12345