michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nspr_beos_defs_h___ michael@0: #define nspr_beos_defs_h___ michael@0: michael@0: #include "prtypes.h" michael@0: #include "prio.h" michael@0: #include "prthread.h" michael@0: #include "prproces.h" michael@0: #include "prmem.h" michael@0: #include "obsolete/prsem.h" michael@0: #include michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: /* michael@0: * Internal configuration macros michael@0: */ michael@0: michael@0: #ifdef BONE_VERSION michael@0: #define _PR_HAVE_SOCKADDR_LEN michael@0: #define HAVE_NETINET_TCP_H michael@0: #endif michael@0: michael@0: #define PR_LINKER_ARCH "beos" michael@0: #define _PR_SI_SYSNAME "BEOS" michael@0: #ifdef __powerpc__ michael@0: #define _PR_SI_ARCHITECTURE "ppc" michael@0: #else michael@0: #define _PR_SI_ARCHITECTURE "x86" michael@0: #endif michael@0: #define PR_DLL_SUFFIX ".so" michael@0: michael@0: #define _PR_VMBASE 0x30000000 michael@0: #define _PR_STACK_VMBASE 0x50000000 michael@0: #define _MD_DEFAULT_STACK_SIZE 65536L michael@0: #define _MD_MMAP_FLAGS MAP_PRIVATE michael@0: michael@0: #undef HAVE_STACK_GROWING_UP michael@0: #define HAVE_DLL michael@0: #define _PR_NO_CLOCK_TIMER michael@0: michael@0: /* michael@0: * The Atomic operations michael@0: */ michael@0: michael@0: #define _PR_HAVE_ATOMIC_OPS michael@0: #define _MD_INIT_ATOMIC _MD_AtomicInit michael@0: #define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement michael@0: #define _MD_ATOMIC_ADD _MD_AtomicAdd michael@0: #define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement michael@0: #define _MD_ATOMIC_SET _MD_AtomicSet michael@0: michael@0: #define HAVE_CVAR_BUILT_ON_SEM michael@0: #define _PR_GLOBAL_THREADS_ONLY michael@0: #define _PR_BTHREADS michael@0: #define _PR_NEED_FAKE_POLL michael@0: #define _PR_HAVE_PEEK_BUFFER michael@0: #define _PR_PEEK_BUFFER_MAX (16 * 1024) michael@0: #define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1 michael@0: #define _PR_CONNECT_DOES_NOT_BIND michael@0: #define _PR_HAVE_O_APPEND michael@0: michael@0: /* Define threading functions and objects as native BeOS */ michael@0: struct _MDThread { michael@0: thread_id tid; /* BeOS thread handle */ michael@0: sem_id joinSem; /* sems used to synchronzie joining */ michael@0: PRBool is_joining; /* TRUE if someone is currently waiting to michael@0: join this thread */ michael@0: }; michael@0: michael@0: struct _MDThreadStack { michael@0: PRInt8 notused; michael@0: }; michael@0: michael@0: /* michael@0: * Lock and Semaphore related definitions michael@0: */ michael@0: michael@0: struct _MDLock { michael@0: sem_id semaphoreID; michael@0: int32 benaphoreCount; michael@0: }; michael@0: michael@0: struct _MDCVar { michael@0: sem_id sem1; michael@0: sem_id sem2; michael@0: int16 count; michael@0: }; michael@0: michael@0: struct _MDSemaphore { michael@0: sem_id sid; michael@0: }; michael@0: michael@0: /* michael@0: ** CPU-related definitions michael@0: */ michael@0: struct _MDCPU { michael@0: int8 unused; michael@0: }; michael@0: michael@0: /* michael@0: ** Process-related definitions michael@0: */ michael@0: struct _MDProcess { michael@0: pid_t pid; michael@0: }; michael@0: michael@0: struct _MDSegment { michael@0: PRInt8 notused; michael@0: }; michael@0: michael@0: /* michael@0: ** File- and directory-related definitions michael@0: */ michael@0: michael@0: #ifndef BONE_VERSION michael@0: #define BE_SOCK_SHUTDOWN_READ 0x01 michael@0: #define BE_SOCK_SHUTDOWN_WRITE 0x02 michael@0: #endif michael@0: michael@0: struct _MDFileDesc { michael@0: PRInt32 osfd; michael@0: PRInt32 sock_state; michael@0: PRBool accepted_socket; michael@0: PRNetAddr peer_addr; michael@0: #ifndef BONE_VERSION michael@0: PRBool connectValueValid; michael@0: int connectReturnValue; michael@0: int connectReturnError; michael@0: #endif michael@0: }; michael@0: michael@0: struct _MDDir { michael@0: DIR *d; michael@0: }; michael@0: michael@0: #define PR_DIRECTORY_SEPARATOR '/' michael@0: #define PR_DIRECTORY_SEPARATOR_STR "/" michael@0: #define PR_PATH_SEPARATOR ':' michael@0: #define PR_PATH_SEPARATOR_STR ":" michael@0: michael@0: #define GETTIMEOFDAY(tp) gettimeofday((tp), NULL) michael@0: michael@0: /* --- Memory-mapped files stuff --- not implemented on BeOS */ michael@0: michael@0: struct _MDFileMap { michael@0: PRInt8 unused; michael@0: }; michael@0: michael@0: /* michael@0: * Network related definitions. michael@0: */ michael@0: michael@0: #ifndef BONE_VERSION michael@0: #define IPPROTO_IP 0 michael@0: #define AF_UNIX 2 michael@0: #define TCP_NODELAY SO_NONBLOCK michael@0: #define SO_LINGER -1 michael@0: #define SO_ERROR 4 michael@0: #endif michael@0: michael@0: #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 michael@0: michael@0: #ifndef BONE_VERSION michael@0: /* these aren't actually used. if they are, we're screwed */ michael@0: struct protoent { michael@0: char *p_name; /* official protocol name */ michael@0: char **p_aliases; /* alias list */ michael@0: int p_proto; /* protocol # */ michael@0: }; michael@0: michael@0: struct protoent* getprotobyname(const char* name); michael@0: struct protoent* getprotobynumber(int number); michael@0: #endif michael@0: michael@0: /* michael@0: * malloc() related definitions. michael@0: */ michael@0: michael@0: #undef _PR_OVERRIDE_MALLOC michael@0: michael@0: /* Miscellaneous */ michael@0: michael@0: #define _MD_ERRNO() (errno) michael@0: michael@0: #define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit michael@0: #define _MD_EXIT _MD_exit michael@0: michael@0: #define _MD_GET_ENV getenv michael@0: #define _MD_PUT_ENV putenv michael@0: michael@0: #define _MD_EARLY_INIT _MD_early_init michael@0: #define _MD_FINAL_INIT _MD_final_init michael@0: #define _MD_EARLY_CLEANUP() michael@0: michael@0: /* CPU Stuff */ michael@0: michael@0: #define _MD_INIT_CPUS _MD_init_cpus michael@0: #define _MD_WAKEUP_CPUS _MD_wakeup_cpus michael@0: #define _MD_START_INTERRUPTS _MD_start_interrupts michael@0: #define _MD_STOP_INTERRUPTS _MD_stop_interrupts michael@0: #define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts michael@0: #define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts michael@0: #define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts michael@0: #define _MD_CLOCK_INTERRUPT _MD_clock_interrupt michael@0: #define _MD_INIT_STACK _MD_init_stack michael@0: #define _MD_CLEAR_STACK _MD_clear_stack michael@0: // #define _MD_GET_INTSOFF _MD_get_intsoff michael@0: // #define _MD_SET_INTSOFF _MD_set_intsoff michael@0: #define _MD_CURRENT_CPU _MD_current_cpu michael@0: #define _MD_SET_CURRENT_CPU _MD_set_current_cpu michael@0: #define _MD_INIT_RUNNING_CPU _MD_init_running_cpu michael@0: #define _MD_PAUSE_CPU _MD_pause_cpu michael@0: michael@0: /* Thread stuff */ michael@0: michael@0: #define _MD_CURRENT_THREAD() PR_GetCurrentThread() michael@0: // #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread michael@0: #define _MD_LAST_THREAD _MD_last_thread michael@0: #define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD michael@0: #define _MD_SET_LAST_THREAD _MD_set_last_thread michael@0: #define _MD_INIT_THREAD _MD_init_thread michael@0: #define _MD_EXIT_THREAD _MD_exit_thread michael@0: #define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread michael@0: michael@0: #define _MD_SUSPEND_THREAD _MD_suspend_thread michael@0: #define _MD_RESUME_THREAD _MD_resume_thread michael@0: #define _MD_SUSPEND_CPU _MD_suspend_cpu michael@0: #define _MD_RESUME_CPU _MD_resume_cpu michael@0: #define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all michael@0: #define _MD_END_SUSPEND_ALL _MD_end_suspend_all michael@0: #define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all michael@0: #define _MD_END_RESUME_ALL _MD_end_resume_all michael@0: michael@0: #define _MD_GET_SP _MD_get_sp michael@0: michael@0: #define _MD_CLEAN_THREAD _MD_clean_thread michael@0: #define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread michael@0: #define _MD_CREATE_USER_THREAD _MD_create_user_thread michael@0: #define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread michael@0: #define _MD_CREATE_THREAD _MD_create_thread michael@0: #define _MD_YIELD _MD_yield michael@0: #define _MD_SET_PRIORITY _MD_set_priority michael@0: michael@0: #define _MD_SUSPENDALL _MD_suspendall michael@0: #define _MD_RESUMEALL _MD_resumeall michael@0: michael@0: #define _MD_SWITCH_CONTEXT _MD_switch_context michael@0: #define _MD_RESTORE_CONTEXT _MD_restore_context michael@0: michael@0: #define _MD_WAIT _MD_wait michael@0: #define _MD_WAKEUP_WAITER _MD_wakeup_waiter michael@0: michael@0: #define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask michael@0: #define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask michael@0: michael@0: /* Thread Synchronization */ michael@0: michael@0: #define _MD_INIT_LOCKS _MD_init_locks michael@0: #define _MD_NEW_LOCK _MD_new_lock michael@0: #define _MD_FREE_LOCK _MD_free_lock michael@0: #define _MD_LOCK _MD_lock michael@0: #define _MD_TEST_AND_LOCK _MD_test_and_lock michael@0: #define _MD_UNLOCK _MD_unlock michael@0: #define _MD_IOQ_LOCK _MD_ioq_lock michael@0: #define _MD_IOQ_UNLOCK _MD_ioq_unlock michael@0: #define _MD_NEW_SEM _MD_new_sem michael@0: #define _MD_DESTROY_SEM _MD_destroy_sem michael@0: #define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem michael@0: #define _MD_WAIT_SEM _MD_wait_sem michael@0: #define _MD_POST_SEM _MD_post_sem michael@0: // #define _MD_NEW_CV _MD_new_cv michael@0: // #define _MD_FREE_CV _MD_free_cv michael@0: // #define _MD_WAIT_CV _MD_wait_cv michael@0: // #define _MD_NOTIFY_CV _MD_notify_cv michael@0: // #define _MD_NOTIFYALL_CV _MD_notifyall_cv michael@0: michael@0: /* File I/O */ michael@0: michael@0: /* don't need any I/O initializations */ michael@0: #define _MD_INIT_IO() michael@0: #define _MD_INIT_FILEDESC(fd) michael@0: michael@0: #define _MD_OPEN_DIR _MD_open_dir michael@0: #define _MD_READ_DIR _MD_read_dir michael@0: #define _MD_CLOSE_DIR _MD_close_dir michael@0: #define _MD_MAKE_NONBLOCK _MD_make_nonblock michael@0: #define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable michael@0: #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable michael@0: #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable michael@0: #define _MD_OPEN _MD_open michael@0: #define _MD_OPEN_FILE _MD_open michael@0: #define _MD_CLOSE_FILE _MD_close_file michael@0: #define _MD_READ _MD_read michael@0: #define _MD_WRITE _MD_write michael@0: #define _MD_WRITEV _MD_writev michael@0: #define _MD_LSEEK _MD_lseek michael@0: #define _MD_LSEEK64 _MD_lseek64 michael@0: #define _MD_FSYNC _MD_fsync michael@0: #define _MD_DELETE _MD_delete michael@0: #define _MD_GETFILEINFO _MD_getfileinfo michael@0: #define _MD_GETFILEINFO64 _MD_getfileinfo64 michael@0: #define _MD_GETOPENFILEINFO _MD_getopenfileinfo michael@0: #define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64 michael@0: #define _MD_RENAME _MD_rename michael@0: #define _MD_ACCESS _MD_access michael@0: #define _MD_STAT stat michael@0: #define _MD_MKDIR _MD_mkdir michael@0: #define _MD_MAKE_DIR _MD_mkdir michael@0: #define _MD_RMDIR _MD_rmdir michael@0: #define _MD_PR_POLL _MD_pr_poll michael@0: michael@0: /* Network I/O */ michael@0: michael@0: #define _MD_CLOSE_SOCKET _MD_close_socket michael@0: #define _MD_CONNECT _MD_connect michael@0: #define _MD_ACCEPT _MD_accept michael@0: #define _MD_BIND _MD_bind michael@0: #define _MD_LISTEN _MD_listen michael@0: #define _MD_SHUTDOWN _MD_shutdown michael@0: #define _MD_RECV _MD_recv michael@0: #define _MD_SEND _MD_send michael@0: #define _MD_ACCEPT_READ _MD_accept_read michael@0: #define _MD_GETSOCKNAME _MD_getsockname michael@0: #define _MD_GETPEERNAME _MD_getpeername michael@0: #define _MD_GETSOCKOPT _MD_getsockopt michael@0: #define _MD_SETSOCKOPT _MD_setsockopt michael@0: #define _MD_RECVFROM _MD_recvfrom michael@0: #define _MD_SENDTO _MD_sendto michael@0: #define _MD_SOCKETPAIR _MD_socketpair michael@0: #define _MD_SOCKET _MD_socket michael@0: #define _MD_SOCKETAVAILABLE _MD_socketavailable michael@0: #define _MD_PIPEAVAILABLE _MD_socketavailable michael@0: michael@0: #define _MD_GET_SOCKET_ERROR() (errno) michael@0: #define _MD_GETHOSTNAME _MD_gethostname michael@0: michael@0: #define _MD_SELECT select michael@0: michael@0: /* Process management */ michael@0: michael@0: #define _MD_CREATE_PROCESS _MD_create_process michael@0: #define _MD_DETACH_PROCESS _MD_detach_process michael@0: #define _MD_WAIT_PROCESS _MD_wait_process michael@0: #define _MD_KILL_PROCESS _MD_kill_process michael@0: michael@0: /* Atomic data operations */ michael@0: michael@0: // #define _MD_INIT_ATOMIC _MD_init_atomic michael@0: // #define _MD_ATOMIC_INCREMENT _MD_atomic_increment michael@0: // #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement michael@0: // #define _MD_ATOMIC_SET _MD_atomic_set michael@0: michael@0: /* memory management */ michael@0: michael@0: #define _MD_INIT_SEGS _MD_init_segs michael@0: #define _MD_ALLOC_SEGMENT _MD_alloc_segment michael@0: #define _MD_FREE_SEGMENT _MD_free_segment michael@0: michael@0: /* Memory mapped file I/O */ michael@0: michael@0: #define _MD_CREATE_FILE_MAP _MD_create_file_map michael@0: #define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment michael@0: #define _MD_MEM_MAP _MD_mem_map michael@0: #define _MD_MEM_UNMAP _MD_mem_unmap michael@0: #define _MD_CLOSE_FILE_MAP _MD_close_file_map michael@0: michael@0: /* Time related */ michael@0: michael@0: #define _MD_NOW _MD_now michael@0: #define _MD_INTERVAL_INIT _MD_interval_init michael@0: #define _MD_GET_INTERVAL _MD_get_interval michael@0: #define _MD_INTERVAL_PER_SEC _MD_interval_per_sec michael@0: michael@0: /* File locking */ michael@0: michael@0: #define _MD_LOCKFILE _MD_lockfile michael@0: #define _MD_TLOCKFILE _MD_tlockfile michael@0: #define _MD_UNLOCKFILE _MD_unlockfile michael@0: michael@0: /** michael@0: * Prototypes for machine dependent function implementations. (Too bad michael@0: * NSPR's MD system blows so much that we have to reiterate every stinking michael@0: * thing we implement here in our MD header file.) michael@0: */ michael@0: michael@0: /* Miscellaneous */ michael@0: michael@0: NSPR_API(void) _MD_cleanup_before_exit(void); michael@0: NSPR_API(void) _MD_exit(PRIntn status); michael@0: michael@0: NSPR_API(char*) _MD_get_env(const char *name); michael@0: NSPR_API(PRIntn) _MD_put_env(const char *name); michael@0: michael@0: NSPR_API(void) _MD_early_init(void); michael@0: NSPR_API(void) _MD_final_init(void); michael@0: michael@0: /* CPU Stuff */ michael@0: michael@0: NSPR_API(void) _MD_init_cpus(); michael@0: NSPR_API(void) _MD_wakeup_cpus(); michael@0: NSPR_API(void) _MD_start_interrupts(void); michael@0: NSPR_API(void) _MD_stop_interrupts(void); michael@0: NSPR_API(void) _MD_disable_clock_interrupts(void); michael@0: NSPR_API(void) _MD_block_clock_interrupts(void); michael@0: NSPR_API(void) _MD_unblock_clock_interrupts(void); michael@0: NSPR_API(void) _MD_clock_interrupt(void); michael@0: // NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone); michael@0: // NSPR_API(void) _MD_clear_stack(PRThreadStack* ts); michael@0: // NSPR_API(PRInt32) _MD_get_intsoff(void); michael@0: // NSPR_API(void) _MD_set_intsoff(PRInt32 _val); michael@0: // NSPR_API(_PRCPU*) _MD_current_cpu(void); michael@0: // NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu); michael@0: // NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu); michael@0: NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout); michael@0: michael@0: /* Thread stuff */ michael@0: michael@0: // NSPR_API(PRThread*) _MD_current_thread(void); michael@0: NSPR_API(PRThread*) _MD_get_attached_thread(void); michael@0: NSPR_API(PRThread*) _MD_last_thread(void); michael@0: NSPR_API(void) _MD_set_current_thread(PRThread *thread); michael@0: NSPR_API(void) _MD_set_last_thread(PRThread *thread); michael@0: NSPR_API(PRStatus) _MD_init_thread(PRThread *thread); michael@0: NSPR_API(void) _MD_exit_thread(PRThread *thread); michael@0: NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread); michael@0: michael@0: NSPR_API(void) _MD_suspend_thread(PRThread *thread); michael@0: NSPR_API(void) _MD_resume_thread(PRThread *thread); michael@0: // NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu); michael@0: // NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu); michael@0: NSPR_API(void) _MD_begin_suspend_all(void); michael@0: NSPR_API(void) _MD_end_suspend_all(void); michael@0: NSPR_API(void) _MD_begin_resume_all(void); michael@0: NSPR_API(void) _MD_end_resume_all(void); michael@0: michael@0: NSPR_API(void *) _MD_get_sp(PRThread *thread); michael@0: michael@0: NSPR_API(void) _MD_clean_thread(PRThread *thread); michael@0: NSPR_API(void) _MD_create_primordial_user_thread(PRThread *); michael@0: NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg); michael@0: NSPR_API(void) _MD_init_primordial_thread(PRThread *thread); michael@0: NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize); michael@0: NSPR_API(void) _MD_yield(void); michael@0: NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri); michael@0: michael@0: NSPR_API(void) _MD_suspendall(void); michael@0: NSPR_API(void) _MD_resumeall(void); michael@0: michael@0: NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status); michael@0: NSPR_API(void) _MD_switch_context(PRThread *thread); michael@0: NSPR_API(void) _MD_restore_context(PRThread *thread); michael@0: michael@0: NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout); michael@0: NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *); michael@0: michael@0: NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask ); michael@0: NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask); michael@0: michael@0: /* Thread Synchronization */ michael@0: michael@0: NSPR_API(void) _MD_init_locks(void); michael@0: NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md); michael@0: NSPR_API(void) _MD_free_lock(struct _MDLock *md); michael@0: NSPR_API(void) _MD_lock(struct _MDLock *md); michael@0: NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md); michael@0: NSPR_API(void) _MD_unlock(struct _MDLock *md); michael@0: NSPR_API(void) _MD_ioq_lock(void); michael@0: NSPR_API(void) _MD_ioq_unlock(void); michael@0: NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value); michael@0: NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md); michael@0: NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout); michael@0: NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md); michael@0: NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md); michael@0: // NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md); michael@0: // NSPR_API(void) _MD_free_cv(struct _MDCVar *md); michael@0: // NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout); michael@0: // NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock); michael@0: // NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock); michael@0: michael@0: /* File I/O */ michael@0: michael@0: // NSPR_API(void) _MD_init_io(void); michael@0: NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name); michael@0: NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags); michael@0: NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md); michael@0: NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd); michael@0: NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported); michael@0: NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd); michael@0: NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode); michael@0: NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd); michael@0: NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount); michael@0: NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount); michael@0: NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence); michael@0: NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence); michael@0: NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd); michael@0: NSPR_API(PRInt32) _MD_delete(const char *name); michael@0: NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info); michael@0: NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info); michael@0: NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info); michael@0: NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info); michael@0: NSPR_API(PRInt32) _MD_rename(const char *from, const char *to); michael@0: NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how); michael@0: NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf); michael@0: NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode); michael@0: NSPR_API(PRInt32) _MD_rmdir(const char *name); michael@0: NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout); michael@0: michael@0: /* Network I/O */ michael@0: NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd); michael@0: NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen); michael@0: NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog); michael@0: NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how); michael@0: NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout); michael@0: // NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg); michael@0: // NSPR_API(PRInt32) _MD_fast_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg); michael@0: // NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls); michael@0: NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen); michael@0: NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen); michael@0: NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen); michael@0: NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen); michael@0: NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout); michael@0: NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd); michael@0: NSPR_API(PRInt32) _MD_socket(int af, int type, int flags); michael@0: NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd); michael@0: michael@0: // NSPR_API(PRInt32) _MD_get_socket_error(void); michael@0: NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen); michael@0: michael@0: /* Process management */ michael@0: michael@0: NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr); michael@0: NSPR_API(PRStatus) _MD_detach_process(PRProcess *process); michael@0: NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode); michael@0: NSPR_API(PRStatus) _MD_kill_process(PRProcess *process); michael@0: michael@0: /* Atomic data operations */ michael@0: michael@0: // NSPR_API(void) _MD_init_atomic(void); michael@0: // NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *); michael@0: // NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *); michael@0: // NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32); michael@0: michael@0: /* Memory management */ michael@0: michael@0: NSPR_API(void) _MD_init_segs(void); michael@0: NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr); michael@0: NSPR_API(void) _MD_free_segment(PRSegment *seg); michael@0: michael@0: /* Memory mapped file I/O */ michael@0: michael@0: NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size); michael@0: NSPR_API(PRInt32) _MD_get_mem_map_alignment(void); michael@0: NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len); michael@0: NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size); michael@0: NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap); michael@0: michael@0: /* Time related */ michael@0: michael@0: NSPR_API(PRTime) _MD_now(void); michael@0: NSPR_API(void) _MD_interval_init(void); michael@0: NSPR_API(PRIntervalTime) _MD_get_interval(void); michael@0: NSPR_API(PRIntervalTime) _MD_interval_per_sec(void); michael@0: michael@0: /* File locking */ michael@0: michael@0: NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd); michael@0: NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd); michael@0: NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd); michael@0: michael@0: #endif /* _nspr_beos_defs_h___*/