diff --git a/src/gausskernel/cbb/bbox/bbox_lib.cpp b/src/gausskernel/cbb/bbox/bbox_lib.cpp index cdb2520e..c19ed3b9 100644 --- a/src/gausskernel/cbb/bbox/bbox_lib.cpp +++ b/src/gausskernel/cbb/bbox/bbox_lib.cpp @@ -347,9 +347,6 @@ void bbox_PutPid(struct PIPE_ID* pstPid) securec_check_c(rc, "\0", "\0"); } -/* - * find available pipe id by file handle - */ /* function name: bbox_FindPid description: In all occupied pipes, the function search the flag pipe through compare all structure @@ -379,8 +376,17 @@ struct PIPE_ID* bbox_FindPid(int iFd) } /* - * run popen - */ +function name: sys_popen +description: The function gets a free pipe by function bbox_GetFreePid, if normally, then creat a pipe + through sys_pipe, andcreat a child process through function sys_fork, execute a shell command + to run a process. +arguments: One pointer to a string that represents command line, another pointer of type const char* + indicates that the file file handle directs is used in the this mode. +return value: A pointer of type struct PIPE_ID* or NULL. +note: The string that indicates pszMode should only be "r" or "w", +date: 2022/8/2 +contact tel: same +*/ s32 sys_popen(char* pszCmd, const char* pszMode) { struct PIPE_ID* volatile stCurPid = NULL; @@ -485,8 +491,15 @@ s32 sys_popen(char* pszCmd, const char* pszMode) } /* - * close file handle - */ +function name: sys_pclose +description: The function has an contrary action to function sys_popen, it close the pipe + that sys_popen open. +arguments: iFd, an integer that indicates a file handle. +return value: An integer that indicates the final status of the process working before. +note: none +date: 2022/8/2 +contact tel: same +*/ int sys_pclose(s32 iFd) { struct PIPE_ID* pstCur = NULL; @@ -511,6 +524,16 @@ int sys_pclose(s32 iFd) /* * list file in directory */ +/* +function name: bbox_listdir +description: The function has an contrary action to function sys_popen, it close the pipe + that sys_popen open. +arguments: iFd, an integer that indicates a file handle. +return value: An integer that indicates the final status of the process working before. +note: none +date: 2022/8/2 +contact tel: same +*/ s32 bbox_listdir(const char* pstPath, BBOX_LIST_DIR_CALLBACK callback, void* pArgs) { struct linux_dirent* pstEntry = NULL;