Back to index

lightning-sunbird  0.9+nobinonly
Functions
hpux.c File Reference
#include "primpl.h"
#include <setjmp.h>

Go to the source code of this file.

Functions

void _MD_EarlyInit (void)
PRWord_MD_HomeGCRegisters (PRThread *t, int isCurrent, int *np)
void _MD_SET_PRIORITY (_MDThread *thread, PRUintn newPri)
PRStatus _MD_InitializeThread (PRThread *thread)
PRStatus _MD_WAIT (PRThread *thread, PRIntervalTime ticks)
PRStatus _MD_WAKEUP_WAITER (PRThread *thread)
void _MD_YIELD (void)
PRStatus _MD_CREATE_THREAD (PRThread *thread, void(*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize)
void _MD_suspend_thread (PRThread *thread)
void _MD_resume_thread (PRThread *thread)
char * strchr (const char *s, int c)
int memcmp (const void *s1, const void *s2, size_t n)

Function Documentation

PRStatus _MD_CREATE_THREAD ( PRThread thread,
void(*)(void *)  start,
PRThreadPriority  priority,
PRThreadScope  scope,
PRThreadState  state,
PRUint32  stackSize 
)

Definition at line 181 of file hpux.c.

{
    PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for HP-UX.");
}

Definition at line 82 of file hpux.c.

{
#ifndef _PR_PTHREADS
    /*
     * The following piece of code is taken from ns/nspr/src/md_HP-UX.c.
     * In the comment for revision 1.6, dated 1995/09/11 23:33:34,
     * robm says:
     *     This version has some problems which need to be addressed.
     *     First, intercept all system calls and prevent them from
     *     executing the library code which performs stack switches
     *     before normal system call invocation.  In order for library
     *     calls which make system calls to work (like stdio), however,
     *     we must also allocate our own stack and switch the primordial
     *     stack to use it. This isn't so bad, except that I fudged the
     *     backtrace length when copying the old stack to the new one.
     *
     * This is the original comment of robm in the code:
     *    XXXrobm Horrific. To avoid a problem with HP's system call
     *    code, we allocate a new stack for the primordial thread and
     *    use it. However, we don't know how far back the original stack
     *    goes. We should create a routine that performs a backtrace and
     *    finds out just how much we need to copy. As a temporary measure,
     *    I just copy an arbitrary guess.
     *
     * In an email to servereng dated 2 Jan 1997, Mike Patnode (mikep)
     * suggests that this only needs to be done for HP-UX 9.
     */
#ifdef HPUX9
#define PIDOOMA_STACK_SIZE 524288
#define BACKTRACE_SIZE 8192
    {
        jmp_buf jb;
        char *newstack;
        char *oldstack;

        if(!setjmp(jb)) {
            newstack = (char *) PR_MALLOC(PIDOOMA_STACK_SIZE);
           oldstack = (char *) (*(((int *) jb) + 1) - BACKTRACE_SIZE);
            memcpy(newstack, oldstack, BACKTRACE_SIZE);
            *(((int *) jb) + 1) = (int) (newstack + BACKTRACE_SIZE);
            longjmp(jb, 1);
        }
    }
#endif  /* HPUX9 */
#endif  /* !_PR_PTHREADS */
}

Here is the call graph for this function:

PRWord* _MD_HomeGCRegisters ( PRThread t,
int  isCurrent,
int np 
)

Definition at line 129 of file hpux.c.

{
#ifndef _PR_PTHREADS
    if (isCurrent) {
       (void) setjmp(CONTEXT(t));
    }
    *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
    return (PRWord *) CONTEXT(t);
#else
       *np = 0;
       return NULL;
#endif
}

Definition at line 151 of file hpux.c.

{
       return PR_SUCCESS;
}

Definition at line 201 of file hpux.c.

{
#ifdef _PR_PTHREADS
#endif
}
void _MD_SET_PRIORITY ( _MDThread thread,
PRUintn  newPri 
)

Definition at line 145 of file hpux.c.

{
    return;
}

Definition at line 194 of file hpux.c.

{
#ifdef _PR_PTHREADS
#endif
}
PRStatus _MD_WAIT ( PRThread thread,
PRIntervalTime  ticks 
)

Definition at line 157 of file hpux.c.

{
    PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
    _PR_MD_SWITCH_CONTEXT(thread);
    return PR_SUCCESS;
}

Here is the call graph for this function:

Definition at line 165 of file hpux.c.

{
    if (thread) {
       PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
    }
    return PR_SUCCESS;
}

Definition at line 175 of file hpux.c.

{
    PR_NOT_REACHED("_MD_YIELD should not be called for HP-UX.");
}
int memcmp ( const void s1,
const void s2,
size_t  n 
)

Definition at line 249 of file hpux.c.

{
    register unsigned char *p1 = (unsigned char *) s1,
            *p2 = (unsigned char *) s2;

    while (n-- > 0) {
        register int r = ((int) ((unsigned int) *p1)) 
                - ((int) ((unsigned int) *p2));
        if (r) return r;
        p1++; p2++;
    }
    return 0; 
}
char* strchr ( const char *  s,
int  c 
)

Definition at line 217 of file hpux.c.

{
    char ch;

    if (!s) {
        return NULL;
    }

    ch = (char) c;

    while ((*s) && ((*s) != ch)) {
        s++;
    }

    if ((*s) == ch) {
        return (char *) s;
    }

    return NULL;
}