Changeset 40571 in vbox
- Timestamp:
- Mar 21, 2012 9:54:31 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76966
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/process.h
r38618 r40571 186 186 * be possible to wait for it, i.e. @a phProcess shall be NULL. */ 187 187 #define RTPROC_FLAGS_DETACHED RT_BIT(0) 188 /** Don't show the started process according to the specific189 * OS guidelines. */188 /** Don't show the started process. 189 * This is a window (and maybe OS/2) concept, do not use on other platforms. */ 190 190 #define RTPROC_FLAGS_HIDDEN RT_BIT(1) 191 /** Use special code path for starting child processes from 192 * a service (daemon). On Windows this is required for services193 * because of the so called "Session 0" isolation which was194 * introduced with Windows Vista. */191 /** Use special code path for starting child processes from a service (daemon). 192 * This is a windows concept for dealing with the so called "Session 0" 193 * isolation which was introduced with Windows Vista. Do not use on other 194 * platforms. */ 195 195 #define RTPROC_FLAGS_SERVICE RT_BIT(2) 196 196 /** Suppress changing the process contract id for the child process 197 * on Solaris. Without this flag the contract id is always changed,198 * as that'sthe more frequently used case. */197 * on Solaris. Without this flag the contract id is always changed, as that's 198 * the more frequently used case. */ 199 199 #define RTPROC_FLAGS_SAME_CONTRACT RT_BIT(3) 200 /** Do not load user profile data when executing a process. This bit201 * at the moment only is valid on Windows. */200 /** Do not load user profile data when executing a process. 201 * This bit at the moment only is valid on Windows. */ 202 202 #define RTPROC_FLAGS_NO_PROFILE RT_BIT(4) 203 /** Create process w /o a console window. This bit204 * at the moment only is valid on Windows. */203 /** Create process without a console window. 204 * This is a Windows (and OS/2) concept, do not use on other platforms. */ 205 205 #define RTPROC_FLAGS_NO_WINDOW RT_BIT(5) 206 /** Search the PATH for the executable. */ 207 #define RTPROC_FLAGS_SEARCH_PATH RT_BIT(6) 206 208 207 209 /** @} */ -
trunk/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
r40046 r40571 69 69 #include <iprt/err.h> 70 70 #include <iprt/file.h> 71 #include <iprt/path.h> 71 72 #include <iprt/pipe.h> 72 73 #include <iprt/socket.h> … … 256 257 257 258 259 /** 260 * RTPathTraverseList callback used by RTProcCreateEx to locate the executable. 261 */ 262 static DECLCALLBACK(int) rtPathFindExec(char const *pchPath, size_t cchPath, void *pvUser1, void *pvUser2) 263 { 264 const char *pszExec = (const char *)pvUser1; 265 char *pszRealExec = (char *)pvUser2; 266 int rc = RTPathJoinEx(pszRealExec, RTPATH_MAX, pchPath, cchPath, pszExec, RTSTR_MAX); 267 if (RT_FAILURE(rc)) 268 return rc; 269 if (!access(pszRealExec, X_OK)) 270 return VINF_SUCCESS; 271 if ( errno == EACCES 272 || errno == EPERM) 273 return RTErrConvertFromErrno(errno); 274 return VINF_TRY_AGAIN; 275 } 276 277 258 278 RTR3DECL(int) RTProcCreateEx(const char *pszExec, const char * const *papszArgs, RTENV hEnv, uint32_t fFlags, 259 279 PCRTHANDLE phStdIn, PCRTHANDLE phStdOut, PCRTHANDLE phStdErr, const char *pszAsUser, … … 267 287 AssertPtrReturn(pszExec, VERR_INVALID_POINTER); 268 288 AssertReturn(*pszExec, VERR_INVALID_PARAMETER); 269 AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DETACHED | RTPROC_FLAGS_HIDDEN | RTPROC_FLAGS_SERVICE | RTPROC_FLAGS_SAME_CONTRACT | RTPROC_FLAGS_NO_PROFILE )), VERR_INVALID_PARAMETER);289 AssertReturn(!(fFlags & ~(RTPROC_FLAGS_DETACHED | RTPROC_FLAGS_HIDDEN | RTPROC_FLAGS_SERVICE | RTPROC_FLAGS_SAME_CONTRACT | RTPROC_FLAGS_NO_PROFILE | RTPROC_FLAGS_SEARCH_PATH)), VERR_INVALID_PARAMETER); 270 290 AssertReturn(!(fFlags & RTPROC_FLAGS_DETACHED) || !phProcess, VERR_INVALID_PARAMETER); 271 291 AssertReturn(hEnv != NIL_RTENV, VERR_INVALID_PARAMETER); … … 340 360 * Check for execute access to the file. 341 361 */ 362 char szRealExec[RTPATH_MAX]; 342 363 if (access(pszExec, X_OK)) 343 return RTErrConvertFromErrno(errno); 364 { 365 if ( !(fFlags & RTPROC_FLAGS_SEARCH_PATH) 366 || errno != ENOENT 367 || RTPathHavePath(pszExec) ) 368 return RTErrConvertFromErrno(errno); 369 370 /* search */ 371 char *pszPath = RTEnvDupEx(hEnv, "PATH"); 372 rc = RTPathTraverseList(pszPath, ':', rtPathFindExec, (void *)pszExec, &szRealExec[0]); 373 RTStrFree(pszPath); 374 if (RT_FAILURE(rc)) 375 return rc == VERR_END_OF_STRING ? VERR_FILE_NOT_FOUND : rc; 376 pszExec = szRealExec; 377 } 344 378 345 379 pid_t pid = -1;
Note:
See TracChangeset
for help on using the changeset viewer.