Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
sunos4.h File Reference
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <limits.h>
#include <sys/types.h>

Go to the source code of this file.

Defines

#define PATH_MAX   _POSIX_PATH_MAX
#define strerror(e)   sys_errlist[((unsigned)(e) < sys_nerr) ? e : 0]
#define memmove(to, from, len)   bcopy((char*)(from),(char*)(to),len)
#define SA_RESTART   0
#define SA_SIGINFO   0
#define strtoul   strtol

Functions

int tolower (int)
int toupper (int)
void perror (const char *)
int getopt (int argc, char **argv, char *spec)
int srandom (long val)
long random (void)
void bcopy (const char *, char *, int)
int printf (const char *,...)
int fprintf (FILE *, const char *,...)
int vprintf (const char *, va_list)
int vfprintf (FILE *, const char *, va_list)
char * vsprintf (char *, const char *, va_list)
int scanf (const char *,...)
int sscanf (const char *, const char *,...)
int fscanf (FILE *, const char *,...)
int fgetc (FILE *)
int fputc (int, FILE *)
int fputs (const char *, FILE *)
int puts (const char *)
int fread (void *, size_t, size_t, FILE *)
int fwrite (const char *, int, int, FILE *)
int fseek (FILE *, long, int)
long ftell (FILE *)
int rewind (FILE *)
int fflush (FILE *)
int _flsbuf (unsigned char, FILE *)
int fclose (FILE *)
int remove (const char *)
int setvbuf (FILE *, char *, int, size_t)
int system (const char *)
FILEpopen (const char *, const char *)
int pclose (FILE *)
int isatty (int fildes)
long strtol (const char *, char **, int)
int putenv (const char *)
void srand48 (long)
long lrand48 (void)
double drand48 (void)
int strcasecmp (const char *, const char *)
 Case-insensitive string comparison.
int strncasecmp (const char *, const char *, size_t)
int strcoll (const char *, const char *)
time_t mktime (struct tm *)
size_t strftime (char *, size_t, const char *, const struct tm *)
int gettimeofday (struct timeval *, struct timezone *)
int setitimer (int, struct itimerval *, struct itimerval *)
time_t time (time_t *)
time_t timegm (struct tm *)
struct tmlocaltime (const time_t *)
struct tmgmtime (const time_t *)
int rename (const char *, const char *)
int ioctl (int, int, int *arg)
int connect (int, struct sockaddr *, int)
int readlink (const char *, char *, int)
int symlink (const char *, const char *)
int ftruncate (int, off_t)
int fchmod (int, mode_t)
int fchown (int, uid_t, gid_t)
int lstat (const char *, struct stat *)
int fstat (int, struct stat *)
int select (int, fd_set *, fd_set *, fd_set *, struct timeval *)
int gethostname (char *, int)
char * getwd (char *)
int getpagesize (void)

Variables

char * sys_errlist []
int sys_nerr
char * optarg
int optind

Define Documentation

#define memmove (   to,
  from,
  len 
)    bcopy((char*)(from),(char*)(to),len)

Definition at line 82 of file sunos4.h.

#define PATH_MAX   _POSIX_PATH_MAX

Definition at line 51 of file sunos4.h.

#define SA_RESTART   0

Definition at line 93 of file sunos4.h.

#define SA_SIGINFO   0

Definition at line 94 of file sunos4.h.

#define strerror (   e)    sys_errlist[((unsigned)(e) < sys_nerr) ? e : 0]

Definition at line 68 of file sunos4.h.

Definition at line 124 of file sunos4.h.


Function Documentation

int _flsbuf ( unsigned  char,
FILE  
)
void bcopy ( const char *  ,
char *  ,
int   
)
int connect ( int  ,
struct sockaddr ,
int   
)
double drand48 ( void  )
int fchmod ( int  ,
mode_t   
)
int fchown ( int  ,
uid_t  ,
gid_t   
)
int fclose ( FILE )
int fflush ( FILE )
int fgetc ( FILE )
int fprintf ( FILE ,
const char *  ,
  ... 
)
int fputc ( int  ,
FILE  
)
int fputs ( const char *  ,
FILE  
)
int fread ( void ,
size_t  ,
size_t  ,
FILE  
)
int fscanf ( FILE ,
const char *  ,
  ... 
)
int fseek ( FILE ,
long  ,
int   
)
int fstat ( int  ,
struct stat  
)
long ftell ( FILE )
int ftruncate ( int  ,
off_t   
)
int fwrite ( const char *  ,
int  ,
int  ,
FILE  
)
int gethostname ( char *  ,
int   
)
int getopt ( int  argc,
char **  argv,
char *  spec 
)

Definition at line 77 of file getopt.c.

{
       static char *place = EMSG;              /* option letter processing */
       register char *oli;                     /* option letter list index */
       char *p;

       if (!*place) {                          /* update scanning pointer */
              if (optind >= nargc || *(place = nargv[optind]) != '-') {
                     place = EMSG;
                     return(EOF);
              }
              if (place[1] && *++place == '-') {      /* found "--" */
                     ++optind;
                     place = EMSG;
                     return(EOF);
              }
       }                                       /* option letter okay? */
       if ((optopt = (int)*place++) == (int)':' ||
           !(oli = index(ostr, optopt))) {
              /*
               * if the user didn't specify '-' as an option,
               * assume it means EOF.
               */
              if (optopt == (int)'-')
                     return(EOF);
              if (!*place)
                     ++optind;
              if (opterr) {
                     if (!(p = rindex(*nargv, '/')))
                            p = *nargv;
                     else
                            ++p;
                     (void)fprintf(stderr, "%s: illegal option -- %c\n",
                         p, optopt);
              }
              return(BADCH);
       }
       if (*++oli != ':') {                    /* don't need argument */
              optarg = NULL;
              if (!*place)
                     ++optind;
       }
       else {                                  /* need an argument */
              if (*place)                     /* no white space */
                     optarg = place;
              else if (nargc <= ++optind) {   /* no arg */
                     place = EMSG;
                     if (!(p = rindex(*nargv, '/')))
                            p = *nargv;
                     else
                            ++p;
                     if (opterr)
                            (void)fprintf(stderr,
                                "%s: option requires an argument -- %c\n",
                                p, optopt);
                     return(BADCH);
              }
              else                            /* white space */
                     optarg = nargv[optind];
              place = EMSG;
              ++optind;
       }
       return(optopt);                         /* dump back option letter */
}

Here is the call graph for this function:

Here is the caller graph for this function:

int gettimeofday ( struct timeval ,
struct timezone  
)
char* getwd ( char *  )
struct tm* gmtime ( const time_t *  ) [read]
int ioctl ( int  ,
int  ,
int arg 
)
int isatty ( int  fildes)
struct tm* localtime ( const time_t *  ) [read]
long lrand48 ( void  )
int lstat ( const char *  ,
struct stat  
)
time_t mktime ( struct tm )
int pclose ( FILE )
void perror ( const char *  )

Definition at line 171 of file dllmain.c.

{
       char buf[128];
       wsprintf( buf, "%s: error %d\n", msg, WSAGetLastError()) ;
       OutputDebugString( buf );
}

Here is the call graph for this function:

FILE* popen ( const char *  ,
const char *   
)
int printf ( const char *  ,
  ... 
)
int putenv ( const char *  )
int puts ( const char *  )
long random ( void  )
int readlink ( const char *  ,
char *  ,
int   
)
int remove ( const char *  )
int rename ( const char *  ,
const char *   
)
int rewind ( FILE )
int scanf ( const char *  ,
  ... 
)
int select ( int  ,
fd_set ,
fd_set ,
fd_set ,
struct timeval  
)

Definition at line 115 of file uxwrap.c.

{
    int osfd;
    _PRUnixPollDesc *unixpds, *unixpd, *eunixpd;
    PRInt32 pdcnt;
    PRIntervalTime timeout;
    int retVal;
#if defined(HPUX9) || defined(AIX_RENAME_SELECT)
    fd_set *rd = (fd_set*) rl;
    fd_set *wr = (fd_set*) wl;
    fd_set *ex = (fd_set*) el;
#endif

#if 0
    /*
     * Easy special case: zero timeout.  Simply call the native
     * select() with no fear of blocking.
     */
    if (tv != NULL && tv->tv_sec == 0 && tv->tv_usec == 0) {
#if defined(HPUX9) || defined(AIX_RENAME_SELECT)
        return _MD_SELECT(width, rl, wl, el, tv);
#else
        return _MD_SELECT(width, rd, wr, ex, tv);
#endif
    }
#endif

    if (!_pr_initialized) {
        _PR_ImplicitInitialization();
    }
              
#ifndef _PR_LOCAL_THREADS_ONLY
    if (_PR_IS_NATIVE_THREAD(_PR_MD_CURRENT_THREAD())) {
        return _MD_SELECT(width, rd, wr, ex, tv);       
    }
#endif

    if (width < 0 || width > FD_SETSIZE) {
        errno = EINVAL;
        return -1;
    }

    /* Compute timeout */
    if (tv) {
        /*
         * These acceptable ranges for t_sec and t_usec are taken
         * from the select() man pages.
         */
        if (tv->tv_sec < 0 || tv->tv_sec > 100000000
                || tv->tv_usec < 0 || tv->tv_usec >= 1000000) {
            errno = EINVAL;
            return -1;
        }

        /* Convert microseconds to ticks */
        timeout = PR_MicrosecondsToInterval(1000000*tv->tv_sec + tv->tv_usec);
    } else {
        /* tv being a NULL pointer means blocking indefinitely */
        timeout = PR_INTERVAL_NO_TIMEOUT;
    }

    /* Check for no descriptors case (just doing a timeout) */
    if ((!rd && !wr && !ex) || !width) {
        PR_Sleep(timeout);
        return 0;
    }

    /*
     * Set up for PR_Poll().  The PRPollDesc array is allocated
     * dynamically.  If this turns out to have high performance
     * penalty, one can change to use a large PRPollDesc array
     * on the stack, and allocate dynamically only when it turns
     * out to be not large enough.
     *
     * I allocate an array of size 'width', which is the maximum
     * number of fds we may need to poll.
     */
    unixpds = (_PRUnixPollDesc *) PR_CALLOC(width * sizeof(_PRUnixPollDesc));
    if (!unixpds) {
        errno = ENOMEM;
        return -1;
    }

    pdcnt = 0;
    unixpd = unixpds;
    for (osfd = 0; osfd < width; osfd++) {
        int in_flags = 0;
        if (rd && FD_ISSET(osfd, rd)) {
            in_flags |= _PR_UNIX_POLL_READ;
        }
        if (wr && FD_ISSET(osfd, wr)) {
            in_flags |= _PR_UNIX_POLL_WRITE;
        }
        if (ex && FD_ISSET(osfd, ex)) {
            in_flags |= _PR_UNIX_POLL_EXCEPT;
        }
        if (in_flags) {
            unixpd->osfd = osfd;
            unixpd->in_flags = in_flags;
            unixpd->out_flags = 0;
            unixpd++;
            pdcnt++;
        }
    }

    /*
     * see comments in mozilla/cmd/xfe/mozilla.c (look for
     * "PR_XGetXtHackFD")
     */
   {
     int needToLockXAgain;
 
     needToLockXAgain = 0;
     if (rd && (_pr_xt_hack_fd != -1)
             && FD_ISSET(_pr_xt_hack_fd, rd) && PR_XIsLocked()
             && (!_pr_xt_hack_okayToReleaseXLock
             || _pr_xt_hack_okayToReleaseXLock())) {
         PR_XUnlock();
         needToLockXAgain = 1;
     }

    /* This is the potentially blocking step */
    retVal = _PR_WaitForMultipleFDs(unixpds, pdcnt, timeout);

     if (needToLockXAgain) {
         PR_XLock();
     }
   }

    if (retVal > 0) {
        /* Compute select results */
        if (rd) ZAP_SET(rd, width);
        if (wr) ZAP_SET(wr, width);
        if (ex) ZAP_SET(ex, width);

        /*
         * The return value can be either the number of ready file
         * descriptors or the number of set bits in the three fd_set's.
         */
        retVal = 0;  /* we're going to recompute */
        eunixpd = unixpds + pdcnt;
        for (unixpd = unixpds; unixpd < eunixpd; unixpd++) {
            if (unixpd->out_flags) {
                int nbits = 0;  /* The number of set bits on for this fd */

                if (unixpd->out_flags & _PR_UNIX_POLL_NVAL) {
                    errno = EBADF;
                    PR_LOG(_pr_io_lm, PR_LOG_ERROR,
                            ("select returns EBADF for %d", unixpd->osfd));
                    retVal = -1;
                    break;
                }
                /*
                 * If a socket has a pending error, it is considered
                 * both readable and writable.  (See W. Richard Stevens,
                 * Unix Network Programming, Vol. 1, 2nd Ed., Section 6.3,
                 * pp. 153-154.)  We also consider a socket readable if
                 * it has a hangup condition.
                 */
                if (rd && (unixpd->in_flags & _PR_UNIX_POLL_READ)
                        && (unixpd->out_flags & (_PR_UNIX_POLL_READ
                        | _PR_UNIX_POLL_ERR | _PR_UNIX_POLL_HUP))) {
                    FD_SET(unixpd->osfd, rd);
                    nbits++;
                }
                if (wr && (unixpd->in_flags & _PR_UNIX_POLL_WRITE)
                        && (unixpd->out_flags & (_PR_UNIX_POLL_WRITE
                        | _PR_UNIX_POLL_ERR))) {
                    FD_SET(unixpd->osfd, wr);
                    nbits++;
                }
                if (ex && (unixpd->in_flags & _PR_UNIX_POLL_WRITE)
                        && (unixpd->out_flags & PR_POLL_EXCEPT)) {
                    FD_SET(unixpd->osfd, ex);
                    nbits++;
                }
                PR_ASSERT(nbits > 0);
#if defined(HPUX) || defined(SOLARIS) || defined(SUNOS4) || defined(OSF1) || defined(AIX)
                retVal += nbits;
#else /* IRIX */
                retVal += 1;
#endif
            }
        }
    }

    PR_ASSERT(tv || retVal != 0);
    PR_LOG(_pr_io_lm, PR_LOG_MIN, ("select returns %d", retVal));
    PR_DELETE(unixpds);

    return retVal;
}

Here is the call graph for this function:

int setitimer ( int  ,
struct itimerval ,
struct itimerval  
)
int setvbuf ( FILE ,
char *  ,
int  ,
size_t   
)
void srand48 ( long  )
int srandom ( long  val)
int sscanf ( const char *  ,
const char *  ,
  ... 
)
int strcasecmp ( const char *  ,
const char *   
)

Case-insensitive string comparison.

Definition at line 94 of file strings.c.

{
       register char *cm = charmap;

       while (cm[*s1] == cm[*s2++])
              if (*s1++ == '\0')
                     return(0);
       return cm[*s1] - cm[*--s2];
}

Here is the call graph for this function:

int strcoll ( const char *  ,
const char *   
)
size_t strftime ( char *  ,
size_t  ,
const char *  ,
const struct tm  
)
int strncasecmp ( const char *  ,
const char *  ,
size_t   
)
long strtol ( const char *  ,
char **  ,
int   
)
int symlink ( const char *  ,
const char *   
)
int system ( const char *  )
time_t time ( time_t *  )
time_t timegm ( struct tm )
int tolower ( int  )
int toupper ( int  )
int vfprintf ( FILE ,
const char *  ,
va_list   
)
int vprintf ( const char *  ,
va_list   
)
char* vsprintf ( char *  ,
const char *  ,
va_list   
)

Variable Documentation

char* optarg

Definition at line 72 of file getopt.c.

Definition at line 70 of file getopt.c.

char* sys_errlist[]