VirtualBox

Ignore:
Timestamp:
Nov 5, 2023 5:11:43 PM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Cut down the PR_Process* API to the absolute minimum which is actually used, bugref:10545

Location:
trunk/src/libs/xpcom18a4/nsprpub/pr
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h

    r101813 r101839  
    623623/* Process control */
    624624
    625 extern PRProcess * _PR_MD_CREATE_PROCESS(
    626     const char *path,
    627     char *const *argv,
    628     char *const *envp,
    629     const PRProcessAttr *attr);
    630 #define    _PR_MD_CREATE_PROCESS _MD_CREATE_PROCESS
    631 
    632625#ifdef _MD_CREATE_PROCESS_DETACHED
    633626# define _PR_MD_CREATE_PROCESS_DETACHED _MD_CREATE_PROCESS_DETACHED
    634627#endif
    635 
    636 extern PRStatus _PR_MD_DETACH_PROCESS(PRProcess *process);
    637 #define    _PR_MD_DETACH_PROCESS _MD_DETACH_PROCESS
    638 
    639 extern PRStatus _PR_MD_WAIT_PROCESS(PRProcess *process, PRInt32 *exitCode);
    640 #define    _PR_MD_WAIT_PROCESS _MD_WAIT_PROCESS
    641 
    642 extern PRStatus _PR_MD_KILL_PROCESS(PRProcess *process);
    643 #define    _PR_MD_KILL_PROCESS _MD_KILL_PROCESS
    644628
    645629/* Current Time */
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/prproces.h

    r11551 r101839  
    4949#define PR_ResetProcessAttr VBoxNsprPR_ResetProcessAttr
    5050#define PR_ProcessAttrSetStdioRedirect VBoxNsprPR_ProcessAttrSetStdioRedirect
    51 #define PR_SetStdioRedirect VBoxNsprPR_SetStdioRedirect
    5251#define PR_ProcessAttrSetCurrentDirectory VBoxNsprPR_ProcessAttrSetCurrentDirectory
    53 #define PR_CreateProcess VBoxNsprPR_CreateProcess
    54 #define PR_DetachProcess VBoxNsprPR_DetachProcess
    55 #define PR_WaitProcess VBoxNsprPR_WaitProcess
    56 #define PR_KillProcess VBoxNsprPR_KillProcess
    5752#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
    5853
     
    7873);
    7974
    80 /*
    81  * OBSOLETE -- use PR_ProcessAttrSetStdioRedirect instead.
    82  */
    83 NSPR_API(void) PR_SetStdioRedirect(
    84     PRProcessAttr *attr,
    85     PRSpecialFD stdioFd,
    86     PRFileDesc *redirectFd
    87 );
    88 
    8975NSPR_API(PRStatus) PR_ProcessAttrSetCurrentDirectory(
    9076    PRProcessAttr *attr,
     
    9884);
    9985
    100 /*
    101 ** Create a new process
    102 **
    103 ** Create a new process executing the file specified as 'path' and with
    104 ** the supplied arguments and environment.
    105 **
    106 ** This function may fail because of illegal access (permissions),
    107 ** invalid arguments or insufficient resources.
    108 **
    109 ** A process may be created such that the creator can later synchronize its
    110 ** termination using PR_WaitProcess().
    111 */
    112 
    113 NSPR_API(PRProcess*) PR_CreateProcess(
    114     const char *path,
    115     char *const *argv,
    116     char *const *envp,
    117     const PRProcessAttr *attr);
    118 
    11986NSPR_API(PRStatus) PR_CreateProcessDetached(
    12087    const char *path,
     
    12390    const PRProcessAttr *attr);
    12491
    125 NSPR_API(PRStatus) PR_DetachProcess(PRProcess *process);
    126 
    127 NSPR_API(PRStatus) PR_WaitProcess(PRProcess *process, PRInt32 *exitCode);
    128 
    129 NSPR_API(PRStatus) PR_KillProcess(PRProcess *process);
    130 
    13192PR_END_EXTERN_C
    13293
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/unix.c

    r101812 r101839  
    11391139}
    11401140
    1141 #if defined(LINUX)
    1142 extern void _MD_unix_terminate_waitpid_daemon(void);
    1143 
    1144 void _MD_CleanupBeforeExit(void)
    1145 {
    1146     _MD_unix_terminate_waitpid_daemon();
    1147 }
    1148 #endif
    1149 
    11501141#if defined(SOLARIS)
    11511142PRIntervalTime _MD_Solaris_TicksPerSecond(void)
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c

    r101805 r101839  
    4141#ifdef VBOX_USE_IPRT_IN_NSPR
    4242# include <iprt/initterm.h>
     43#endif
     44
     45#ifdef VBOX
     46#include <iprt/err.h>
     47#include <iprt/env.h>
     48#include <iprt/file.h>
     49#include <iprt/process.h>
    4350#endif
    4451
     
    287294            PR_ASSERT(0);
    288295    }
    289 }
    290 
    291 /*
    292  * OBSOLETE
    293  */
    294 PR_IMPLEMENT(void)
    295 PR_SetStdioRedirect(
    296     PRProcessAttr *attr,
    297     PRSpecialFD stdioFd,
    298     PRFileDesc *redirectFd)
    299 {
    300 #if defined(DEBUG)
    301     static PRBool warn = PR_TRUE;
    302     if (warn) {
    303         warn = _PR_Obsolete("PR_SetStdioRedirect()",
    304                 "PR_ProcessAttrSetStdioRedirect()");
    305     }
    306 #endif
    307     PR_ProcessAttrSetStdioRedirect(attr, stdioFd, redirectFd);
    308296}
    309297
     
    470458}
    471459
    472 PR_IMPLEMENT(PRProcess*) PR_CreateProcess(
    473     const char *path,
    474     char *const *argv,
    475     char *const *envp,
    476     const PRProcessAttr *attr)
    477 {
    478     return _PR_MD_CREATE_PROCESS(path, argv, envp, attr);
    479 }  /* PR_CreateProcess */
    480 
    481460PR_IMPLEMENT(PRStatus) PR_CreateProcessDetached(
    482461    const char *path,
     
    485464    const PRProcessAttr *attr)
    486465{
    487 #ifndef _PR_MD_CREATE_PROCESS_DETACHED
    488     PRProcess *process;
    489     PRStatus rv;
    490 s
    491 #ifdef XP_OS2
    492     process = _PR_CreateOS2ProcessEx(path, argv, envp, attr, PR_TRUE);
    493 #else
    494     process = PR_CreateProcess(path, argv, envp, attr);
    495 #endif
    496     if (NULL == process) {
     466    int vrc;
     467    int nEnv, idx;
     468    RTENV childEnv;
     469    RTENV newEnv = RTENV_DEFAULT;
     470
     471    /* this code doesn't support all attributes */
     472    PR_ASSERT(!attr || !attr->currentDirectory);
     473    /* no custom environment, please */
     474    PR_ASSERT(!envp);
     475
     476    childEnv = RTENV_DEFAULT;
     477    if (attr && attr->fdInheritBuffer) {
     478        vrc = RTEnvClone(&newEnv, childEnv);
     479        if (RT_FAILURE(vrc))
     480            return PR_FAILURE;
     481        vrc = RTEnvPutEx(newEnv, attr->fdInheritBuffer);
     482        if (RT_FAILURE(vrc))
     483        {
     484            RTEnvDestroy(newEnv);
     485            return PR_FAILURE;
     486        }
     487        childEnv = newEnv;
     488    }
     489
     490    PRTHANDLE pStdIn = NULL, pStdOut = NULL, pStdErr = NULL;
     491    RTHANDLE hStdIn, hStdOut, hStdErr;
     492    if (attr && attr->stdinFd)
     493    {
     494        hStdIn.enmType = RTHANDLETYPE_FILE;
     495        RTFileFromNative(&hStdIn.u.hFile, attr->stdinFd->secret->md.osfd);
     496        pStdIn = &hStdIn;
     497    }
     498    if (attr && attr->stdoutFd)
     499    {
     500        hStdOut.enmType = RTHANDLETYPE_FILE;
     501        RTFileFromNative(&hStdOut.u.hFile, attr->stdoutFd->secret->md.osfd);
     502        pStdOut = &hStdOut;
     503    }
     504    if (attr && attr->stderrFd)
     505    {
     506        hStdErr.enmType = RTHANDLETYPE_FILE;
     507        RTFileFromNative(&hStdErr.u.hFile, attr->stderrFd->secret->md.osfd);
     508        pStdErr = &hStdErr;
     509    }
     510
     511    vrc = RTProcCreateEx(path, (const char **)argv, childEnv,
     512                         RTPROC_FLAGS_DETACHED, pStdIn, pStdOut, pStdErr,
     513                         NULL /* pszAsUser */, NULL /* pszPassword */, NULL /* pExtraData */,
     514                         NULL /* phProcess */);
     515    if (newEnv != RTENV_DEFAULT) {
     516        RTEnvDestroy(newEnv);
     517    }
     518    if (RT_SUCCESS(vrc))
     519        return PR_SUCCESS;
     520    else
    497521        return PR_FAILURE;
    498     }
    499     rv = PR_DetachProcess(process);
    500     PR_ASSERT(PR_SUCCESS == rv);
    501     if (rv == PR_FAILURE) {
    502         PR_DELETE(process);
    503         return PR_FAILURE;
    504     }
    505     return PR_SUCCESS;
    506 #else /* _PR_MD_CREATE_PROCESS_DETACHED */
    507     return _PR_MD_CREATE_PROCESS_DETACHED(path, argv, envp, attr);
    508 #endif /* _PR_MD_CREATE_PROCESS_DETACHED */
    509 }
    510 
    511 PR_IMPLEMENT(PRStatus) PR_DetachProcess(PRProcess *process)
    512 {
    513     return _PR_MD_DETACH_PROCESS(process);
    514 }
    515 
    516 PR_IMPLEMENT(PRStatus) PR_WaitProcess(PRProcess *process, PRInt32 *exitCode)
    517 {
    518     return _PR_MD_WAIT_PROCESS(process, exitCode);
    519 }  /* PR_WaitProcess */
    520 
    521 PR_IMPLEMENT(PRStatus) PR_KillProcess(PRProcess *process)
    522 {
    523     return _PR_MD_KILL_PROCESS(process);
    524522}
    525523
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette