Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
prio.c File Reference
#include "primpl.h"
#include <string.h>

Go to the source code of this file.

Functions

void _PR_InitIO (void)
void _PR_CleanupIO (void)
 PR_IMPLEMENT (PRFileDesc *)
 PR_IMPLEMENT (void)
 PR_IMPLEMENT (PRInt32)
 PR_IMPLEMENT (PRStatus)

Variables

PRLock_pr_flock_lock
PRCondVar_pr_flock_cv

Function Documentation

Definition at line 81 of file prio.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 48 of file prio.c.

{
    const PRIOMethods *methods = PR_GetFileMethods();

    _PR_InitFdCache();

    _pr_flock_lock = PR_NewLock();
    _pr_flock_cv = PR_NewCondVar(_pr_flock_lock);

#ifdef WIN32
    _pr_stdin = PR_AllocFileDesc((PRInt32)GetStdHandle(STD_INPUT_HANDLE),
            methods);
    _pr_stdout = PR_AllocFileDesc((PRInt32)GetStdHandle(STD_OUTPUT_HANDLE),
            methods);
    _pr_stderr = PR_AllocFileDesc((PRInt32)GetStdHandle(STD_ERROR_HANDLE),
            methods);
#ifdef WINNT
    _pr_stdin->secret->md.sync_file_io = PR_TRUE;
    _pr_stdout->secret->md.sync_file_io = PR_TRUE;
    _pr_stderr->secret->md.sync_file_io = PR_TRUE;
#endif
#else
    _pr_stdin = PR_AllocFileDesc(0, methods);
    _pr_stdout = PR_AllocFileDesc(1, methods);
    _pr_stderr = PR_AllocFileDesc(2, methods);
#endif
    _PR_MD_INIT_FD_INHERITABLE(_pr_stdin, PR_TRUE);
    _PR_MD_INIT_FD_INHERITABLE(_pr_stdout, PR_TRUE);
    _PR_MD_INIT_FD_INHERITABLE(_pr_stderr, PR_TRUE);

    _PR_MD_INIT_IO();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 102 of file prio.c.

{
    PRFileDesc *result = NULL;
    PR_ASSERT((int) osfd >= PR_StandardInput && osfd <= PR_StandardError);

    if (!_pr_initialized) _PR_ImplicitInitialization();
    
    switch (osfd)
    {
        case PR_StandardInput: result = _pr_stdin; break;
        case PR_StandardOutput: result = _pr_stdout; break;
        case PR_StandardError: result = _pr_stderr; break;
        default:
            (void)PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
    }
    return result;
}

Here is the call graph for this function:

Definition at line 146 of file prio.c.

{
    PR_ASSERT(fd);
#ifdef XP_MAC
       _PR_MD_FREE_FILEDESC(fd);
#endif
    _PR_Putfd(fd);
}

Here is the call graph for this function:

Definition at line 158 of file prio.c.

{
       return(_PR_MD_PR_POLL(pds, npds, timeout));
}

Definition at line 166 of file prio.c.

{
#if defined(XP_UNIX) || defined(WIN32) || defined(XP_OS2) || defined(XP_BEOS)
    /*
     * Only a non-layered, NSPR file descriptor can be inherited
     * by a child process.
     */
    if (fd->identity != PR_NSPR_IO_LAYER) {
        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
        return PR_FAILURE;
    }
    if (fd->secret->inheritable != inheritable) {
        if (_PR_MD_SET_FD_INHERITABLE(fd, inheritable) == PR_FAILURE) {
            return PR_FAILURE;
        }
        fd->secret->inheritable = inheritable;
    }
    return PR_SUCCESS;
#else
#ifdef XP_MAC
#pragma unused (fd, inheritable)
#endif
    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return PR_FAILURE;
#endif
}

Variable Documentation

Definition at line 46 of file prio.c.

Definition at line 45 of file prio.c.