Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
_unixos.h File Reference
#include <unistd.h>
#include <stddef.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include "prio.h"
#include "prmem.h"
#include "prclist.h"
#include <sys/time.h>
#include <sys/types.h>
#include <sys/mman.h>

Go to the source code of this file.

Classes

struct  _PRUnixPollDesc
struct  PRPollQueue
struct  _MDFileDesc
struct  _MDDir
struct  _MDProcess
struct  _MDFileMap
struct  _MD_IOVector

Defines

#define FD_SETSIZE   4096
#define _PR_HAVE_O_APPEND
#define PR_DIRECTORY_SEPARATOR   '/'
#define PR_DIRECTORY_SEPARATOR_STR   "/"
#define PR_PATH_SEPARATOR   ':'
#define PR_PATH_SEPARATOR_STR   ":"
#define GCPTR
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS   5
#define _PR_UNIX_POLL_READ   0x1
#define _PR_UNIX_POLL_WRITE   0x2
#define _PR_UNIX_POLL_EXCEPT   0x4
#define _PR_UNIX_POLL_ERR   0x8
#define _PR_UNIX_POLL_NVAL   0x10
#define _PR_UNIX_POLL_HUP   0x20
#define _PR_POLLQUEUE_PTR(_qp)   ((PRPollQueue*) ((char*) (_qp) - offsetof(PRPollQueue,links)))
#define PROT_NONE   0x0
#define _MD_INIT_STACK(ts, REDZONE)
#define _MD_CLEAR_STACK(ts)
#define PR_SET_INTSOFF(newval)
#define _MD_CREATE_PROCESS   _MD_CreateUnixProcess
#define _MD_DETACH_PROCESS   _MD_DetachUnixProcess
#define _MD_WAIT_PROCESS   _MD_WaitUnixProcess
#define _MD_KILL_PROCESS   _MD_KillUnixProcess
#define _MD_START_INTERRUPTS   _MD_StartInterrupts
#define _MD_STOP_INTERRUPTS   _MD_StopInterrupts
#define _MD_DISABLE_CLOCK_INTERRUPTS   _MD_DisableClockInterrupts
#define _MD_ENABLE_CLOCK_INTERRUPTS   _MD_EnableClockInterrupts
#define _MD_BLOCK_CLOCK_INTERRUPTS   _MD_BlockClockInterrupts
#define _MD_UNBLOCK_CLOCK_INTERRUPTS   _MD_UnblockClockInterrupts
#define _MD_INIT_CPUS   _MD_InitCPUS
#define _MD_WAKEUP_CPUS   _MD_Wakeup_CPUs
#define _MD_PAUSE_CPU   _MD_PauseCPU
#define _MD_EXIT(status)   _exit(status)
#define _MD_GET_ENV   getenv
#define _MD_PUT_ENV   putenv
#define _MD_INIT_FILEDESC(fd)
#define _MD_MAKE_NONBLOCK   _MD_MakeNonblock
#define _MD_INIT_SEGS   _MD_InitSegs
#define _MD_ALLOC_SEGMENT   _MD_AllocSegment
#define _MD_FREE_SEGMENT   _MD_FreeSegment
#define _MD_INTERVAL_INIT()
#define _MD_INTERVAL_PER_MILLISEC()   (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC()   (_PR_MD_INTERVAL_PER_SEC() / 1000000)
#define _MD_ERRNO()   (errno)
#define _MD_GET_SOCKET_ERROR()   (errno)
#define _MD_OPEN_DIR(dir, name)   _MD_open_dir(dir, name)
#define _MD_CLOSE_DIR(dir)   _MD_close_dir(dir)
#define _MD_READ_DIR(dir, flags)   _MD_read_dir(dir, flags)
#define _MD_OPEN(name, osflags, mode)   _MD_open(name, osflags, mode)
#define _MD_OPEN_FILE(name, osflags, mode)   _MD_open(name, osflags, mode)
#define _MD_READ(fd, buf, amount)   _MD_read(fd,buf,amount)
#define _MD_WRITE(fd, buf, amount)   _MD_write(fd,buf,amount)
#define _MD_DELETE(name)   _MD_delete(name)
#define _MD_GETFILEINFO(fn, info)   _MD_getfileinfo(fn, info)
#define _MD_GETFILEINFO64(fn, info)   _MD_getfileinfo64(fn, info)
#define _MD_GETOPENFILEINFO(fd, info)   _MD_getopenfileinfo(fd, info)
#define _MD_GETOPENFILEINFO64(fd, info)   _MD_getopenfileinfo64(fd, info)
#define _MD_RENAME(from, to)   _MD_rename(from, to)
#define _MD_ACCESS(name, how)   _MD_access(name, how)
#define _MD_MKDIR(name, mode)   _MD_mkdir(name, mode)
#define _MD_MAKE_DIR(name, mode)   _MD_mkdir(name, mode)
#define _MD_RMDIR(name)   _MD_rmdir(name)
#define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount)   _MD_accept_read(sock, newSock, raddr, buf, amount)
#define _MD_LOCKFILE   _MD_LockFile
#define _MD_TLOCKFILE   _MD_TLockFile
#define _MD_UNLOCKFILE   _MD_UnlockFile
#define _MD_SOCKET   _MD_socket
#define _MD_CONNECT   _MD_connect
#define _MD_ACCEPT   _MD_accept
#define _MD_BIND   _MD_bind
#define _MD_LISTEN   _MD_listen
#define _MD_SHUTDOWN   _MD_shutdown
#define _MD_RECV   _MD_recv
#define _MD_SEND   _MD_send
#define _MD_RECVFROM   _MD_recvfrom
#define _MD_SENDTO   _MD_sendto
#define _MD_WRITEV   _MD_writev
#define _MD_SOCKETAVAILABLE   _MD_socketavailable
#define _MD_SOCKETAVAILABLE64   _MD_socketavailable64
#define _MD_PIPEAVAILABLE   _MD_socketavailable
#define _MD_PR_POLL   _MD_pr_poll
#define _MD_CLOSE_FILE   _MD_close
#define _MD_LSEEK   _MD_lseek
#define _MD_LSEEK64   _MD_lseek64
#define _MD_FSYNC   _MD_fsync
#define _MD_SOCKETPAIR   _MD_socketpair
#define _MD_CLOSE_SOCKET   _MD_close
#define _MD_STAT   stat
#define _MD_GETPEERNAME   _MD_getpeername
#define _MD_GETSOCKNAME   _MD_getsockname
#define _MD_GETSOCKOPT   _MD_getsockopt
#define _MD_SETSOCKOPT   _MD_setsockopt
#define _MD_SET_FD_INHERITABLE   _MD_set_fd_inheritable
#define _MD_INIT_FD_INHERITABLE   _MD_init_fd_inheritable
#define _MD_QUERY_FD_INHERITABLE   _MD_query_fd_inheritable
#define _MD_GETHOSTNAME   _MD_gethostname
#define _MD_GETSYSINFO   _MD_getsysinfo
#define _MD_CREATE_FILE_MAP   _MD_CreateFileMap
#define _MD_GET_MEM_MAP_ALIGNMENT()   PR_GetPageSize()
#define _MD_MEM_MAP   _MD_MemMap
#define _MD_MEM_UNMAP   _MD_MemUnmap
#define _MD_CLOSE_FILE_MAP   _MD_CloseFileMap
#define GETTIMEOFDAY(tp)   gettimeofday((tp), NULL)

Typedefs

typedef int(* FARPROC )()
typedef struct _PRUnixPollDesc _PRUnixPollDesc
typedef struct PRPollQueue PRPollQueue
typedef PRIntn(* _MD_Fstat64 )(PRIntn osfd, _MDStat64 *buf)
typedef PRIntn(* _MD_Open64 )(const char *path, int oflag,...)
typedef PRIntn(* _MD_Stat64 )(const char *path, _MDStat64 *buf)
typedef _MDOff64_t(* _MD_Lseek64 )(PRIntn osfd, _MDOff64_t, PRIntn whence)
typedef void *(* _MD_Mmap64 )(void *addr, PRSize len, PRIntn prot, PRIntn flags, PRIntn fildes, _MDOff64_t offset)

Functions

PRInt32 _PR_WaitForMultipleFDs (_PRUnixPollDesc *unixpds, PRInt32 pdcnt, PRIntervalTime timeout)
void _PR_Unblock_IO_Wait (struct PRThread *thr)
void _MD_unix_init_running_cpu (struct _PRCPU *cpu)
void _PR_UnixInit (void)
struct PRProcess_MD_CreateUnixProcess (const char *path, char *const *argv, char *const *envp, const struct PRProcessAttr *attr)
PRStatus _MD_DetachUnixProcess (struct PRProcess *process)
PRStatus _MD_WaitUnixProcess (struct PRProcess *process, PRInt32 *exitCode)
PRStatus _MD_KillUnixProcess (struct PRProcess *process)
void _MD_EnableClockInterrupts (void)
void _MD_DisableClockInterrupts (void)
void _MD_InitCPUS (void)
void _MD_Wakeup_CPUs (void)
void _MD_MakeNonblock (PRFileDesc *fd)
void _MD_InitSegs (void)
PRStatus _MD_AllocSegment (PRSegment *seg, PRUint32 size, void *vaddr)
void _MD_FreeSegment (PRSegment *seg)
PRInt32 _MD_AvailableSocket (PRInt32 osfd)
void _MD_StartInterrupts (void)
void _MD_StopInterrupts (void)
void _MD_BlockClockInterrupts (void)
void _MD_UnblockClockInterrupts (void)
void _MD_PauseCPU (PRIntervalTime timeout)
PRStatus _MD_open_dir (struct _MDDir *, const char *)
PRInt32 _MD_close_dir (struct _MDDir *)
char * _MD_read_dir (struct _MDDir *, PRIntn)
PRInt32 _MD_open (const char *name, PRIntn osflags, PRIntn mode)
PRInt32 _MD_delete (const char *name)
PRInt32 _MD_getfileinfo (const char *fn, PRFileInfo *info)
PRInt32 _MD_getfileinfo64 (const char *fn, PRFileInfo64 *info)
PRInt32 _MD_getopenfileinfo (const PRFileDesc *fd, PRFileInfo *info)
PRInt32 _MD_getopenfileinfo64 (const PRFileDesc *fd, PRFileInfo64 *info)
PRInt32 _MD_rename (const char *from, const char *to)
PRInt32 _MD_access (const char *name, PRAccessHow how)
PRInt32 _MD_mkdir (const char *name, PRIntn mode)
PRInt32 _MD_rmdir (const char *name)
PRInt32 _MD_accept_read (PRInt32 sock, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount)
PRInt32 _PR_UnixSendFile (PRFileDesc *sd, PRSendFileData *sfd, PRTransmitFileFlags flags, PRIntervalTime timeout)
PRStatus _MD_LockFile (PRInt32 osfd)
PRStatus _MD_TLockFile (PRInt32 osfd)
PRStatus _MD_UnlockFile (PRInt32 osfd)
PRInt32 _MD_read (PRFileDesc *fd, void *buf, PRInt32 amount)
PRInt32 _MD_write (PRFileDesc *fd, const void *buf, PRInt32 amount)
PRInt32 _MD_socket (int af, int type, int flags)
PRInt32 _MD_connect (PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
PRInt32 _MD_accept (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout)
PRInt32 _MD_bind (PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen)
PRInt32 _MD_listen (PRFileDesc *fd, PRIntn backlog)
PRInt32 _MD_shutdown (PRFileDesc *fd, PRIntn how)
PRInt32 _MD_recv (PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout)
PRInt32 _MD_send (PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout)
PRInt32 _MD_recvfrom (PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout)
PRInt32 _MD_sendto (PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
PRInt32 _MD_writev (PRFileDesc *fd, const struct PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
PRInt32 _MD_socketavailable (PRFileDesc *fd)
PRInt64 _MD_socketavailable64 (PRFileDesc *fd)
PRInt32 _MD_pr_poll (PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
PRInt32 _MD_close (PRInt32 osfd)
PRInt32 _MD_lseek (PRFileDesc *, PRInt32, PRSeekWhence)
PRInt64 _MD_lseek64 (PRFileDesc *, PRInt64, PRSeekWhence)
PRInt32 _MD_fsync (PRFileDesc *fd)
PRInt32 _MD_socketpair (int af, int type, int flags, PRInt32 *osfd)
PRStatus _MD_getpeername (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
PRStatus _MD_getsockname (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
PRStatus _MD_getsockopt (PRFileDesc *fd, PRInt32 level, PRInt32 optname, char *optval, PRInt32 *optlen)
PRStatus _MD_setsockopt (PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char *optval, PRInt32 optlen)
PRStatus _MD_set_fd_inheritable (PRFileDesc *fd, PRBool inheritable)
void _MD_init_fd_inheritable (PRFileDesc *fd, PRBool imported)
void _MD_query_fd_inheritable (PRFileDesc *fd)
PRStatus _MD_gethostname (char *name, PRUint32 namelen)
PRStatus _MD_getsysinfo (PRSysInfo cmd, char *name, PRUint32 namelen)
int _MD_unix_get_nonblocking_connect_error (int osfd)
PRStatus _MD_CreateFileMap (struct PRFileMap *fmap, PRInt64 size)
void_MD_MemMap (struct PRFileMap *fmap, PRInt64 offset, PRUint32 len)
PRStatus _MD_MemUnmap (void *addr, PRUint32 size)
PRStatus _MD_CloseFileMap (struct PRFileMap *fmap)

Variables

PRIntervalTime intr_timeout_ticks
fd_set _pr_md_read_set
fd_set _pr_md_write_set
fd_set _pr_md_exception_set
PRInt16 _pr_md_read_cnt []
PRInt16 _pr_md_write_cnt []
PRInt16 _pr_md_exception_cnt []
PRInt32 _pr_md_ioq_max_osfd
PRUint32 _pr_md_ioq_timeout

Class Documentation

struct _PRUnixPollDesc

Definition at line 117 of file _unixos.h.

Class Members
PRInt16 in_flags
PRInt32 osfd
PRInt16 out_flags
struct PRPollQueue

Definition at line 123 of file _unixos.h.

Collaboration diagram for PRPollQueue:
Class Members
PRCList links
PRUintn npds
PRPackedBool on_ioq
_PRWin16PollDesc * pds
_PRUnixPollDesc * pds
struct PRThread * thr
PRIntervalTime timeout
struct _MDFileDesc

Definition at line 158 of file _beos.h.

Collaboration diagram for _MDFileDesc:
Class Members
PRBool accepted_socket
int connectReturnError
int connectReturnValue
PRBool connectValueValid
OTReason disconnectError
PRBool doListen
PRPackedBool exceptReady
PRBool io_model_committed
_MDSocketCallerInfo misc
PRLock * miscLock
PRPackedBool orderlyDisconnect
int osfd
PRInt32 osfd
PRNetAddr peer_addr
_MDSocketCallerInfo read
PRPackedBool readReady
PRInt32 sock_state
PRBool sync_file_io
_MDSocketCallerInfo write
PRPackedBool writeReady
struct _MDDir

Definition at line 170 of file _beos.h.

Collaboration diagram for _MDDir:
Class Members
char * currentEntryName
DIR * d
WIN32_FIND_DATA d_entry
union _MDDir d_entry
HANDLE d_hdl
HDIR d_hdl
struct dirent * dir
PRBool firstEntry
long ioDirID
short ioFDirIndex
short ioVRefNum
PRUint32 magic
struct _MDProcess

Definition at line 141 of file _beos.h.

Class Members
HANDLE handle
DWORD id
PRInt8 notused
pid_t pid
PID pid
struct _MDFileMap

Definition at line 183 of file _beos.h.

Class Members
DWORD dwAccess
PRIntn flags
HANDLE hFileMap
PRBool isAnonFM
PRIntn prot
PRInt8 unused
struct _MD_IOVector

Definition at line 622 of file _unixos.h.

Collaboration diagram for _MD_IOVector:
Class Members
_MD_Fstat64 _fstat64
_MD_Lseek64 _lseek64
_MD_Mmap64 _mmap64
_MD_Open64 _open64
_MD_Stat64 _stat64

Define Documentation

Definition at line 397 of file _unixos.h.

#define _MD_ACCEPT_READ (   sock,
  newSock,
  raddr,
  buf,
  amount 
)    _MD_accept_read(sock, newSock, raddr, buf, amount)

Definition at line 383 of file _unixos.h.

#define _MD_ACCESS (   name,
  how 
)    _MD_access(name, how)

Definition at line 379 of file _unixos.h.

Definition at line 313 of file _unixos.h.

Definition at line 399 of file _unixos.h.

Definition at line 270 of file _unixos.h.

Definition at line 218 of file _unixos.h.

Definition at line 365 of file _unixos.h.

Definition at line 435 of file _unixos.h.

Definition at line 504 of file _unixos.h.

Definition at line 446 of file _unixos.h.

Definition at line 394 of file _unixos.h.

Definition at line 492 of file _unixos.h.

Definition at line 242 of file _unixos.h.

Definition at line 373 of file _unixos.h.

Definition at line 250 of file _unixos.h.

Definition at line 268 of file _unixos.h.

Definition at line 269 of file _unixos.h.

#define _MD_ERRNO ( )    (errno)

Definition at line 328 of file _unixos.h.

#define _MD_EXIT (   status)    _exit(status)

Definition at line 288 of file _unixos.h.

Definition at line 314 of file _unixos.h.

Definition at line 441 of file _unixos.h.

Definition at line 293 of file _unixos.h.

#define _MD_GET_MEM_MAP_ALIGNMENT ( )    PR_GetPageSize()

Definition at line 494 of file _unixos.h.

Definition at line 329 of file _unixos.h.

Definition at line 374 of file _unixos.h.

Definition at line 375 of file _unixos.h.

Definition at line 476 of file _unixos.h.

Definition at line 376 of file _unixos.h.

Definition at line 377 of file _unixos.h.

Definition at line 454 of file _unixos.h.

Definition at line 457 of file _unixos.h.

Definition at line 461 of file _unixos.h.

Definition at line 479 of file _unixos.h.

Definition at line 276 of file _unixos.h.

Definition at line 470 of file _unixos.h.

Definition at line 298 of file _unixos.h.

Definition at line 312 of file _unixos.h.

Definition at line 217 of file _unixos.h.

Definition at line 321 of file _unixos.h.

Definition at line 324 of file _unixos.h.

Definition at line 323 of file _unixos.h.

Definition at line 258 of file _unixos.h.

Definition at line 401 of file _unixos.h.

Definition at line 385 of file _unixos.h.

Definition at line 437 of file _unixos.h.

Definition at line 439 of file _unixos.h.

#define _MD_MAKE_DIR (   name,
  mode 
)    _MD_mkdir(name, mode)

Definition at line 381 of file _unixos.h.

Definition at line 301 of file _unixos.h.

Definition at line 498 of file _unixos.h.

Definition at line 501 of file _unixos.h.

#define _MD_MKDIR (   name,
  mode 
)    _MD_mkdir(name, mode)

Definition at line 380 of file _unixos.h.

#define _MD_OPEN (   name,
  osflags,
  mode 
)    _MD_open(name, osflags, mode)

Definition at line 367 of file _unixos.h.

#define _MD_OPEN_DIR (   dir,
  name 
)    _MD_open_dir(dir, name)

Definition at line 364 of file _unixos.h.

Definition at line 368 of file _unixos.h.

Definition at line 281 of file _unixos.h.

Definition at line 428 of file _unixos.h.

Definition at line 432 of file _unixos.h.

Definition at line 294 of file _unixos.h.

Definition at line 473 of file _unixos.h.

#define _MD_READ (   fd,
  buf,
  amount 
)    _MD_read(fd,buf,amount)

Definition at line 370 of file _unixos.h.

Definition at line 366 of file _unixos.h.

Definition at line 407 of file _unixos.h.

Definition at line 414 of file _unixos.h.

#define _MD_RENAME (   from,
  to 
)    _MD_rename(from, to)

Definition at line 378 of file _unixos.h.

Definition at line 382 of file _unixos.h.

Definition at line 410 of file _unixos.h.

Definition at line 418 of file _unixos.h.

Definition at line 467 of file _unixos.h.

Definition at line 464 of file _unixos.h.

Definition at line 403 of file _unixos.h.

Definition at line 391 of file _unixos.h.

Definition at line 424 of file _unixos.h.

Definition at line 426 of file _unixos.h.

Definition at line 444 of file _unixos.h.

Definition at line 266 of file _unixos.h.

Definition at line 449 of file _unixos.h.

Definition at line 267 of file _unixos.h.

Definition at line 386 of file _unixos.h.

Definition at line 271 of file _unixos.h.

Definition at line 387 of file _unixos.h.

Definition at line 254 of file _unixos.h.

Definition at line 279 of file _unixos.h.

#define _MD_WRITE (   fd,
  buf,
  amount 
)    _MD_write(fd,buf,amount)

Definition at line 372 of file _unixos.h.

Definition at line 421 of file _unixos.h.

Definition at line 82 of file _unixos.h.

Definition at line 94 of file _unixos.h.

#define _PR_POLLQUEUE_PTR (   _qp)    ((PRPollQueue*) ((char*) (_qp) - offsetof(PRPollQueue,links)))

Definition at line 132 of file _unixos.h.

Definition at line 112 of file _unixos.h.

Definition at line 111 of file _unixos.h.

Definition at line 114 of file _unixos.h.

Definition at line 113 of file _unixos.h.

Definition at line 109 of file _unixos.h.

Definition at line 110 of file _unixos.h.

#define FD_SETSIZE   4096

Definition at line 51 of file _unixos.h.

Definition at line 88 of file _unixos.h.

#define GETTIMEOFDAY (   tp)    gettimeofday((tp), NULL)

Definition at line 514 of file _unixos.h.

Definition at line 84 of file _unixos.h.

Definition at line 85 of file _unixos.h.

Definition at line 86 of file _unixos.h.

Definition at line 87 of file _unixos.h.

Definition at line 224 of file _unixos.h.

#define PROT_NONE   0x0

Definition at line 173 of file _unixos.h.


Typedef Documentation

typedef PRIntn(* _MD_Fstat64)(PRIntn osfd, _MDStat64 *buf)

Definition at line 611 of file _unixos.h.

typedef _MDOff64_t(* _MD_Lseek64)(PRIntn osfd, _MDOff64_t, PRIntn whence)

Definition at line 618 of file _unixos.h.

typedef void*(* _MD_Mmap64)(void *addr, PRSize len, PRIntn prot, PRIntn flags, PRIntn fildes, _MDOff64_t offset)

Definition at line 619 of file _unixos.h.

typedef PRIntn(* _MD_Open64)(const char *path, int oflag,...)

Definition at line 612 of file _unixos.h.

typedef PRIntn(* _MD_Stat64)(const char *path, _MDStat64 *buf)

Definition at line 616 of file _unixos.h.

typedef int(* FARPROC)()

Definition at line 89 of file _unixos.h.

typedef struct PRPollQueue PRPollQueue

Function Documentation

PRInt32 _MD_accept ( PRFileDesc fd,
PRNetAddr addr,
PRUint32 addrlen,
PRIntervalTime  timeout 
)

Definition at line 496 of file bnet.c.

{
    PRInt32 osfd = fd->secret->md.osfd;
    PRInt32 rv, err;
    PRThread *me = _PR_MD_CURRENT_THREAD();

    while ((rv = accept(osfd, (struct sockaddr *) addr,
                        (_PRSockLen_t *)addrlen)) == -1) {
        err = _MD_ERRNO();

        if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
            if (fd->secret->nonblocking) {
                break;
            }
            /* If it's SUPPOSED to be a blocking thread, wait
             * a while to see if the triggering condition gets
             * satisfied.
             */
            /* Assume that we're always using a native thread */
            if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
                goto done;
        } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
            continue;
        } else {
            break;
        }
    }
    if (rv < 0) {
        _PR_MD_MAP_ACCEPT_ERROR(err);
    } else if (addr != NULL) {
        /* bug 134099 */
        err = getpeername(rv, (struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
    }
done:
#ifdef _PR_HAVE_SOCKADDR_LEN
    if (rv != -1) {
        /* Mask off the first byte of struct sockaddr (the length field) */
        if (addr) {
            addr->raw.family = ((struct sockaddr *) addr)->sa_family;
        }
    }
#endif /* _PR_HAVE_SOCKADDR_LEN */
    return(rv);
}

Here is the call graph for this function:

PRInt32 _MD_accept_read ( PRInt32  sock,
PRInt32 newSock,
PRNetAddr **  raddr,
void buf,
PRInt32  amount 
)
PRInt32 _MD_access ( const char *  name,
PRAccessHow  how 
)

Definition at line 253 of file unix.c.

{
PRInt32 rv, err;
int amode;

    switch (how) {
        case PR_ACCESS_WRITE_OK:
            amode = W_OK;
            break;
        case PR_ACCESS_READ_OK:
            amode = R_OK;
            break;
        case PR_ACCESS_EXISTS:
            amode = F_OK;
            break;
        default:
            PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
            rv = -1;
            goto done;
    }
    rv = access(name, amode);

    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_ACCESS_ERROR(err);
    }

done:
    return(rv);
}

Here is the call graph for this function:

PRStatus _MD_AllocSegment ( PRSegment seg,
PRUint32  size,
void vaddr 
)

Definition at line 78 of file macthr.c.

{
       PR_ASSERT(seg != 0);
       PR_ASSERT(size != 0);
       PR_ASSERT(vaddr == 0);

       /*     
       ** Take the actual memory for the segment out of our Figment heap.
       */

#if defined(GC_LEAK_DETECTOR)
       seg->vaddr = (char *)GC_malloc_atomic(size);
#else
       seg->vaddr = (char *)malloc(size);
#endif

       if (seg->vaddr == NULL) {

#if DEBUG
              DebugStr("\p_MD_AllocSegment failed.");
#endif

              return PR_FAILURE;
       }

       seg->size = size;    

       return PR_SUCCESS;
}

Here is the call graph for this function:

PRInt32 _MD_bind ( PRFileDesc fd,
const PRNetAddr addr,
PRUint32  addrlen 
)

Definition at line 664 of file bnet.c.

{
    PRInt32 rv, err;
#ifdef _PR_HAVE_SOCKADDR_LEN
    PRNetAddr addrCopy;

    addrCopy = *addr;
    ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
    ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
    rv = bind(fd->secret->md.osfd, (struct sockaddr *) &addrCopy, (int )addrlen);
#else
    rv = bind(fd->secret->md.osfd, (struct sockaddr *) addr, (int )addrlen);
#endif
    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_BIND_ERROR(err);
    }

    return(rv);
}

Here is the call graph for this function:

Definition at line 2185 of file unix.c.

{
    sigprocmask(SIG_BLOCK, &timer_set, 0);
}

Definition at line 456 of file unix.c.

{
PRInt32 rv, err;

    rv = close(osfd);
    if (rv == -1) {
        err = _MD_ERRNO();
        _PR_MD_MAP_CLOSE_ERROR(err);
    }
    return(rv);
}
PRInt32 _MD_close_dir ( struct _MDDir )

Definition at line 103 of file bfile.c.

{
int rv = 0, err;

       if (md->d) {
              rv = closedir(md->d);
              if (rv == -1) {
                     err = _MD_ERRNO();
                     _PR_MD_MAP_CLOSEDIR_ERROR(err);
              }
       }
       return(rv);
}
PRStatus _MD_CloseFileMap ( struct PRFileMap fmap)

Definition at line 1943 of file macio.c.

{
#pragma unused (fmap)

    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return PR_FAILURE;
}
PRInt32 _MD_connect ( PRFileDesc fd,
const PRNetAddr addr,
PRUint32  addrlen,
PRIntervalTime  timeout 
)

Definition at line 543 of file bnet.c.

{
    PRInt32 rv, err;
    PRThread *me = _PR_MD_CURRENT_THREAD();
    PRInt32 osfd = fd->secret->md.osfd;

#ifndef BONE_VERSION
    fd->secret->md.connectValueValid = PR_FALSE;
#endif
#ifdef _PR_HAVE_SOCKADDR_LEN
    PRNetAddr addrCopy;

    addrCopy = *addr;
    ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
    ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
#endif

    /* (Copied from unix.c)
     * We initiate the connection setup by making a nonblocking connect()
     * call.  If the connect() call fails, there are two cases we handle
     * specially:
     * 1. The connect() call was interrupted by a signal.  In this case
     *    we simply retry connect().
     * 2. The NSPR socket is nonblocking and connect() fails with
     *    EINPROGRESS.  We first wait until the socket becomes writable.
     *    Then we try to find out whether the connection setup succeeded
     *    or failed.
     */

retry:
#ifdef _PR_HAVE_SOCKADDR_LEN
    if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) {
#else
    if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {
#endif
        err = _MD_ERRNO();
#ifndef BONE_VERSION
        fd->secret->md.connectReturnValue = rv;
        fd->secret->md.connectReturnError = err;
        fd->secret->md.connectValueValid = PR_TRUE;
#endif
        if( err == EINTR ) {

            if( _PR_PENDING_INTERRUPT(me)) {

                me->flags &= ~_PR_INTERRUPT;
                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
                return -1;
            }
#ifndef BONE_VERSION
            snooze( 100000L );
#endif
            goto retry;
        }

#ifndef BONE_VERSION
        if(!fd->secret->nonblocking && ((err == EINPROGRESS) || (err==EAGAIN) || (err==EALREADY))) {

            /*
            ** There's no timeout on this connect, but that's not
            ** a big deal, since the connect times out anyways
            ** after 30 seconds.   Just sleep for 1/10th of a second
            ** and retry until we go through or die.
            */

            if( _PR_PENDING_INTERRUPT(me)) {
                me->flags &= ~_PR_INTERRUPT;
                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
                return -1;
            }

            goto retry;
        }

        if( fd->secret->nonblocking && ((err == EAGAIN) || (err == EINPROGRESS))) {
            PR_Lock(_connectLock);
            if (connectCount < sizeof(connectList)/sizeof(connectList[0])) {
                connectList[connectCount].osfd = osfd;
                memcpy(&connectList[connectCount].addr, addr, addrlen);
                connectList[connectCount].addrlen = addrlen;
                connectList[connectCount].timeout = timeout;
                connectCount++;
                PR_Unlock(_connectLock);
                _PR_MD_MAP_CONNECT_ERROR(err);
            } else {
                PR_Unlock(_connectLock);
                PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
            }
            return rv;
        }
#else /* BONE_VERSION */
        if(!fd->secret->nonblocking && (err == EINTR)) {

            rv = socket_io_wait(osfd, WRITE_FD, timeout);
            if (rv == -1) {
                return -1;
            }

            PR_ASSERT(rv == 1);
            if (_PR_PENDING_INTERRUPT(me)) {
                me->flags &= ~_PR_INTERRUPT;
                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
                return -1;
            }
            err = _MD_beos_get_nonblocking_connect_error(osfd);
            if (err != 0) {
                _PR_MD_MAP_CONNECT_ERROR(err);
                return -1;
            }
            return 0;
        }
#endif

        _PR_MD_MAP_CONNECT_ERROR(err);
    }

    return rv;
}

Here is the call graph for this function:

PRStatus _MD_CreateFileMap ( struct PRFileMap fmap,
PRInt64  size 
)

Definition at line 1910 of file macio.c.

{
#pragma unused (fmap, size)

    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return PR_FAILURE;
}
struct PRProcess* _MD_CreateUnixProcess ( const char *  path,
char *const argv,
char *const envp,
const struct PRProcessAttr attr 
) [read]
PRInt32 _MD_delete ( const char *  name)

Definition at line 314 of file bfile.c.

{
PRInt32 rv, err;

    rv = unlink(name);
    if (rv == -1)
    {
       err = _MD_ERRNO();
        _PR_MD_MAP_UNLINK_ERROR(err);
    }
    return (rv);
}
PRStatus _MD_DetachUnixProcess ( struct PRProcess process)

Definition at line 871 of file uxproces.c.

{
    PRStatus retVal = PR_SUCCESS;
    pr_PidRecord *pRec;

    PR_Lock(pr_wp.ml);
    pRec = FindPidTable(process->md.pid);
    if (NULL == pRec) {
       pRec = PR_NEW(pr_PidRecord);
       if (NULL == pRec) {
           PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
           retVal = PR_FAILURE;
           goto done;
       }
       pRec->pid = process->md.pid;
       pRec->state = _PR_PID_DETACHED;
       pRec->reapedCV = NULL;
       InsertPidTable(pRec);
    } else {
       PR_ASSERT(_PR_PID_REAPED == pRec->state);
       if (_PR_PID_REAPED != pRec->state) {
           PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
           retVal = PR_FAILURE;
       } else {
           DeletePidTable(pRec);
           PR_ASSERT(NULL == pRec->reapedCV);
           PR_DELETE(pRec);
       }
    }
    PR_DELETE(process);

done:
    PR_Unlock(pr_wp.ml);
    return retVal;
}

Here is the call graph for this function:

Definition at line 2173 of file unix.c.

{
    struct itimerval itval;
    extern PRUintn _pr_numCPU;

    PR_ASSERT(_pr_numCPU == 1);
       itval.it_interval.tv_sec = 0;
       itval.it_interval.tv_usec = 0;
       itval.it_value = itval.it_interval;
       setitimer(ITIMER_REAL, &itval, 0);
}

Here is the call graph for this function:

Definition at line 2146 of file unix.c.

{
    struct itimerval itval;
    extern PRUintn _pr_numCPU;
#ifdef HPUX9
    struct sigvec vec;

    vec.sv_handler = (void (*)()) HPUX9_ClockInterruptHandler;
    vec.sv_mask = 0;
    vec.sv_flags = 0;
    sigvector(SIGALRM, &vec, 0);
#else
    struct sigaction vtact;

    vtact.sa_handler = (void (*)()) ClockInterruptHandler;
    sigemptyset(&vtact.sa_mask);
    vtact.sa_flags = SA_RESTART;
    sigaction(SIGALRM, &vtact, 0);
#endif /* HPUX9 */

    PR_ASSERT(_pr_numCPU == 1);
       itval.it_interval.tv_sec = 0;
       itval.it_interval.tv_usec = MSEC_PER_TICK * PR_USEC_PER_MSEC;
       itval.it_value = itval.it_interval;
       setitimer(ITIMER_REAL, &itval, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 112 of file macthr.c.

{
       PR_ASSERT((seg->flags & _PR_SEG_VM) == 0);

       if (seg->vaddr != NULL)
              free(seg->vaddr);
}

Here is the call graph for this function:

Definition at line 301 of file bfile.c.

{
PRInt32 rv, err;

    rv = fsync(fd->secret->md.osfd);
    if (rv == -1) {
       err = _MD_ERRNO();
       _PR_MD_MAP_FSYNC_ERROR(err);
    }
    return(rv);
}
PRInt32 _MD_getfileinfo ( const char *  fn,
PRFileInfo info 
)

Definition at line 328 of file bfile.c.

{
struct stat sb;
PRInt32 rv, err;
PRInt64 s, s2us;

       rv = stat(fn, &sb);
       if (rv < 0) {
              err = _MD_ERRNO();
              _PR_MD_MAP_STAT_ERROR(err);
       } else if (info) {
              if (S_IFREG & sb.st_mode)
                     info->type = PR_FILE_FILE;
              else if (S_IFDIR & sb.st_mode)
                     info->type = PR_FILE_DIRECTORY;
              else
                     info->type = PR_FILE_OTHER;

              /* Must truncate file size for the 32 bit
                 version */
              info->size = (sb.st_size & 0xffffffff);
              LL_I2L(s, sb.st_mtime);
              LL_I2L(s2us, PR_USEC_PER_SEC);
              LL_MUL(s, s, s2us);
              info->modifyTime = s;
              LL_I2L(s, sb.st_ctime);
              LL_MUL(s, s, s2us);
              info->creationTime = s;
       }
       return rv;
}

Here is the call graph for this function:

PRInt32 _MD_getfileinfo64 ( const char *  fn,
PRFileInfo64 info 
)

Definition at line 361 of file bfile.c.

{
struct stat sb;
PRInt32 rv, err;
PRInt64 s, s2us;

       rv = stat(fn, &sb);
       if (rv < 0) {
              err = _MD_ERRNO();
              _PR_MD_MAP_STAT_ERROR(err);
       } else if (info) {
              if (S_IFREG & sb.st_mode)
                     info->type = PR_FILE_FILE;
              else if (S_IFDIR & sb.st_mode)
                     info->type = PR_FILE_DIRECTORY;
              else
                     info->type = PR_FILE_OTHER;
       
              /* For the 64 bit version we can use
               * the native st_size without modification
               */
              info->size = sb.st_size;
              LL_I2L(s, sb.st_mtime);
              LL_I2L(s2us, PR_USEC_PER_SEC);
              LL_MUL(s, s, s2us);
              info->modifyTime = s;
              LL_I2L(s, sb.st_ctime);
              LL_MUL(s, s, s2us);
              info->creationTime = s;
       }
       return rv;
}

Here is the call graph for this function:

PRStatus _MD_gethostname ( char *  name,
PRUint32  namelen 
)

Definition at line 888 of file bnet.c.

{
    PRInt32 rv, err;

    rv = gethostname(name, namelen);
    if (rv == 0)
    {
        err = _MD_ERRNO();
        _PR_MD_MAP_GETHOSTNAME_ERROR(err);
        return PR_FAILURE;
    }
    return PR_SUCCESS;
}

Here is the call graph for this function:

Definition at line 395 of file bfile.c.

{
        struct stat sb;
        PRInt64 s, s2us;
        PRInt32 rv, err;

        rv = fstat(fd->secret->md.osfd, &sb);
        if (rv < 0) {
                        err = _MD_ERRNO();
                        _PR_MD_MAP_FSTAT_ERROR(err);
        } else if (info) {
                if (info) {
                        if (S_IFREG & sb.st_mode)
                                info->type = PR_FILE_FILE ;
                        else if (S_IFDIR & sb.st_mode)
                                info->type = PR_FILE_DIRECTORY;
                        else
                                info->type = PR_FILE_OTHER;
                     /* Use lower 32 bits of file size */
                        info->size = ( sb.st_size & 0xffffffff);
                        LL_I2L(s, sb.st_mtime);
                        LL_I2L(s2us, PR_USEC_PER_SEC);
                        LL_MUL(s, s, s2us);
                        info->modifyTime = s;
                        LL_I2L(s, sb.st_ctime);
                        LL_MUL(s, s, s2us);
                        info->creationTime = s;
                }
        }
        return rv;
}

Here is the call graph for this function:

Definition at line 428 of file bfile.c.

{
        struct stat sb;
        PRInt64 s, s2us;
        PRInt32 rv, err;

        rv = fstat(fd->secret->md.osfd, &sb);
        if (rv < 0) {
                        err = _MD_ERRNO();
                        _PR_MD_MAP_FSTAT_ERROR(err);
        } else if (info) {
                if (info) {
                        if (S_IFREG & sb.st_mode)
                                info->type = PR_FILE_FILE ;
                        else if (S_IFDIR & sb.st_mode)
                                info->type = PR_FILE_DIRECTORY;
                        else
                                info->type = PR_FILE_OTHER;
                        info->size = sb.st_size;
                        LL_I2L(s, sb.st_mtime);
                        LL_I2L(s2us, PR_USEC_PER_SEC);
                        LL_MUL(s, s, s2us);
                        info->modifyTime = s;
                        LL_I2L(s, sb.st_ctime);
                        LL_MUL(s, s, s2us);
                        info->creationTime = s;
                }
        }
        return rv;
}

Here is the call graph for this function:

PRStatus _MD_getpeername ( PRFileDesc fd,
PRNetAddr addr,
PRUint32 addrlen 
)

Definition at line 772 of file bnet.c.

{
    PRInt32 rv, err;

    rv = getpeername(fd->secret->md.osfd,
                     (struct sockaddr *) addr, (_PRSockLen_t *)addrlen);

#ifdef _PR_HAVE_SOCKADDR_LEN
    if (rv == 0) {
        /* ignore the sa_len field of struct sockaddr */
        if (addr) {
            addr->raw.family = ((struct sockaddr *) addr)->sa_family;
        }
    }
#endif /* _PR_HAVE_SOCKADDR_LEN */

    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_GETPEERNAME_ERROR(err);
    }
    return rv==0?PR_SUCCESS:PR_FAILURE;
}

Here is the call graph for this function:

PRStatus _MD_getsockname ( PRFileDesc fd,
PRNetAddr addr,
PRUint32 addrlen 
)

Definition at line 749 of file bnet.c.

{
    PRInt32 rv, err;

    rv = getsockname(fd->secret->md.osfd,
                     (struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
#ifdef _PR_HAVE_SOCKADDR_LEN
    if (rv == 0) {
        /* ignore the sa_len field of struct sockaddr */
        if (addr) {
            addr->raw.family = ((struct sockaddr *) addr)->sa_family;
        }
    }
#endif /* _PR_HAVE_SOCKADDR_LEN */
    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_GETSOCKNAME_ERROR(err);
    }

    return rv==0?PR_SUCCESS:PR_FAILURE;
}

Here is the call graph for this function:

PRStatus _MD_getsockopt ( PRFileDesc fd,
PRInt32  level,
PRInt32  optname,
char *  optval,
PRInt32 optlen 
)

Definition at line 796 of file bnet.c.

{
    PRInt32 rv, err;

    rv = getsockopt(fd->secret->md.osfd, level, optname,
                    optval, (_PRSockLen_t *)optlen);
    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_GETSOCKOPT_ERROR(err);
    }

    return rv==0?PR_SUCCESS:PR_FAILURE;
}

Here is the call graph for this function:

PRStatus _MD_getsysinfo ( PRSysInfo  cmd,
char *  name,
PRUint32  namelen 
)

Definition at line 3479 of file unix.c.

{
       struct utsname info;

       PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE));

       if (uname(&info) == -1) {
              _PR_MD_MAP_DEFAULT_ERROR(errno);
       return PR_FAILURE;
       }
       if (PR_SI_SYSNAME == cmd)
              (void)PR_snprintf(name, namelen, info.sysname);
       else if (PR_SI_RELEASE == cmd)
              (void)PR_snprintf(name, namelen, info.release);
       else
              return PR_FAILURE;
    return PR_SUCCESS;
}

Here is the call graph for this function:

void _MD_init_fd_inheritable ( PRFileDesc fd,
PRBool  imported 
)

Definition at line 139 of file bfile.c.

{
       if (imported) {
              fd->secret->inheritable = _PR_TRI_UNKNOWN;
       } else {
              int flags = fcntl(fd->secret->md.osfd, F_GETFD, 0);
              if (flags == -1) {
                     PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
                     return;
              }
              fd->secret->inheritable = (flags & FD_CLOEXEC) ? 
                     _PR_TRI_TRUE : _PR_TRI_FALSE;
       }
}

Definition at line 2015 of file unix.c.

{
    PRInt32 rv, flags;
    PRThread *me = _MD_CURRENT_THREAD();

    rv = pipe(_pr_md_pipefd);
    PR_ASSERT(rv == 0);
    _PR_IOQ_MAX_OSFD(me->cpu) = _pr_md_pipefd[0];
#ifndef _PR_USE_POLL
    FD_SET(_pr_md_pipefd[0], &_PR_FD_READ_SET(me->cpu));
#endif

    flags = fcntl(_pr_md_pipefd[0], F_GETFL, 0);
    fcntl(_pr_md_pipefd[0], F_SETFL, flags | O_NONBLOCK);
    flags = fcntl(_pr_md_pipefd[1], F_GETFL, 0);
    fcntl(_pr_md_pipefd[1], F_SETFL, flags | O_NONBLOCK);
}

Definition at line 2901 of file unix.c.

{
#ifdef DEBUG
    /*
    ** Disable using mmap(2) if NSPR_NO_MMAP is set
    */
    if (getenv("NSPR_NO_MMAP")) {
        _pr_zero_fd = -2;
        return;
    }
#endif
    _pr_zero_fd = open("/dev/zero",O_RDWR , 0);
    /* Prevent the fd from being inherited by child processes */
    fcntl(_pr_zero_fd, F_SETFD, FD_CLOEXEC);
    _pr_md_lock = PR_NewLock();
}

Here is the call graph for this function:

PRStatus _MD_KillUnixProcess ( struct PRProcess process)

Definition at line 967 of file uxproces.c.

{
    PRErrorCode prerror;
    PRInt32 oserror;

    if (kill(process->md.pid, SIGKILL) == 0) {
       return PR_SUCCESS;
    }
    oserror = errno;
    switch (oserror) {
        case EPERM:
           prerror = PR_NO_ACCESS_RIGHTS_ERROR;
           break;
        case ESRCH:
           prerror = PR_INVALID_ARGUMENT_ERROR;
           break;
        default:
           prerror = PR_UNKNOWN_ERROR;
           break;
    }
    PR_SetError(prerror, oserror);
    return PR_FAILURE;
}  /* _MD_KillUnixProcess */
PRInt32 _MD_listen ( PRFileDesc fd,
PRIntn  backlog 
)

Definition at line 686 of file bnet.c.

{
    PRInt32 rv, err;

#ifndef BONE_VERSION
    /* Bug workaround!  Setting listen to 0 on Be accepts no connections.
    ** On most UN*Xes this sets the default.
    */

    if( backlog == 0 ) backlog = 5;
#endif

    rv = listen(fd->secret->md.osfd, backlog);
    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_LISTEN_ERROR(err);
    }

    return(rv);
}

Here is the call graph for this function:

Definition at line 960 of file macio.c.

{
       OSErr                err;
       FCBPBRec             fcbpb;
       HFileParam           fpb;
       Str255               pascalName;
       
       fcbpb.ioNamePtr = pascalName;
       fcbpb.ioVRefNum = 0;
       fcbpb.ioRefNum = fd;
       fcbpb.ioFCBIndx = 0;
       
       err = PBGetFCBInfoSync(&fcbpb);
       if (err != noErr)
              goto ErrorExit;
       
       fpb.ioCompletion = NULL;
       fpb.ioNamePtr = pascalName;
       fpb.ioVRefNum = fcbpb.ioFCBVRefNum;
       fpb.ioDirID = fcbpb.ioFCBParID;

       err = PBHSetFLockSync((HParmBlkPtr)&fpb);
       if (err != noErr)
              goto ErrorExit;
       
       return PR_SUCCESS;
       
ErrorExit:
       _PR_MD_CURRENT_THREAD()->md.osErrCode = err;
       _MD_SetError(err);
    return PR_FAILURE;
}

Here is the call graph for this function:

Definition at line 2306 of file unix.c.

{
    PROffset32 rv, where;

    switch (whence) {
        case PR_SEEK_SET:
            where = SEEK_SET;
            break;
        case PR_SEEK_CUR:
            where = SEEK_CUR;
            break;
        case PR_SEEK_END:
            where = SEEK_END;
            break;
        default:
            PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
            rv = -1;
            goto done;
    }
    rv = lseek(fd->secret->md.osfd,offset,where);
    if (rv == -1)
    {
        PRInt32 syserr = _MD_ERRNO();
        _PR_MD_MAP_LSEEK_ERROR(syserr);
    }
done:
    return(rv);
}

Here is the call graph for this function:

Definition at line 2335 of file unix.c.

{
    PRInt32 where;
    PROffset64 rv;

    switch (whence)
    {
        case PR_SEEK_SET:
            where = SEEK_SET;
            break;
        case PR_SEEK_CUR:
            where = SEEK_CUR;
            break;
        case PR_SEEK_END:
            where = SEEK_END;
            break;
        default:
            PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
            rv = minus_one;
            goto done;
    }
    rv = _md_iovector._lseek64(fd->secret->md.osfd, offset, where);
    if (LL_EQ(rv, minus_one))
    {
        PRInt32 syserr = _MD_ERRNO();
        _PR_MD_MAP_LSEEK_ERROR(syserr);
    }
done:
    return rv;
}  /* _MD_lseek64 */

Here is the call graph for this function:

Definition at line 667 of file os2sock.c.

{
    PRInt32 osfd = fd->secret->md.osfd;
    PRInt32 err;
    PRUint32  one = 1;
    
    if (osfd <= 2) {
        /* Don't mess around with stdin, stdout or stderr */
        return;
    }

    err = _OS2_IOCTL( osfd, FIONBIO, (char *) &one, sizeof(one));
    if ( err != 0 )
    {
        err = sock_errno();
        _PR_MD_MAP_SOCKET_ERROR(err);
    }
}
void* _MD_MemMap ( struct PRFileMap fmap,
PRInt64  offset,
PRUint32  len 
)

Definition at line 1924 of file macio.c.

{
#pragma unused (fmap, offset, len)

    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return NULL;
}
PRStatus _MD_MemUnmap ( void addr,
PRUint32  size 
)

Definition at line 1935 of file macio.c.

{
#pragma unused (addr, len)

    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return PR_FAILURE;
}
PRInt32 _MD_mkdir ( const char *  name,
PRIntn  mode 
)

Definition at line 533 of file bfile.c.

{
    status_t rv;
    int err;

    /*
    ** This lock is used to enforce rename semantics as described
    ** in PR_Rename. Look there for more fun details.
    */
    if (NULL !=_pr_rename_lock)
        PR_Lock(_pr_rename_lock);

    rv = mkdir(name, mode);
    if (rv < 0) {
       err = _MD_ERRNO();
       _PR_MD_MAP_MKDIR_ERROR(err);
    }
    if (NULL !=_pr_rename_lock)
        PR_Unlock(_pr_rename_lock);
    return rv; 
}
PRInt32 _MD_open ( const char *  name,
PRIntn  osflags,
PRIntn  mode 
)

Definition at line 167 of file bfile.c.

{
       PRInt32 osflags;
       PRInt32 rv, err;

       if (flags & PR_RDWR) {
              osflags = O_RDWR;
       } else if (flags & PR_WRONLY) {
              osflags = O_WRONLY;
       } else {
              osflags = O_RDONLY;
       }

       if (flags & PR_EXCL)
              osflags |= O_EXCL;
       if (flags & PR_APPEND)
              osflags |= O_APPEND;
       if (flags & PR_TRUNCATE)
              osflags |= O_TRUNC;
       if (flags & PR_SYNC) {
/* Ummmm.  BeOS doesn't appear to
   support sync in any way shape or
   form. */
              return PR_NOT_IMPLEMENTED_ERROR;
       }

       /*
       ** On creations we hold the 'create' lock in order to enforce
       ** the semantics of PR_Rename. (see the latter for more details)
       */
       if (flags & PR_CREATE_FILE)
       {
              osflags |= O_CREAT ;
              if (NULL !=_pr_rename_lock)
                  PR_Lock(_pr_rename_lock);
       }

        rv = open(name, osflags, mode);

        if (rv < 0) {
                err = _MD_ERRNO();
                _PR_MD_MAP_OPEN_ERROR(err);
        }                                                                      

    if ((flags & PR_CREATE_FILE) && (NULL !=_pr_rename_lock))
        PR_Unlock(_pr_rename_lock);
        return rv;
}
PRStatus _MD_open_dir ( struct _MDDir ,
const char *   
)

Definition at line 52 of file bfile.c.

{
int err;

       md->d = opendir(name);
       if (!md->d) {
              err = _MD_ERRNO();
              _PR_MD_MAP_OPENDIR_ERROR(err);
              return PR_FAILURE;
       }
       return PR_SUCCESS;
}

Definition at line 263 of file macthr.c.

{
    if (timeout != PR_INTERVAL_NO_WAIT)
    {
        // There is a race condition entering the critical section
        // in AsyncIOCompletion (and probably elsewhere) that can
        // causes deadlock for the duration of this timeout. To
        // work around this, use a max 500ms timeout for now.
        // See bug 99561 for details.
        if (PR_IntervalToMilliseconds(timeout) > MAX_PAUSE_TIMEOUT_MS)
            timeout = PR_MillisecondsToInterval(MAX_PAUSE_TIMEOUT_MS);

        WaitOnIdleSemaphore(timeout);
        (void) _MD_IOInterrupt();
    }
}

Here is the call graph for this function:

PRInt32 _MD_pr_poll ( PRPollDesc pds,
PRIntn  npds,
PRIntervalTime  timeout 
)

Definition at line 569 of file bfile.c.

{
       PRInt32 rv = 0;
       PRThread *me = _PR_MD_CURRENT_THREAD();
       /*
        * This code is almost a duplicate of w32poll.c's _PR_MD_PR_POLL().
        */
       fd_set rd, wt, ex;
       PRFileDesc *bottom;
       PRPollDesc *pd, *epd;
       PRInt32 maxfd = -1, ready, err;
       PRIntervalTime remaining, elapsed, start;

       struct timeval tv, *tvp = NULL;

       if (_PR_PENDING_INTERRUPT(me))
       {
              me->flags &= ~_PR_INTERRUPT;
              PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
              return -1;
       }

       if (0 == npds) {
              PR_Sleep(timeout);
              return rv;
       }

       FD_ZERO(&rd);
       FD_ZERO(&wt);
       FD_ZERO(&ex);

       ready = 0;
       for (pd = pds, epd = pd + npds; pd < epd; pd++)
       {
              PRInt16 in_flags_read = 0, in_flags_write = 0;
              PRInt16 out_flags_read = 0, out_flags_write = 0; 
              
              if ((NULL != pd->fd) && (0 != pd->in_flags))
              {
                     if (pd->in_flags & PR_POLL_READ)
                     {
                            in_flags_read = (pd->fd->methods->poll)(pd->fd, pd->in_flags & ~PR_POLL_WRITE, &out_flags_read);
                     }
                     if (pd->in_flags & PR_POLL_WRITE)
                     {
                            in_flags_write = (pd->fd->methods->poll)(pd->fd, pd->in_flags & ~PR_POLL_READ, &out_flags_write);
                     }
                     if ((0 != (in_flags_read & out_flags_read))
                         || (0 != (in_flags_write & out_flags_write)))
                     {
                            /* this one's ready right now */
                            if (0 == ready)
                            {
                                   /*
                                    * We will have to return without calling the
                                    * system poll/select function.  So zero the
                                    * out_flags fields of all the poll descriptors
                                    * before this one. 
                                    */
                                   PRPollDesc *prev;
                                   for (prev = pds; prev < pd; prev++)
                                   {
                                          prev->out_flags = 0;
                                   }
                            }
                            ready += 1;
                            pd->out_flags = out_flags_read | out_flags_write;
                     }
                     else
                     {
                            pd->out_flags = 0;  /* pre-condition */
                            
                            /* make sure this is an NSPR supported stack */
                            bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
                            PR_ASSERT(NULL != bottom);  /* what to do about that? */
                            if ((NULL != bottom)
                                && (_PR_FILEDESC_OPEN == bottom->secret->state))
                            {
                                   if (0 == ready)
                                   {
                                          PRInt32 osfd = bottom->secret->md.osfd; 
                                          if (osfd > maxfd) maxfd = osfd;
                                          if (in_flags_read & PR_POLL_READ)
                                          {
                                                 pd->out_flags |= _PR_POLL_READ_SYS_READ;
                                                 FD_SET(osfd, &rd);
                                          }
                                          if (in_flags_read & PR_POLL_WRITE)
                                          {
                                                 pd->out_flags |= _PR_POLL_READ_SYS_WRITE;
                                                 FD_SET(osfd, &wt);
                                          }
                                          if (in_flags_write & PR_POLL_READ)
                                          {
                                                 pd->out_flags |= _PR_POLL_WRITE_SYS_READ;
                                                 FD_SET(osfd, &rd);
                                          }
                                          if (in_flags_write & PR_POLL_WRITE)
                                          {
                                                 pd->out_flags |= _PR_POLL_WRITE_SYS_WRITE;
                                                 FD_SET(osfd, &wt);
                                          }
                                          if (pd->in_flags & PR_POLL_EXCEPT) FD_SET(osfd, &ex);
                                   }
                            }
                            else
                            {
                                   if (0 == ready)
                                   {
                                          PRPollDesc *prev;
                                          for (prev = pds; prev < pd; prev++)
                                          {
                                                 prev->out_flags = 0;
                                          }
                                   }
                                   ready += 1;  /* this will cause an abrupt return */
                                   pd->out_flags = PR_POLL_NVAL;  /* bogii */
                            }
                     }
              }
              else
              {
                     pd->out_flags = 0;
              }
       }

       if (0 != ready) return ready;  /* no need to block */

       remaining = timeout;
       start = PR_IntervalNow(); 

 retry:
       if (timeout != PR_INTERVAL_NO_TIMEOUT)
       {
              PRInt32 ticksPerSecond = PR_TicksPerSecond();
              tv.tv_sec = remaining / ticksPerSecond;
              tv.tv_usec = PR_IntervalToMicroseconds( remaining % ticksPerSecond );
              tvp = &tv;
       }
       
       ready = _MD_SELECT(maxfd + 1, &rd, &wt, &ex, tvp);
       
       if (ready == -1 && errno == EINTR)
       {
              if (timeout == PR_INTERVAL_NO_TIMEOUT) goto retry;
              else
              {
                     elapsed = (PRIntervalTime) (PR_IntervalNow() - start);
                     if (elapsed > timeout) ready = 0;  /* timed out */
                     else
                     {
                            remaining = timeout - elapsed;
                            goto retry; 
                     }
              }
       } 

       /*
       ** Now to unravel the select sets back into the client's poll
       ** descriptor list. Is this possibly an area for pissing away
       ** a few cycles or what?
       */
       if (ready > 0)
       {
              ready = 0;
              for (pd = pds, epd = pd + npds; pd < epd; pd++)
              {
                     PRInt16 out_flags = 0;
                     if ((NULL != pd->fd) && (0 != pd->in_flags))
                     {
                            PRInt32 osfd;
                            bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
                            PR_ASSERT(NULL != bottom);
                            
                            osfd = bottom->secret->md.osfd; 
                            
                            if (FD_ISSET(osfd, &rd))
                            {
                                   if (pd->out_flags & _PR_POLL_READ_SYS_READ)
                                          out_flags |= PR_POLL_READ;
                                   if (pd->out_flags & _PR_POLL_WRITE_SYS_READ)
                                          out_flags |= PR_POLL_WRITE;
                            }
                            if (FD_ISSET(osfd, &wt))
                            {
                                   if (pd->out_flags & _PR_POLL_READ_SYS_WRITE)
                                          out_flags |= PR_POLL_READ;
                                   if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE)
                                          out_flags |= PR_POLL_WRITE;
                            }
                            if (FD_ISSET(osfd, &ex)) out_flags |= PR_POLL_EXCEPT;

/* Workaround for nonblocking connects under net_server */
#ifndef BONE_VERSION               
                            if (out_flags)
                            {
                                   /* check if it is a pending connect */
                                   int i = 0, j = 0;
                                   PR_Lock( _connectLock );
                                   for( i = 0; i < connectCount; i++ ) 
                                   {
                                          if(connectList[i].osfd == osfd)
                                          {
                                                 int connectError;
                                                 int connectResult;
                                   
                                                 connectResult = connect(connectList[i].osfd,
                                                                         &connectList[i].addr,
                                                                         connectList[i].addrlen);
                                                 connectError = errno;
                                   
                                                 if(connectResult < 0 ) 
                                                 {
                                                        if(connectError == EINTR || connectError == EWOULDBLOCK ||
                                                    connectError == EINPROGRESS || connectError == EALREADY)
                                                        {
                                                               break;
                                                        }
                                                 }
                                   
                                                 if(i == (connectCount - 1))
                                                 {
                                                        connectList[i].osfd = -1;
                                                 } else {
                                                        for(j = i; j < connectCount; j++ )
                                                        {
                                                               memcpy( &connectList[j], &connectList[j+1],
                                                                       sizeof(connectList[j]));
                                                        }
                                                 }
                                                 connectCount--;
                                   
                                                 bottom->secret->md.connectReturnValue = connectResult;
                                                 bottom->secret->md.connectReturnError = connectError;
                                                 bottom->secret->md.connectValueValid = PR_TRUE;
                                                 break;
                                          }
                                   }
                                   PR_Unlock( _connectLock );
                            }
#endif
                     }
                     pd->out_flags = out_flags;
                     if (out_flags) ready++;
              }
              PR_ASSERT(ready > 0);
       }
       else if (ready < 0)
       { 
              err = _MD_ERRNO();
              if (err == EBADF)
              {
                     /* Find the bad fds */
                     ready = 0;
                     for (pd = pds, epd = pd + npds; pd < epd; pd++)
                     {
                            pd->out_flags = 0;
                            if ((NULL != pd->fd) && (0 != pd->in_flags))
                            {
                                   bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
                                   if (fcntl(bottom->secret->md.osfd, F_GETFL, 0) == -1)
                                   {
                                          pd->out_flags = PR_POLL_NVAL;
                                          ready++;
                                   }
                            }
                     }
                     PR_ASSERT(ready > 0);
              }
              else _PR_MD_MAP_SELECT_ERROR(err);
       }
       
       return ready;
}  /* _MD_pr_poll */

Here is the call graph for this function:

Definition at line 155 of file bfile.c.

{
       int flags;
       
       PR_ASSERT(_PR_TRI_UNKNOWN == fd->secret->inheritable);
       flags = fcntl(fd->secret->md.osfd, F_GETFD, 0);
       PR_ASSERT(-1 != flags);
       fd->secret->inheritable = (flags & FD_CLOEXEC) ?
              _PR_TRI_FALSE : _PR_TRI_TRUE;
}
PRInt32 _MD_read ( PRFileDesc fd,
void buf,
PRInt32  amount 
)

Definition at line 230 of file bfile.c.

{
    PRInt32 rv, err;
    PRInt32 osfd = fd->secret->md.osfd;

    rv = read( osfd, buf, amount );
    if (rv < 0) {
       err = _MD_ERRNO();
       _PR_MD_MAP_READ_ERROR(err);
    }
    return(rv);
}

Here is the call graph for this function:

char* _MD_read_dir ( struct _MDDir ,
PRIntn   
)

Definition at line 66 of file bfile.c.

{
struct dirent *de;
int err;

       for (;;) {
              /*
               * XXX: readdir() is not MT-safe
               */
              _MD_ERRNO() = 0;
              de = readdir(md->d);

              if (!de) {
                     err = _MD_ERRNO();
                     _PR_MD_MAP_READDIR_ERROR(err);
                     return 0;
              }

              if ((flags & PR_SKIP_DOT) &&
                  (de->d_name[0] == '.') && (de->d_name[1] == 0))
                     continue;

              if ((flags & PR_SKIP_DOT_DOT) &&
                  (de->d_name[0] == '.') && (de->d_name[1] == '.') &&
                  (de->d_name[2] == 0))
                     continue;

              if ((flags & PR_SKIP_HIDDEN) && (de->d_name[1] == '.'))
                     continue;

              break;
       }
       return de->d_name;
}
PRInt32 _MD_recv ( PRFileDesc fd,
void buf,
PRInt32  amount,
PRIntn  flags,
PRIntervalTime  timeout 
)

Definition at line 1572 of file macsockotpt.c.

Here is the call graph for this function:

PRInt32 _MD_recvfrom ( PRFileDesc fd,
void buf,
PRInt32  amount,
PRIntn  flags,
PRNetAddr addr,
PRUint32 addrlen,
PRIntervalTime  timeout 
)

Definition at line 264 of file bnet.c.

{
    PRInt32 osfd = fd->secret->md.osfd;
    PRInt32 rv, err;
    PRThread *me = _PR_MD_CURRENT_THREAD();

    while ((*addrlen = PR_NETADDR_SIZE(addr)),
            ((rv = recvfrom(osfd, buf, amount, flags,
                            (struct sockaddr *) addr,
                            (_PRSockLen_t *)addrlen)) == -1)) {
        err = _MD_ERRNO();

        if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
            if (fd->secret->nonblocking) {
                break;
            }
            if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
                goto done;

        } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
            continue;
        } else {
            break;
        }
    }

    if (rv < 0) {
        _PR_MD_MAP_RECVFROM_ERROR(err);
    }

done:
#ifdef _PR_HAVE_SOCKADDR_LEN
    if (rv != -1) {
        /* ignore the sa_len field of struct sockaddr */
        if (addr) {
            addr->raw.family = ((struct sockaddr *) addr)->sa_family;
        }
    }
#endif /* _PR_HAVE_SOCKADDR_LEN */
    return(rv);
}

Here is the call graph for this function:

PRInt32 _MD_rename ( const char *  from,
const char *  to 
)

Definition at line 460 of file bfile.c.

{
    PRInt32 rv = -1, err;

    /*
    ** This is trying to enforce the semantics of WINDOZE' rename
    ** operation. That means one is not allowed to rename over top
    ** of an existing file. Holding a lock across these two function
    ** and the open function is known to be a bad idea, but ....
    */
    if (NULL != _pr_rename_lock)
        PR_Lock(_pr_rename_lock);
    if (0 == access(to, F_OK))
        PR_SetError(PR_FILE_EXISTS_ERROR, 0);
    else
    {
            rv = rename(from, to);
            if (rv < 0) {
                    err = _MD_ERRNO();
                    _PR_MD_MAP_RENAME_ERROR(err);
            }
    }
    if (NULL != _pr_rename_lock)
        PR_Unlock(_pr_rename_lock);
    return rv; 
}

Here is the call graph for this function:

PRInt32 _MD_rmdir ( const char *  name)

Definition at line 556 of file bfile.c.

{
int rv, err;

        rv = rmdir(name);
        if (rv == -1) {
                        err = _MD_ERRNO();
                        _PR_MD_MAP_RMDIR_ERROR(err);
        }
        return rv;
}
PRInt32 _MD_send ( PRFileDesc fd,
const void buf,
PRInt32  amount,
PRIntn  flags,
PRIntervalTime  timeout 
)

Definition at line 1579 of file macsockotpt.c.

{
    return (SendReceiveStream(fd, (void *)buf, amount, flags, timeout, kSTREAM_SEND));
}

Here is the call graph for this function:

PRInt32 _MD_sendto ( PRFileDesc fd,
const void buf,
PRInt32  amount,
PRIntn  flags,
const PRNetAddr addr,
PRUint32  addrlen,
PRIntervalTime  timeout 
)

Definition at line 384 of file bnet.c.

{
    PRInt32 osfd = fd->secret->md.osfd;
    PRInt32 rv, err;
    PRThread *me = _PR_MD_CURRENT_THREAD();
#ifdef _PR_HAVE_SOCKADDR_LEN
    PRNetAddr addrCopy;

    addrCopy = *addr;
    ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
    ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;

    while ((rv = sendto(osfd, buf, amount, flags,
                        (struct sockaddr *) &addrCopy, addrlen)) == -1) {
#else
    while ((rv = sendto(osfd, buf, amount, flags,
                        (struct sockaddr *) addr, addrlen)) == -1) {
#endif
        err = _MD_ERRNO();

        if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
            if (fd->secret->nonblocking) {
                break;
            }

#ifdef BONE_VERSION
            if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))< 0)
                goto done;
#endif
        } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
            continue;

        } else {
            break;
        }
    }

    if (rv < 0) {
        _PR_MD_MAP_SENDTO_ERROR(err);
    }

#ifdef BONE_VERSION
done:
#endif
    return(rv);
}

Here is the call graph for this function:

PRStatus _MD_set_fd_inheritable ( PRFileDesc fd,
PRBool  inheritable 
)

Definition at line 126 of file bfile.c.

{
        int rv;
       
        rv = fcntl(fd->secret->md.osfd, F_SETFD, inheritable ? 0 : FD_CLOEXEC);
        if (-1 == rv) {
                PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
                return PR_FAILURE;
        }
        return PR_SUCCESS;
}
PRStatus _MD_setsockopt ( PRFileDesc fd,
PRInt32  level,
PRInt32  optname,
const char *  optval,
PRInt32  optlen 
)

Definition at line 812 of file bnet.c.

{
    PRInt32 rv, err;

    rv = setsockopt(fd->secret->md.osfd, level, optname, optval, optlen);
    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_SETSOCKOPT_ERROR(err);
    }
    return rv==0?PR_SUCCESS:PR_FAILURE;
}

Here is the call graph for this function:

PRInt32 _MD_shutdown ( PRFileDesc fd,
PRIntn  how 
)

Definition at line 708 of file bnet.c.

{
    PRInt32 rv, err;

#ifndef BONE_VERSION
    if (how == PR_SHUTDOWN_SEND)
        fd->secret->md.sock_state = BE_SOCK_SHUTDOWN_WRITE;
    else if (how == PR_SHUTDOWN_RCV)
        fd->secret->md.sock_state = BE_SOCK_SHUTDOWN_READ;
    else if (how == PR_SHUTDOWN_BOTH) {
        fd->secret->md.sock_state = (BE_SOCK_SHUTDOWN_WRITE | BE_SOCK_SHUTDOWN_READ);
    }

    return 0;
#else /* BONE_VERSION */
    rv = shutdown(fd->secret->md.osfd, how);
    if (rv < 0) {
        err = _MD_ERRNO();
        _PR_MD_MAP_SHUTDOWN_ERROR(err);
    }
    return(rv);
#endif
}

Here is the call graph for this function:

PRInt32 _MD_socket ( int  af,
int  type,
int  flags 
)

Definition at line 834 of file bnet.c.

{
    PRInt32 osfd, err;

    osfd = socket( af, type, 0 );

    if( -1 == osfd ) {

        err = _MD_ERRNO();
        _PR_MD_MAP_SOCKET_ERROR( err );
    }

    return( osfd );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 866 of file bnet.c.

{
#ifdef BONE_VERSION
    PRInt32 result;

    if (ioctl(fd->secret->md.osfd, FIONREAD, &result) < 0) {
        _PR_MD_MAP_SOCKETAVAILABLE_ERROR(_MD_ERRNO());
        return -1;
    }
    return result;
#else
    return PR_NOT_IMPLEMENTED_ERROR;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 494 of file unix.c.

{
    PRInt64 result;
    LL_I2L(result, _MD_socketavailable(fd));
    return result;
}  /* _MD_socketavailable64 */

Here is the call graph for this function:

PRInt32 _MD_socketpair ( int  af,
int  type,
int  flags,
PRInt32 osfd 
)

Definition at line 733 of file bnet.c.

Here is the call graph for this function:

Definition at line 230 of file macthr.c.

{
       gPrimaryThread = _PR_MD_CURRENT_THREAD();

       gTimeManagerTaskDoesWUP = RunningOnOSX();

       if ( !gTimerCallbackUPP )
              gTimerCallbackUPP = NewTimerUPP(TimerCallback);

       //     Fill in the Time Manager queue element
       
       gTimeManagerTaskElem.tmAddr = (TimerUPP)gTimerCallbackUPP;
       gTimeManagerTaskElem.tmCount = 0;
       gTimeManagerTaskElem.tmWakeUp = 0;
       gTimeManagerTaskElem.tmReserved = 0;

       //     Make sure that our time manager task is ready to go.
       InsTime((QElemPtr)&gTimeManagerTaskElem);
       
       PrimeTime((QElemPtr)&gTimeManagerTaskElem, kMacTimerInMiliSecs);
}

Here is the call graph for this function:

Definition at line 252 of file macthr.c.

{
       if (gTimeManagerTaskElem.tmAddr != NULL) {
              RmvTime((QElemPtr)&gTimeManagerTaskElem);
              gTimeManagerTaskElem.tmAddr = NULL;
       }
}

Here is the caller graph for this function:

Definition at line 993 of file macio.c.

{
       return (_MD_LockFile(fd));
}

Here is the call graph for this function:

Definition at line 2190 of file unix.c.

{
    sigprocmask(SIG_UNBLOCK, &timer_set, 0);
}

Definition at line 3217 of file unix.c.

{
#if defined(NTO)
    /* Neutrino does not support the SO_ERROR socket option */
    PRInt32      rv;
    PRNetAddr    addr;
    _PRSockLen_t addrlen = sizeof(addr);

    /* Test to see if we are using the Tiny TCP/IP Stack or the Full one. */
    struct statvfs superblock;
    rv = fstatvfs(osfd, &superblock);
    if (rv == 0) {
        if (strcmp(superblock.f_basetype, "ttcpip") == 0) {
            /* Using the Tiny Stack! */
            rv = getpeername(osfd, (struct sockaddr *) &addr,
                    (_PRSockLen_t *) &addrlen);
            if (rv == -1) {
                int errno_copy = errno;    /* make a copy so I don't
                                            * accidentally reset */

                if (errno_copy == ENOTCONN) {
                    struct stat StatInfo;
                    rv = fstat(osfd, &StatInfo);
                    if (rv == 0) {
                        time_t current_time = time(NULL);

                        /*
                         * this is a real hack, can't explain why it
                         * works it just does
                         */
                        if (abs(current_time - StatInfo.st_atime) < 5) {
                            return ECONNREFUSED;
                        } else {
                            return ETIMEDOUT;
                        }
                    } else {
                        return ECONNREFUSED;
                    }
                } else {
                    return errno_copy;
                }
            } else {
                /* No Error */
                return 0;
            }
        } else {
            /* Have the FULL Stack which supports SO_ERROR */
            /* Hasn't been written yet, never been tested! */
            /* Jerry.Kirk@Nexwarecorp.com */

            int err;
            _PRSockLen_t optlen = sizeof(err);

            if (getsockopt(osfd, SOL_SOCKET, SO_ERROR,
                    (char *) &err, &optlen) == -1) {
                return errno;
            } else {
                return err;
            }        
        }
    } else {
        return ECONNREFUSED;
    }  
#elif defined(NCR) || defined(UNIXWARE) || defined(SNI) || defined(NEC)
    /*
     * getsockopt() fails with EPIPE, so use getmsg() instead.
     */

    int rv;
    int flags = 0;
    rv = getmsg(osfd, NULL, NULL, &flags);
    PR_ASSERT(-1 == rv || 0 == rv);
    if (-1 == rv && errno != EAGAIN && errno != EWOULDBLOCK) {
        return errno;
    }
    return 0;  /* no error */
#else
    int err;
    _PRSockLen_t optlen = sizeof(err);
    if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &optlen) == -1) {
        return errno;
    } else {
        return err;
    }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 139 of file unix.c.

{
    PR_INIT_CLIST(&(cpu->md.md_unix.ioQ));
    cpu->md.md_unix.ioq_max_osfd = -1;
    cpu->md.md_unix.ioq_timeout = PR_INTERVAL_NO_TIMEOUT;
}

Here is the caller graph for this function:

Definition at line 998 of file macio.c.

{
       OSErr                err;
       FCBPBRec             fcbpb;
       HFileParam           fpb;
       Str255               pascalName;
       
       fcbpb.ioNamePtr = pascalName;
       fcbpb.ioVRefNum = 0;
       fcbpb.ioRefNum = fd;
       fcbpb.ioFCBIndx = 0;
       
       err = PBGetFCBInfoSync(&fcbpb);
       if (err != noErr)
              goto ErrorExit;
       
       fpb.ioCompletion = NULL;
       fpb.ioNamePtr = pascalName;
       fpb.ioVRefNum = fcbpb.ioFCBVRefNum;
       fpb.ioDirID = fcbpb.ioFCBParID;

       err = PBHRstFLockSync((HParmBlkPtr)&fpb);
       if (err != noErr)
              goto ErrorExit;
       
       return PR_SUCCESS;
       
ErrorExit:
       _PR_MD_CURRENT_THREAD()->md.osErrCode = err;
       _MD_SetError(err);
    return PR_FAILURE;
}

Here is the call graph for this function:

PRStatus _MD_WaitUnixProcess ( struct PRProcess process,
PRInt32 exitCode 
)

Definition at line 907 of file uxproces.c.

{
    pr_PidRecord *pRec;
    PRStatus retVal = PR_SUCCESS;
    PRBool interrupted = PR_FALSE;

    PR_Lock(pr_wp.ml);
    pRec = FindPidTable(process->md.pid);
    if (NULL == pRec) {
       pRec = PR_NEW(pr_PidRecord);
       if (NULL == pRec) {
           PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
           retVal = PR_FAILURE;
           goto done;
       }
       pRec->pid = process->md.pid;
       pRec->state = _PR_PID_WAITING;
       pRec->reapedCV = PR_NewCondVar(pr_wp.ml);
       if (NULL == pRec->reapedCV) {
           PR_DELETE(pRec);
           retVal = PR_FAILURE;
           goto done;
       }
       InsertPidTable(pRec);
       while (!interrupted && _PR_PID_REAPED != pRec->state) {
           if (PR_WaitCondVar(pRec->reapedCV,
                  PR_INTERVAL_NO_TIMEOUT) == PR_FAILURE
                  && PR_GetError() == PR_PENDING_INTERRUPT_ERROR) {
              interrupted = PR_TRUE;
            }
       }
       if (_PR_PID_REAPED == pRec->state) {
            if (exitCode) {
                *exitCode = pRec->exitStatus;
            }
       } else {
           PR_ASSERT(interrupted);
           retVal = PR_FAILURE;
       }
       DeletePidTable(pRec);
       PR_DestroyCondVar(pRec->reapedCV);
       PR_DELETE(pRec);
    } else {
       PR_ASSERT(_PR_PID_REAPED == pRec->state);
       PR_ASSERT(NULL == pRec->reapedCV);
       DeletePidTable(pRec);
        if (exitCode) {
            *exitCode = pRec->exitStatus;
        }
       PR_DELETE(pRec);
    }
    PR_DELETE(process);

done:
    PR_Unlock(pr_wp.ml);
    return retVal;
}  /* _MD_WaitUnixProcess */

Here is the call graph for this function:

Definition at line 1993 of file unix.c.

{
    PRInt32 rv, data;

    data = 0;
    rv = write(_pr_md_pipefd[1], &data, 1);

    while ((rv < 0) && (errno == EAGAIN)) {
        /*
         * pipe full, read all data in pipe to empty it
         */
        while ((rv =
            read(_pr_md_pipefd[0], _pr_md_pipebuf, PIPE_BUF))
            == PIPE_BUF) {
        }
        PR_ASSERT((rv > 0) ||
            ((rv == -1) && (errno == EAGAIN)));
        rv = write(_pr_md_pipefd[1], &data, 1);
    }
}

Here is the caller graph for this function:

PRInt32 _MD_write ( PRFileDesc fd,
const void buf,
PRInt32  amount 
)

Definition at line 244 of file bfile.c.

{
    PRInt32 rv, err;
    PRInt32 osfd = fd->secret->md.osfd;

    rv = write( osfd, buf, amount );

    if( rv < 0 ) {

       err = _MD_ERRNO();
       _PR_MD_MAP_WRITE_ERROR(err);
    }
    return( rv );
}

Here is the call graph for this function:

PRInt32 _MD_writev ( PRFileDesc fd,
const struct PRIOVec iov,
PRInt32  iov_size,
PRIntervalTime  timeout 
)

Definition at line 1712 of file macsockotpt.c.

{
#pragma unused (fd, iov, iov_size, timeout)

    PR_ASSERT(0);
    _PR_MD_CURRENT_THREAD()->md.osErrCode = unimpErr;
    return -1;
}

Here is the caller graph for this function:

void _PR_Unblock_IO_Wait ( struct PRThread thr)

Definition at line 3181 of file unix.c.

{
    int pri = thr->priority;
    _PRCPU *cpu = thr->cpu;
 
    /*
     * GLOBAL threads wakeup periodically to check for interrupt
     */
    if (_PR_IS_NATIVE_THREAD(thr)) {
        _PR_THREAD_UNLOCK(thr); 
        return;
    }

    PR_ASSERT(thr->flags & (_PR_ON_SLEEPQ | _PR_ON_PAUSEQ));
    _PR_SLEEPQ_LOCK(cpu);
    _PR_DEL_SLEEPQ(thr, PR_TRUE);
    _PR_SLEEPQ_UNLOCK(cpu);

    PR_ASSERT(!(thr->flags & _PR_IDLE_THREAD));
    thr->state = _PR_RUNNABLE;
    _PR_RUNQ_LOCK(cpu);
    _PR_ADD_RUNQ(thr, cpu, pri);
    _PR_RUNQ_UNLOCK(cpu);
    _PR_THREAD_UNLOCK(thr);
    _PR_MD_WAKEUP_WAITER(thr);
}

Definition at line 75 of file beos.c.

{
       struct sigaction sigact;
       int rv;

       sigemptyset(&timer_set);

       sigact.sa_handler = SIG_IGN;
       sigemptyset(&sigact.sa_mask);
       sigact.sa_flags = 0;
       rv = sigaction(SIGPIPE, &sigact, 0);
       PR_ASSERT(0 == rv);

       _pr_rename_lock = PR_NewLock();
       PR_ASSERT(NULL != _pr_rename_lock);
       _pr_Xfe_mon = PR_NewMonitor();
       PR_ASSERT(NULL != _pr_Xfe_mon);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 _PR_WaitForMultipleFDs ( _PRUnixPollDesc unixpds,
PRInt32  pdcnt,
PRIntervalTime  timeout 
)

Definition at line 3028 of file unix.c.

{
    PRPollQueue pq;
    PRIntn is;
    PRInt32 rv;
    _PRCPU *io_cpu;
    _PRUnixPollDesc *unixpd, *eunixpd;
    PRThread *me = _PR_MD_CURRENT_THREAD();

    PR_ASSERT(!(me->flags & _PR_IDLE_THREAD));

    if (_PR_PENDING_INTERRUPT(me)) {
        me->flags &= ~_PR_INTERRUPT;
        PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
        return -1;
    }

    pq.pds = unixpds;
    pq.npds = pdcnt;

    _PR_INTSOFF(is);
    _PR_MD_IOQ_LOCK();
    _PR_THREAD_LOCK(me);

    pq.thr = me;
    io_cpu = me->cpu;
    pq.on_ioq = PR_TRUE;
    pq.timeout = timeout;
    _PR_ADD_TO_IOQ(pq, me->cpu);

#if !defined(_PR_USE_POLL)
    eunixpd = unixpds + pdcnt;
    for (unixpd = unixpds; unixpd < eunixpd; unixpd++) {
        PRInt32 osfd = unixpd->osfd;
        if (unixpd->in_flags & _PR_UNIX_POLL_READ) {
            FD_SET(osfd, &_PR_FD_READ_SET(me->cpu));
            _PR_FD_READ_CNT(me->cpu)[osfd]++;
        }
        if (unixpd->in_flags & _PR_UNIX_POLL_WRITE) {
            FD_SET(osfd, &_PR_FD_WRITE_SET(me->cpu));
            (_PR_FD_WRITE_CNT(me->cpu))[osfd]++;
        }
        if (unixpd->in_flags & _PR_UNIX_POLL_EXCEPT) {
            FD_SET(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
            (_PR_FD_EXCEPTION_CNT(me->cpu))[osfd]++;
        }
        if (osfd > _PR_IOQ_MAX_OSFD(me->cpu)) {
            _PR_IOQ_MAX_OSFD(me->cpu) = osfd;
        }
    }
#endif  /* !defined(_PR_USE_POLL) */

    if (_PR_IOQ_TIMEOUT(me->cpu) > timeout) {
        _PR_IOQ_TIMEOUT(me->cpu) = timeout;
    }

    _PR_IOQ_OSFD_CNT(me->cpu) += pdcnt;
        
    _PR_SLEEPQ_LOCK(me->cpu);
    _PR_ADD_SLEEPQ(me, timeout);
    me->state = _PR_IO_WAIT;
    me->io_pending = PR_TRUE;
    me->io_suspended = PR_FALSE;
    _PR_SLEEPQ_UNLOCK(me->cpu);
    _PR_THREAD_UNLOCK(me);
    _PR_MD_IOQ_UNLOCK();

    _PR_MD_WAIT(me, timeout);

    me->io_pending = PR_FALSE;
    me->io_suspended = PR_FALSE;

    /*
     * This thread should run on the same cpu on which it was blocked; when 
     * the IO request times out the fd sets and fd counts for the
     * cpu are updated below.
     */
    PR_ASSERT(me->cpu == io_cpu);

    /*
    ** If we timed out the pollq might still be on the ioq. Remove it
    ** before continuing.
    */
    if (pq.on_ioq) {
        _PR_MD_IOQ_LOCK();
        /*
         * Need to check pq.on_ioq again
         */
        if (pq.on_ioq) {
            PR_REMOVE_LINK(&pq.links);
#ifndef _PR_USE_POLL
            eunixpd = unixpds + pdcnt;
            for (unixpd = unixpds; unixpd < eunixpd; unixpd++) {
                PRInt32 osfd = unixpd->osfd;
                PRInt16 in_flags = unixpd->in_flags;

                if (in_flags & _PR_UNIX_POLL_READ) {
                    if (--(_PR_FD_READ_CNT(me->cpu))[osfd] == 0)
                        FD_CLR(osfd, &_PR_FD_READ_SET(me->cpu));
                }
                if (in_flags & _PR_UNIX_POLL_WRITE) {
                    if (--(_PR_FD_WRITE_CNT(me->cpu))[osfd] == 0)
                        FD_CLR(osfd, &_PR_FD_WRITE_SET(me->cpu));
                }
                if (in_flags & _PR_UNIX_POLL_EXCEPT) {
                    if (--(_PR_FD_EXCEPTION_CNT(me->cpu))[osfd] == 0)
                        FD_CLR(osfd, &_PR_FD_EXCEPTION_SET(me->cpu));
                }
            }
#endif  /* _PR_USE_POLL */
            PR_ASSERT(pq.npds == pdcnt);
            _PR_IOQ_OSFD_CNT(me->cpu) -= pdcnt;
            PR_ASSERT(_PR_IOQ_OSFD_CNT(me->cpu) >= 0);
        }
        _PR_MD_IOQ_UNLOCK();
    }
    /* XXX Should we use _PR_FAST_INTSON or _PR_INTSON? */
    if (1 == pdcnt) {
        _PR_FAST_INTSON(is);
    } else {
        _PR_INTSON(is);
    }

    if (_PR_PENDING_INTERRUPT(me)) {
        me->flags &= ~_PR_INTERRUPT;
        PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
        return -1;
    }

    rv = 0;
    if (pq.on_ioq == PR_FALSE) {
        /* Count the number of ready descriptors */
        while (--pdcnt >= 0) {
            if (unixpds->out_flags != 0) {
                rv++;
            }
            unixpds++;
        }
    }

    return rv;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 2271 of file unix.c.