Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Enumerations | Functions | Variables
_macos.h File Reference
#include "prinit.h"
#include "prio.h"
#include "prlong.h"
#include "prlock.h"
#include "prcvar.h"
#include "prsem.h"
#include "prthread.h"
#include "prtime.h"
#include "prproces.h"
#include "macstdlibextras.h"
#include <stddef.h>
#include <setjmp.h>
#include <Errors.h>
#include <OpenTransport.h>
#include <DriverServices.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  _MDProcess
struct  _MDThread
struct  _MDThreadStack
struct  _MDLock
struct  _MDCVar
struct  _MDSemaphore
struct  _MDSegment
struct  _MDCPU
struct  _MDSocketCallerInfo
struct  _MDFileDesc
struct  _MDDir
struct  _MDFileMap

Defines

#define PR_DLL_SUFFIX   ""
#define _PR_LOCAL_THREADS_ONLY
#define _PR_NO_PREEMPT   1
#define _PR_HAVE_ATOMIC_OPS   1
#define _PR_HAVE_PEEK_BUFFER
#define _PR_PEEK_BUFFER_MAX   (16 * 1024)
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd)   1
#define _MD_EARLY_INIT   _MD_EarlyInit
#define _MD_FINAL_INIT   _MD_FinalInit
#define _MD_GET_INTSOFF()   (_pr_intsOff)
#define _MD_INTSOFF(_is)
#define _MD_SET_INTSOFF(_val)   (_pr_intsOff = _val)
#define _MD_START_INTERRUPTS   _MD_StartInterrupts
#define _MD_STOP_INTERRUPTS   _MD_StopInterrupts
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_PAUSE_CPU   _MD_PauseCPU
#define _MD_CLEANUP_BEFORE_EXIT()
#define _MD_EXIT(status)   exit(status)
#define _MD_INIT_CPUS()
#define _MD_INIT_RUNNING_CPU(cpu)   _MD_InitRunningCPU(cpu)
#define _MD_CREATE_PROCESS   _MD_CreateProcess
#define _MD_DETACH_PROCESS   _MD_DetachProcess
#define _MD_WAIT_PROCESS   _MD_WaitProcess
#define _MD_KILL_PROCESS   _MD_KillProcess
#define _MD_INIT_SEGS()
#define _MD_INIT_STACK   _MD_InitStack
#define _MD_CLEAR_STACK   _MD_ClearStack
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock)   (PR_SUCCESS)
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_GET_PC(_t)   (*((PRUint32 *)((_t)->md.jb) + 6))
#define _MD_GET_SP(_t)   (*((PRUint32 *)((_t)->md.jb) + 12))
#define INIT_STACKPTR(stackTop)   ((unsigned char*)stackTop - 4)
#define PR_NUM_GCREGS   13
#define _MD_DEFAULT_STACK_SIZE   (58 * 1024)
#define _MD_MINIMUM_STACK_SIZE   (58 * 1024)
#define _MD_INIT_THREAD   _MD_InitThread
#define _MD_CLEAN_THREAD(_thread)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, _status)
#define _MD_SWITCH_CONTEXT(_thread)
#define _MD_RESTORE_CONTEXT(_newThread)
#define _MD_ERRNO()   _MD_CURRENT_THREAD()->md.osErrCode
#define _MD_WAIT   _MD_wait
#define _MD_CREATE_THREAD(a, b, c, d, e, f)   (PR_SUCCESS)
#define _MD_WAKEUP_WAITER(a)
#define _MD_SET_PRIORITY(a, b)
#define _PR_MD_WRITE_SYNC   _MD_WRITE_SYNC
#define PR_DIRECTORY_SEPARATOR   '/'
#define PR_DIRECTORY_SEPARATOR_STR   "/"
#define PR_PATH_SEPARATOR   ':'
#define PR_PATH_SEPARATOR_STR   ":"
#define _MD_INIT_IO()
#define _MD_OPEN   _MD_Open
#define _MD_OPEN_FILE   _MD_Open
#define _MD_CLOSE_FILE   FSClose
#define _MD_READ(fd, buf, amount)   ReadWriteProc(fd,buf,amount,READ_ASYNC)
#define _MD_WRITE(fd, buf, amount)   ReadWriteProc(fd,buf,amount,WRITE_ASYNC)
#define _MD_WRITE_SYNC(fd, buf, amount)   WriteSyncProc(fd,buf,amount)
#define _MD_GET_FILE_ERROR()   _PR_MD_CURRENT_THREAD()->md.osErrCode
#define _MD_LSEEK   _MD_LSeek
#define _MD_FSYNC   _MD_FSync
#define _MD_LSEEK64(a, b, c)   LL_ZERO
#define _MD_GETOPENFILEINFO64(fd, info)   -1
#define _MD_GETFILEINFO64(fd, info)   -1
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_RENAME   _MD_Rename
#define _MD_ACCESS   _MD_Access
#define _MD_GETFILEINFO   _MD_GetFileInfo
#define _MD_GETOPENFILEINFO   _MD_GetOpenFileInfo
#define _MD_STAT   _MD_Stat
#define _MD_DELETE   _MD_Delete
#define _MD_LOCKFILE   _MD_LockFile
#define _MD_TLOCKFILE   _MD_TLockFile
#define _MD_UNLOCKFILE   _MD_UnlockFile
#define _MD_OPEN_DIR   _MD_OpenDir
#define _MD_READ_DIR   _MD_ReadDir
#define _MD_CLOSE_DIR   _MD_CloseDir
#define _MD_MKDIR   _MD_MkDir
#define _MD_MAKE_DIR   _MD_MkDir
#define _MD_RMDIR   _MD_Delete
#define _MD_PIPEAVAILABLE(fd)   -1
#define _MD_SOCKET   _MD_socket
#define _MD_BIND   _MD_bind
#define _MD_LISTEN   _MD_listen
#define _MD_GETSOCKNAME   _MD_getsockname
#define _MD_GETSOCKOPT   _MD_getsockopt
#define _MD_SETSOCKOPT   _MD_setsockopt
#define _MD_SOCKETAVAILABLE   _MD_socketavailable
#define _MD_ACCEPT   _MD_accept
#define _MD_CONNECT   _MD_connect
#define _MD_SEND   _MD_send
#define _MD_RECV   _MD_recv
#define _MD_CLOSE_SOCKET   _MD_closesocket
#define _MD_SENDTO   _MD_sendto
#define _MD_RECVFROM   _MD_recvfrom
#define _MD_PR_POLL   _MD_poll
#define _MD_INIT_FILEDESC   _MD_initfiledesc
#define _MD_FREE_FILEDESC   _MD_freefiledesc
#define _MD_MAKE_NONBLOCK   _MD_makenonblock
#define _MD_INIT_FD_INHERITABLE   _MD_initfdinheritable
#define _MD_QUERY_FD_INHERITABLE   _MD_queryfdinheritable
#define _MD_GET_SOCKET_ERROR()   _PR_MD_CURRENT_THREAD()->md.osErrCode
#define _PR_MD_MAP_SELECT_ERROR(x)   (x)
#define _MD_GETHOSTNAME   _MD_gethostname
#define _PR_GET_HOST_ADDR_AS_NAME
#define _MD_WRITEV   _MD_writev
#define _MD_SHUTDOWN   _MD_shutdown
#define _MD_GETPEERNAME   _MD_getpeername
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT   _MD_AllocSegment
#define _MD_FREE_SEGMENT   _MD_FreeSegment
#define _MD_GET_INTERVAL   _MD_GetInterval
#define _MD_INTERVAL_PER_SEC()   PR_MSEC_PER_SEC
#define _MD_INTERVAL_INIT()
#define _MD_GET_ENV   _MD_GetEnv
#define _MD_PUT_ENV   _MD_PutEnv
#define GCPTR
#define CALLBACK
#define MAX_NON_PRIMARY_TIME_SLICES   6
#define EACCES   13
#define ENOENT   -43
#define _OS_INVALID_FD_VALUE   -1
#define STDERR_FILENO   2
#define PATH_SEPARATOR   ':'
#define PATH_SEPARATOR_STR   ":"
#define DIRECTORY_SEPARATOR   '/'
#define DIRECTORY_SEPARATOR_STR   "/"
#define UNIX_THIS_DIRECTORY_STR   "./"
#define UNIX_PARENT_DIRECTORY_STR   "../"
#define getenv   PR_GetEnv
#define putenv   _MD_PutEnv
#define dprintTrace   ";dprintf;doTrace"
#define dprintNoTrace   ";dprintf"
#define _PR_SI_SYSNAME   "MacOS"
#define _PR_SI_ARCHITECTURE   "PowerPC"
#define _MD_CREATE_FILE_MAP   _MD_CreateFileMap
#define _MD_GET_MEM_MAP_ALIGNMENT   _MD_GetMemMapAlignment
#define _MD_MEM_MAP   _MD_MemMap
#define _MD_MEM_UNMAP   _MD_MemUnmap
#define _MD_CLOSE_FILE_MAP   _MD_CloseFileMap
#define MAC_CRITICAL_REGIONS   TARGET_CARBON
#define INIT_CRITICAL_REGION()
#define TERM_CRITICAL_REGION()
#define ENTER_CRITICAL_REGION()
#define LEAVE_CRITICAL_REGION()
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val)   OTAtomicAdd32(1, (SInt32 *)val)
#define _MD_ATOMIC_ADD(ptr, val)   OTAtomicAdd32(val, (SInt32 *)ptr)
#define _MD_ATOMIC_DECREMENT(val)   OTAtomicAdd32(-1, (SInt32 *)val)
#define _MD_ATOMIC_SET(val, newval)   _MD_AtomicSet(val, newval)

Typedefs

typedef struct _MDSocketCallerInfo _MDSocketCallerInfo
typedef enum IOOperation IOOperation
typedef int(* FARPROC )()

Enumerations

enum  IOOperation { READ_ASYNC, WRITE_ASYNC }

Functions

struct PRProcess_MD_CreateProcess (const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr)
PRStatus _MD_DetachProcess (PRProcess *process)
PRStatus _MD_WaitProcess (PRProcess *process, PRInt32 *exitCode)
PRStatus _MD_KillProcess (PRProcess *process)
 NSPR_API (PRThread *) PR_GetPrimaryThread()
PRStatus _MD_InitThread (PRThread *thread)
PRStatus _MD_wait (PRThread *thread, PRIntervalTime timeout)
PRInt32 _PR_MD_WRITE_SYNC (PRFileDesc *fd, void *buf, PRInt32 amount)
PRStatus _MD_LockFile (PRInt32 osfd)
PRStatus _MD_TLockFile (PRInt32 osfd)
PRStatus _MD_UnlockFile (PRInt32 osfd)
PRStatus _MD_OpenDir (struct _MDDir *md, const char *name)
char * _MD_ReadDir (struct _MDDir *md, PRIntn flags)
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_gethostname (char *name, int namelen)
char * _MD_GetEnv (const char *name)
int _MD_PutEnv (const char *variableCopy)
char * PR_GetDLLSearchPath (void)
void MapFullToPartialMacFile (char *)
char * MapPartialToFullMacFile (const char *)
void ResetTimer (void)
void PR_PeriodicIdle (void)
void ActivateTimer (void)
void DeactivateTimer (void)
void PR_InitMemory (void)
struct hostentgethostbyaddr (const void *addr, int addrlen, int type)
short GetVolumeRefNumFromName (const char *)
FILE_OS_FOPEN (const char *filename, const char *mode)
void dprintf (const char *format,...)
PRStatus _MD_CreateFileMap (struct PRFileMap *fmap, PRInt64 size)
PRInt32 _MD_GetMemMapAlignment (void)
void_MD_MemMap (struct PRFileMap *fmap, PRInt64 offset, PRUint32 len)
PRStatus _MD_MemUnmap (void *addr, PRUint32 size)
PRStatus _MD_CloseFileMap (struct PRFileMap *fmap)
void SetLogFileTypeCreator (const char *logFile)
int _MD_mac_get_nonblocking_connect_error (PRFileDesc *fd)
void InitIdleSemaphore ()
void TermIdleSemaphore ()
void WaitOnIdleSemaphore ()
void SignalIdleSemaphore ()
PRInt32 _MD_AtomicSet (PRInt32 *val, PRInt32 newval)

Variables

long gTimeSlicesOnNonPrimaryThread
struct PRThreadgPrimaryThread

Class Documentation

struct _MDProcess

Definition at line 141 of file _beos.h.

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

Definition at line 165 of file _aix.h.

Class Members
PRIntn cxByteCount
PRUint32 magic
PRInt8 notused
char * stackTop
struct _MDLock

Definition at line 169 of file _aix.h.

Class Members
usptr_t * arena
int32 benaphoreCount
ulock_t lock
PRUint32 magic
PRUint32 mutex
CRITICAL_SECTION mutex
HMTX mutex
PRInt8 notused
sem_id semaphoreID
struct _MDCVar

Definition at line 177 of file _aix.h.

Collaboration diagram for _MDCVar:
Class Members
int16 count
PRUint32 magic
ulock_t mdcvar_lock
PRInt8 notused
PRIntn nwait
sem_id sem1
sem_id sem2
PRUint32 unused
struct PRThread * waitHead
struct PRThread * waitTail
struct _MDSemaphore

Definition at line 173 of file _aix.h.

Class Members
PRInt8 notused
HEV sem
HANDLE sem
usema_t * sem
sem_id sid
PRInt32 unused
struct _MDSegment

Definition at line 181 of file _aix.h.

Class Members
PRUint32 magic
PRInt8 notused
struct _MDCPU

Definition at line 221 of file _aix.h.

Collaboration diagram for _MDCPU:
Class Members
PRInt16 fd_exception_cnt
fd_set fd_exception_set
PRInt16 fd_read_cnt
fd_set fd_read_set
PRInt16 fd_write_cnt
fd_set fd_write_set
PRInt32 id
PRCList ioQ
PRInt32 ioq_max_osfd
PRUint32 ioq_timeout
AbsoluteTime lastThreadSwitch
AbsoluteTime lastWakeUpProcess
PRInt32 suspending_id
PRBool trackScheduling
int unused
int8 unused
struct _MDSocketCallerInfo

Definition at line 117 of file _macos.h.

Collaboration diagram for _MDSocketCallerInfo:
Class Members
void * cookie
PRThread * thread
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 _MDFileMap

Definition at line 183 of file _beos.h.

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

Define Documentation

Definition at line 467 of file _macos.h.

Definition at line 400 of file _macos.h.

Definition at line 524 of file _macos.h.

#define _MD_ATOMIC_ADD (   ptr,
  val 
)    OTAtomicAdd32(val, (SInt32 *)ptr)

Definition at line 718 of file _macos.h.

#define _MD_ATOMIC_DECREMENT (   val)    OTAtomicAdd32(-1, (SInt32 *)val)

Definition at line 719 of file _macos.h.

#define _MD_ATOMIC_INCREMENT (   val)    OTAtomicAdd32(1, (SInt32 *)val)

Definition at line 717 of file _macos.h.

Definition at line 720 of file _macos.h.

Definition at line 456 of file _macos.h.

Definition at line 171 of file _macos.h.

#define _MD_CLEAN_THREAD (   _thread)
Value:
PR_BEGIN_MACRO				      					\
	PR_DestroyCondVar(_thread->md.asyncIOCVar);                   \
       PR_DestroyLock(_thread->md.asyncIOLock);                \
    PR_END_MACRO

Definition at line 260 of file _macos.h.

Definition at line 181 of file _macos.h.

Definition at line 217 of file _macos.h.

Definition at line 426 of file _macos.h.

#define _MD_CLOSE_FILE   FSClose

Definition at line 379 of file _macos.h.

Definition at line 660 of file _macos.h.

Definition at line 471 of file _macos.h.

Definition at line 468 of file _macos.h.

Definition at line 647 of file _macos.h.

Definition at line 195 of file _macos.h.

#define _MD_CREATE_THREAD (   a,
  b,
  c,
  d,
  e,
  f 
)    (PR_SUCCESS)

Definition at line 346 of file _macos.h.

#define _MD_DEFAULT_STACK_SIZE   (58 * 1024)

Definition at line 248 of file _macos.h.

Definition at line 407 of file _macos.h.

Definition at line 198 of file _macos.h.

Definition at line 173 of file _macos.h.

Definition at line 145 of file _macos.h.

Definition at line 174 of file _macos.h.

#define _MD_ERRNO ( )    _MD_CURRENT_THREAD()->md.osErrCode

Definition at line 337 of file _macos.h.

#define _MD_EXIT (   status)    exit(status)

Definition at line 182 of file _macos.h.

Definition at line 146 of file _macos.h.

Definition at line 476 of file _macos.h.

Definition at line 225 of file _macos.h.

Definition at line 525 of file _macos.h.

Definition at line 385 of file _macos.h.

Definition at line 540 of file _macos.h.

#define _MD_GET_FILE_ERROR ( )    _PR_MD_CURRENT_THREAD()->md.osErrCode

Definition at line 383 of file _macos.h.

Definition at line 531 of file _macos.h.

Definition at line 152 of file _macos.h.

Definition at line 650 of file _macos.h.

#define _MD_GET_PC (   _t)    (*((PRUint32 *)((_t)->md.jb) + 6))

Definition at line 242 of file _macos.h.

Definition at line 481 of file _macos.h.

#define _MD_GET_SP (   _t)    (*((PRUint32 *)((_t)->md.jb) + 12))

Definition at line 243 of file _macos.h.

Definition at line 402 of file _macos.h.

#define _MD_GETFILEINFO64 (   fd,
  info 
)    -1

Definition at line 390 of file _macos.h.

Definition at line 488 of file _macos.h.

Definition at line 403 of file _macos.h.

#define _MD_GETOPENFILEINFO64 (   fd,
  info 
)    -1

Definition at line 389 of file _macos.h.

Definition at line 496 of file _macos.h.

Definition at line 458 of file _macos.h.

Definition at line 461 of file _macos.h.

Definition at line 716 of file _macos.h.

#define _MD_INIT_CONTEXT (   _thread,
  _sp,
  _main,
  _status 
)
Value:
PR_BEGIN_MACRO                                                               \
       unsigned char *sp;                                                           \
	long **jb = (_thread)->md.jb;                                 \
    *((PRBool *)_status) = PR_TRUE;                            \
       (void) setjmp(jb);                                                    \
    sp = INIT_STACKPTR(_sp);                                                 \
    (_MD_GET_SP(_thread)) = (long) sp;                         \
    (_MD_GET_PC(_thread)) = (int) _main;                              \
       _thread->no_sched = 0;                              \
    PR_END_MACRO

Definition at line 289 of file _macos.h.

Definition at line 183 of file _macos.h.

Definition at line 478 of file _macos.h.

Definition at line 475 of file _macos.h.

Definition at line 375 of file _macos.h.

Definition at line 223 of file _macos.h.

Definition at line 184 of file _macos.h.

Definition at line 523 of file _macos.h.

Definition at line 523 of file _macos.h.

Definition at line 216 of file _macos.h.

Definition at line 255 of file _macos.h.

Definition at line 533 of file _macos.h.

Definition at line 532 of file _macos.h.

Value:
PR_BEGIN_MACRO                                        \
        ENTER_CRITICAL_REGION();                          \
        (_is) = _PR_MD_GET_INTSOFF();                     \
        _PR_MD_SET_INTSOFF(1);                            \
        LEAVE_CRITICAL_REGION();                          \
    PR_END_MACRO

Definition at line 154 of file _macos.h.

Definition at line 392 of file _macos.h.

Definition at line 393 of file _macos.h.

Definition at line 204 of file _macos.h.

Definition at line 457 of file _macos.h.

Definition at line 226 of file _macos.h.

Definition at line 410 of file _macos.h.

Definition at line 384 of file _macos.h.

#define _MD_LSEEK64 (   a,
  b,
  c 
)    LL_ZERO

Definition at line 388 of file _macos.h.

Definition at line 429 of file _macos.h.

Definition at line 477 of file _macos.h.

Definition at line 654 of file _macos.h.

Definition at line 657 of file _macos.h.

#define _MD_MINIMUM_STACK_SIZE   (58 * 1024)

Definition at line 249 of file _macos.h.

Definition at line 428 of file _macos.h.

Definition at line 224 of file _macos.h.

Definition at line 377 of file _macos.h.

Definition at line 421 of file _macos.h.

Definition at line 378 of file _macos.h.

Definition at line 180 of file _macos.h.

#define _MD_PIPEAVAILABLE (   fd)    -1

Definition at line 436 of file _macos.h.

Definition at line 474 of file _macos.h.

Definition at line 543 of file _macos.h.

Definition at line 479 of file _macos.h.

Definition at line 380 of file _macos.h.

Definition at line 424 of file _macos.h.

Definition at line 470 of file _macos.h.

Definition at line 473 of file _macos.h.

Definition at line 399 of file _macos.h.

#define _MD_RESTORE_CONTEXT (   _newThread)
Value:
PR_BEGIN_MACRO                                          \
       long **jb = (_newThread)->md.jb;       \
       _MD_SET_CURRENT_THREAD(_newThread);       \
    _newThread->no_sched = 1;                     \
       longjmp(jb, 1);                                         \
    PR_END_MACRO

Definition at line 328 of file _macos.h.

Definition at line 430 of file _macos.h.

Definition at line 469 of file _macos.h.

Definition at line 472 of file _macos.h.

#define _MD_SET_INTSOFF (   _val)    (_pr_intsOff = _val)

Definition at line 166 of file _macos.h.

#define _MD_SET_PRIORITY (   a,
  b 
)

Definition at line 348 of file _macos.h.

Definition at line 464 of file _macos.h.

Definition at line 495 of file _macos.h.

Definition at line 455 of file _macos.h.

Definition at line 466 of file _macos.h.

Definition at line 169 of file _macos.h.

Definition at line 405 of file _macos.h.

Definition at line 170 of file _macos.h.

#define _MD_SWITCH_CONTEXT (   _thread)
Value:
PR_BEGIN_MACRO                                                  \
    PR_ASSERT(_thread->no_sched);                                   \
    if (!setjmp(_thread->md.jb)) {                                  \
        _MD_SET_LAST_THREAD(_thread);                               \
        if (_PR_MD_CURRENT_CPU()->md.trackScheduling)               \
            _PR_MD_CURRENT_CPU()->md.lastThreadSwitch = UpTime();   \
        _PR_Schedule();                                             \
    } else {                                                        \
        PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD());        \
        _MD_LAST_THREAD()->no_sched = 0;                            \
    }                                                               \
    PR_END_MACRO

Definition at line 310 of file _macos.h.

Definition at line 412 of file _macos.h.

Definition at line 172 of file _macos.h.

Definition at line 227 of file _macos.h.

Definition at line 414 of file _macos.h.

Definition at line 340 of file _macos.h.

Definition at line 201 of file _macos.h.

Definition at line 347 of file _macos.h.

Definition at line 381 of file _macos.h.

Definition at line 382 of file _macos.h.

Definition at line 494 of file _macos.h.

Definition at line 562 of file _macos.h.

Definition at line 75 of file _macos.h.

Definition at line 489 of file _macos.h.

Definition at line 50 of file _macos.h.

Definition at line 73 of file _macos.h.

Definition at line 48 of file _macos.h.

Definition at line 483 of file _macos.h.

Definition at line 355 of file _macos.h.

Definition at line 49 of file _macos.h.

#define _PR_PEEK_BUFFER_MAX   (16 * 1024)

Definition at line 74 of file _macos.h.

#define _PR_SI_ARCHITECTURE   "PowerPC"

Definition at line 636 of file _macos.h.

#define _PR_SI_SYSNAME   "MacOS"

Definition at line 635 of file _macos.h.

Definition at line 550 of file _macos.h.

Definition at line 569 of file _macos.h.

Definition at line 570 of file _macos.h.

#define dprintNoTrace   ";dprintf"

Definition at line 618 of file _macos.h.

#define dprintTrace   ";dprintf;doTrace"

Definition at line 617 of file _macos.h.

#define EACCES   13

Definition at line 560 of file _macos.h.

#define ENOENT   -43

Definition at line 561 of file _macos.h.

Definition at line 691 of file _macos.h.

Definition at line 549 of file _macos.h.

#define getenv   PR_GetEnv

Definition at line 578 of file _macos.h.

Definition at line 688 of file _macos.h.

#define INIT_STACKPTR (   stackTop)    ((unsigned char*)stackTop - 4)

Definition at line 244 of file _macos.h.

Definition at line 692 of file _macos.h.

Definition at line 670 of file _macos.h.

Definition at line 554 of file _macos.h.

Definition at line 567 of file _macos.h.

Definition at line 568 of file _macos.h.

Definition at line 364 of file _macos.h.

Definition at line 365 of file _macos.h.

Definition at line 47 of file _macos.h.

Definition at line 245 of file _macos.h.

Definition at line 366 of file _macos.h.

Definition at line 367 of file _macos.h.

Definition at line 579 of file _macos.h.

Definition at line 564 of file _macos.h.

Definition at line 689 of file _macos.h.

Definition at line 574 of file _macos.h.

Definition at line 573 of file _macos.h.


Typedef Documentation

typedef int(* FARPROC)()

Definition at line 551 of file _macos.h.

typedef enum IOOperation IOOperation

Enumeration Type Documentation

Enumerator:
READ_ASYNC 
WRITE_ASYNC 

Definition at line 369 of file _macos.h.


Function Documentation

PRInt32 _MD_AtomicSet ( PRInt32 val,
PRInt32  newval 
)

Definition at line 111 of file bmisc.c.

Here is the call graph for this function:

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;
}
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_CreateProcess ( const char *  path,
char *const argv,
char *const envp,
const PRProcessAttr attr 
) [read]

Definition at line 446 of file macthr.c.

{
#pragma unused (path, argv, envp, attr)

       PR_SetError(PR_NOT_IMPLEMENTED_ERROR, unimpErr);
       return NULL;
}

Definition at line 458 of file macthr.c.

{
#pragma unused (process)

       PR_SetError(PR_NOT_IMPLEMENTED_ERROR, unimpErr);
       return PR_FAILURE;
}
char* _MD_GetEnv ( const char *  name)

Definition at line 197 of file mdmac.c.

{
       EnvVariable   *currentVariable = gEnvironmentVariables;

       while (currentVariable) {
              if (!strcmp(currentVariable->variable, name))
                     return currentVariable->value;
                     
              currentVariable = currentVariable->next;
       }

       return getenv(name);
}
PRStatus _MD_gethostname ( char *  name,
int  namelen 
)

Definition at line 2219 of file macsockotpt.c.

{
    OSStatus err;
    InetInterfaceInfo info;

    _MD_FinishInitNetAccess();

    /*
     *    On a Macintosh, we don't have the concept of a local host name.
     *    We do though have an IP address & everyone should be happy with
     *     a string version of that for a name.
     *    The alternative here is to ping a local DNS for our name, they
     *    will often know it.  This is the cheap, easiest, and safest way out.
     */

    /* Make sure the string is as long as the longest possible address */
    if (namelen < strlen("123.123.123.123")) {
        err = kEINVALErr;
        goto ErrorExit;
    }

    err = OTInetGetInterfaceInfo(&info, kDefaultInetInterface);
    if (err != kOTNoError)
        goto ErrorExit;
    
    OTInetHostToString(info.fAddress, name);
    
    return PR_SUCCESS;

ErrorExit:
    macsock_map_error(err);
    return PR_FAILURE;
}

Here is the call graph for this function:

Definition at line 1918 of file macio.c.

{
    PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
    return -1;
}
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;
}

Definition at line 298 of file macthr.c.

{
       thread->md.asyncIOLock = PR_NewLock();
       PR_ASSERT(thread->md.asyncIOLock != NULL);
       thread->md.asyncIOCVar = PR_NewCondVar(thread->md.asyncIOLock);
       PR_ASSERT(thread->md.asyncIOCVar != NULL);

       if (thread->md.asyncIOLock == NULL || thread->md.asyncIOCVar == NULL)
              return PR_FAILURE;
       else
              return PR_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 474 of file macthr.c.

{
#pragma unused (process)

       PR_SetError(PR_NOT_IMPLEMENTED_ERROR, unimpErr);
       return PR_FAILURE;
}

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 caller graph for this function:

Definition at line 2293 of file macsockotpt.c.

{
    EndpointRef endpoint = (EndpointRef)fd->secret->md.osfd;
    OTResult    resultOT = OTGetEndpointState(endpoint);

    switch (resultOT)    {
        case T_OUTCON:
            macsock_map_error(EINPROGRESS);
            return -1;
            
        case T_DATAXFER:
            return 0;
            
        case T_IDLE:
            macsock_map_error(fd->secret->md.disconnectError);
            fd->secret->md.disconnectError = 0;
            return -1;

        case T_INREL:
            macsock_map_error(ENOTCONN);
            return -1;

        default:
            PR_ASSERT(0);
            return -1;
    }

    return -1;      // not reached
}

Here is the call graph for this function:

Here is the caller graph for this function:

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;
}
PRStatus _MD_OpenDir ( struct _MDDir md,
const char *  name 
)

Definition at line 537 of file macio.c.

{
       // Emulate the Unix opendir() routine.

       OSErr                       err;
       CInfoPBRec                  pb;
       char                        *macDirName = NULL;
       char                        *position = NULL;
       char                        volumeName[32];
       Str255                      pascalName;

       // Get the Macintosh path
       err = ConvertUnixPathToMacPath(name, &macDirName);
       if (err != noErr)
              goto ErrorExit;
       
       // Get the vRefNum
       position = PL_strchr(macDirName, PR_PATH_SEPARATOR);
       if ((position == macDirName) || (position == NULL))
              mdDir->ioVRefNum = 0;                                                                      // Use application relative searching
       else {
              memset(volumeName, 0, sizeof(volumeName));
              strncpy(volumeName, macDirName, position-macDirName);
              mdDir->ioVRefNum = GetVolumeRefNumFromName(volumeName);
       }

       // Get info about the object.
       PStrFromCStr(macDirName, pascalName);
       PR_DELETE(macDirName);
       
       pb.dirInfo.ioNamePtr = pascalName;
       pb.dirInfo.ioVRefNum = mdDir->ioVRefNum;
       pb.dirInfo.ioDrDirID = 0;
       pb.dirInfo.ioFDirIndex = 0;
       err = PBGetCatInfoSync(&pb);
       if (err != noErr)
              goto ErrorExit;
              
       // Are we dealing with a directory?
       if ((pb.dirInfo.ioFlAttrib & ioDirMask) == 0) {
              err = dirNFErr;
              goto ErrorExit;
       }
       
       /* This is a directory, store away the pertinent information.
       ** We post increment.  I.e. index is always the nth. item we 
       ** should get on the next call
       */
       mdDir->ioDirID = pb.dirInfo.ioDrDirID;
       mdDir->currentEntryName = NULL;
       mdDir->ioFDirIndex = 1;
       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:

int _MD_PutEnv ( const char *  variableCopy)

Definition at line 212 of file mdmac.c.

{
       EnvVariable   *currentVariable = gEnvironmentVariables;
       char                 *variableCopy,
                                *value,
                                   *current;
                                   
       variableCopy = strdup(string);
       PR_ASSERT(variableCopy != NULL);

       current = variableCopy;
       while (*current != '=')
              current++;

       *current = 0;
       current++;

       value = current;

       while (currentVariable) {
              if (!strcmp(currentVariable->variable, variableCopy))
                     break;
              
              currentVariable = currentVariable->next;
       }

       if (currentVariable == NULL) {
              currentVariable = PR_NEW(EnvVariable);
              
              if (currentVariable == NULL) {
                     PR_DELETE(variableCopy);
                     return -1;
              }
              
              currentVariable->variable = strdup(variableCopy);
              currentVariable->value = strdup(value);
              currentVariable->next = gEnvironmentVariables;
              gEnvironmentVariables = currentVariable;
       }
       
       else {
              PR_DELETE(currentVariable->value);
              currentVariable->value = strdup(current);

              /* This is a temporary hack.  Working on a real fix, remove this when done. */
              /* OK, there are two ways to access the  */
              /* library path, getenv() and PR_GetLibraryPath().  Take a look at PR_GetLibraryPath(). */
              /* You'll see that we keep the path in a global which is intialized at startup from */
              /* a call to getenv().  From then on, they have nothing in common. */
              /* We need to keep them in synch.  */
              if (strcmp(currentVariable->variable, "LD_LIBRARY_PATH") == 0)
                     PR_SetLibraryPath(currentVariable->value);
       }
       
       PR_DELETE(variableCopy);
       return 0;
}

Here is the caller graph for this function:

char* _MD_ReadDir ( struct _MDDir md,
PRIntn  flags 
)

Definition at line 596 of file macio.c.

{
       // Emulate the Unix readdir() routine.

       // Mac doesnÕt have the concept of .(PR_SKIP_DOT) & ..(PR_SKIP_DOT_DOT)

       OSErr                       err;
       CInfoPBRec                  pb;
       char                        *returnedCStr;
       Str255                      pascalName = "\p";
       PRBool                      foundEntry;
       
       PR_ASSERT(mdDir != NULL);

       do {

       // Release the last name read.
       PR_DELETE(mdDir->currentEntryName);
       mdDir->currentEntryName = NULL;
              
       // WeÕve got all the info we need, just get info about this guy.
       pb.hFileInfo.ioNamePtr = pascalName;
       pb.hFileInfo.ioVRefNum = mdDir->ioVRefNum;
       pb.hFileInfo.ioFDirIndex = mdDir->ioFDirIndex;
       pb.hFileInfo.ioDirID = mdDir->ioDirID;
       err = PBGetCatInfoSync(&pb);
       if (err != noErr)
              goto ErrorExit;
       
       // Convert the Pascal string to a C string (actual allocation occurs in CStrFromPStr)
       CStrFromPStr(pascalName, &returnedCStr);
       
       mdDir->currentEntryName = returnedCStr;
       mdDir->ioFDirIndex++;
       
       // If it is not a hidden file and the flags did not specify skipping, we are done.
       if ((flags & PR_SKIP_HIDDEN) && (pb.hFileInfo.ioFlFndrInfo.fdFlags & fInvisible))
              foundEntry = PR_FALSE;
       else
              foundEntry = PR_TRUE;       
       
       } while (!foundEntry);
       
       return (mdDir->currentEntryName);

ErrorExit:
       _PR_MD_CURRENT_THREAD()->md.osErrCode = err;
       _MD_SetError(err);
    return NULL;
}

Here is the call graph for this function:

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;
}

Definition at line 993 of file macio.c.

{
       return (_MD_LockFile(fd));
}

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;
}
PRStatus _MD_wait ( PRThread thread,
PRIntervalTime  timeout 
)

Definition at line 311 of file macthr.c.

{
#pragma unused (timeout)

       _MD_SWITCH_CONTEXT(thread);
       return PR_SUCCESS;
}

Here is the call graph for this function:

PRStatus _MD_WaitProcess ( PRProcess process,
PRInt32 exitCode 
)

Definition at line 466 of file macthr.c.

{
#pragma unused (process, exitCode)

       PR_SetError(PR_NOT_IMPLEMENTED_ERROR, unimpErr);
       return PR_FAILURE;
}
FILE* _OS_FOPEN ( const char *  filename,
const char *  mode 
)

Definition at line 1567 of file macio.c.

{
       OSErr  err = noErr;
       char   *macFileName = NULL;
       FILE   *result;
       
    err = ConvertUnixPathToMacPath(filename, &macFileName);
       if (err != noErr)
              goto ErrorExit;
       
       result = fopen(macFileName, mode);
              
       PR_DELETE(macFileName);
       
       return result;

ErrorExit:
       _PR_MD_CURRENT_THREAD()->md.osErrCode = err;
       _MD_SetError(err);
    return NULL;
}

Here is the call graph for this function:

PRInt32 _PR_MD_WRITE_SYNC ( PRFileDesc fd,
void buf,
PRInt32  amount 
)
void dprintf ( const char *  format,
  ... 
)

Definition at line 467 of file mdmac.c.

{
#if DEBUG
    va_list ap;
       Str255 buffer;
       
       va_start(ap, format);
       buffer[0] = PR_vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
       va_end(ap);
       
       DebugStr(buffer);
#endif /* DEBUG */
}
struct hostent* gethostbyaddr ( const void addr,
int  addrlen,
int  type 
) [read]
short GetVolumeRefNumFromName ( const char *  )

Definition at line 1082 of file macio.c.

{
       OSErr                       err;
       Str32                       pVolName;
       char                        *cVolName = NULL;
       HParamBlockRec              hPB;
       short                       refNum = 0;
       
       hPB.volumeParam.ioVolIndex = 0;
       hPB.volumeParam.ioNamePtr = pVolName;
       do {
              hPB.volumeParam.ioVolIndex++;
              err = PBHGetVInfoSync(&hPB);
              CStrFromPStr(pVolName, &cVolName);
              if (strcmp(cTgtVolName, cVolName) == 0) {
                     refNum =  hPB.volumeParam.ioVRefNum;
                     PR_DELETE(cVolName);
                     break;
              }
              PR_DELETE(cVolName);
       } while (err == noErr);
       
       return refNum;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 656 of file macthr.c.

{
    // we only need to do idle semaphore stuff on Mac OS X
#if TARGET_CARBON
       gUseIdleSemaphore = RunningOnOSX();
       if (gUseIdleSemaphore)
       {
              OSStatus  err = MPCreateSemaphore(1 /* max value */, 0 /* initial value */, &gIdleSemaphore);
              PR_ASSERT(err == noErr);
       }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* MapPartialToFullMacFile ( const char *  )
NSPR_API ( PRThread )

Definition at line 348 of file mdmac.c.

                         {
#ifndef NSPR_AS_SHARED_LIB
       //     Needed for Mac browsers without Java.  We don't want them calling PR_INIT, since it
       //     brings in all of the thread support.  But we do need to allow them to initialize
       //     the NSPR memory package.
       //     This should go away when all clients of the NSPR want threads AND memory.
       MacintoshInitializeMemory();
#endif
}
void SetLogFileTypeCreator ( const char *  logFile)

Definition at line 1031 of file macio.c.

{
       HParamBlockRec pb;
       OSErr err;
       Str31 pName;

       PStrFromCStr(logFile, pName);
       pb.fileParam.ioCompletion = nil;
       pb.fileParam.ioNamePtr = pName;
       pb.fileParam.ioVRefNum = 0;
       pb.fileParam.ioFDirIndex = 0;
       pb.fileParam.ioDirID = 0;
       err = PBHGetFInfoSync(&pb);
       PR_ASSERT(err == noErr);

       pb.fileParam.ioDirID = 0;
       pb.fileParam.ioFlFndrInfo.fdType = 'TEXT';
       pb.fileParam.ioFlFndrInfo.fdCreator = 'ttxt';
       err = PBHSetFInfoSync(&pb);
       PR_ASSERT(err == noErr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 706 of file macthr.c.

{
#if TARGET_CARBON
       if (gUseIdleSemaphore)
       {
              // often we won't be waiting on the semaphore here, so ignore any errors
              (void)MPSignalSemaphore(gIdleSemaphore);
       }
       else
#endif
       {
              WakeUpProcess(&gApplicationProcess);
       }
}

Here is the caller graph for this function:

Definition at line 669 of file macthr.c.

{
#if TARGET_CARBON
       if (gUseIdleSemaphore)
       {
              OSStatus  err = MPDeleteSemaphore(gIdleSemaphore);
              PR_ASSERT(err == noErr);
              gUseIdleSemaphore = NULL;
       }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 53 of file macthr.c.