1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/include/md/_beos.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,583 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nspr_beos_defs_h___ 1.10 +#define nspr_beos_defs_h___ 1.11 + 1.12 +#include "prtypes.h" 1.13 +#include "prio.h" 1.14 +#include "prthread.h" 1.15 +#include "prproces.h" 1.16 +#include "prmem.h" 1.17 +#include "obsolete/prsem.h" 1.18 +#include <errno.h> 1.19 + 1.20 +#include <support/SupportDefs.h> 1.21 +#include <kernel/OS.h> 1.22 +#include <dirent.h> 1.23 + 1.24 +/* 1.25 + * Internal configuration macros 1.26 + */ 1.27 + 1.28 +#ifdef BONE_VERSION 1.29 +#define _PR_HAVE_SOCKADDR_LEN 1.30 +#define HAVE_NETINET_TCP_H 1.31 +#endif 1.32 + 1.33 +#define PR_LINKER_ARCH "beos" 1.34 +#define _PR_SI_SYSNAME "BEOS" 1.35 +#ifdef __powerpc__ 1.36 +#define _PR_SI_ARCHITECTURE "ppc" 1.37 +#else 1.38 +#define _PR_SI_ARCHITECTURE "x86" 1.39 +#endif 1.40 +#define PR_DLL_SUFFIX ".so" 1.41 + 1.42 +#define _PR_VMBASE 0x30000000 1.43 +#define _PR_STACK_VMBASE 0x50000000 1.44 +#define _MD_DEFAULT_STACK_SIZE 65536L 1.45 +#define _MD_MMAP_FLAGS MAP_PRIVATE 1.46 + 1.47 +#undef HAVE_STACK_GROWING_UP 1.48 +#define HAVE_DLL 1.49 +#define _PR_NO_CLOCK_TIMER 1.50 + 1.51 +/* 1.52 + * The Atomic operations 1.53 + */ 1.54 + 1.55 +#define _PR_HAVE_ATOMIC_OPS 1.56 +#define _MD_INIT_ATOMIC _MD_AtomicInit 1.57 +#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement 1.58 +#define _MD_ATOMIC_ADD _MD_AtomicAdd 1.59 +#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement 1.60 +#define _MD_ATOMIC_SET _MD_AtomicSet 1.61 + 1.62 +#define HAVE_CVAR_BUILT_ON_SEM 1.63 +#define _PR_GLOBAL_THREADS_ONLY 1.64 +#define _PR_BTHREADS 1.65 +#define _PR_NEED_FAKE_POLL 1.66 +#define _PR_HAVE_PEEK_BUFFER 1.67 +#define _PR_PEEK_BUFFER_MAX (16 * 1024) 1.68 +#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1 1.69 +#define _PR_CONNECT_DOES_NOT_BIND 1.70 +#define _PR_HAVE_O_APPEND 1.71 + 1.72 +/* Define threading functions and objects as native BeOS */ 1.73 +struct _MDThread { 1.74 + thread_id tid; /* BeOS thread handle */ 1.75 + sem_id joinSem; /* sems used to synchronzie joining */ 1.76 + PRBool is_joining; /* TRUE if someone is currently waiting to 1.77 + join this thread */ 1.78 +}; 1.79 + 1.80 +struct _MDThreadStack { 1.81 + PRInt8 notused; 1.82 +}; 1.83 + 1.84 +/* 1.85 + * Lock and Semaphore related definitions 1.86 + */ 1.87 + 1.88 +struct _MDLock { 1.89 + sem_id semaphoreID; 1.90 + int32 benaphoreCount; 1.91 +}; 1.92 + 1.93 +struct _MDCVar { 1.94 + sem_id sem1; 1.95 + sem_id sem2; 1.96 + int16 count; 1.97 +}; 1.98 + 1.99 +struct _MDSemaphore { 1.100 + sem_id sid; 1.101 +}; 1.102 + 1.103 +/* 1.104 +** CPU-related definitions 1.105 +*/ 1.106 +struct _MDCPU { 1.107 + int8 unused; 1.108 +}; 1.109 + 1.110 +/* 1.111 +** Process-related definitions 1.112 +*/ 1.113 +struct _MDProcess { 1.114 + pid_t pid; 1.115 +}; 1.116 + 1.117 +struct _MDSegment { 1.118 + PRInt8 notused; 1.119 +}; 1.120 + 1.121 +/* 1.122 +** File- and directory-related definitions 1.123 +*/ 1.124 + 1.125 +#ifndef BONE_VERSION 1.126 +#define BE_SOCK_SHUTDOWN_READ 0x01 1.127 +#define BE_SOCK_SHUTDOWN_WRITE 0x02 1.128 +#endif 1.129 + 1.130 +struct _MDFileDesc { 1.131 + PRInt32 osfd; 1.132 + PRInt32 sock_state; 1.133 + PRBool accepted_socket; 1.134 + PRNetAddr peer_addr; 1.135 +#ifndef BONE_VERSION 1.136 + PRBool connectValueValid; 1.137 + int connectReturnValue; 1.138 + int connectReturnError; 1.139 +#endif 1.140 +}; 1.141 + 1.142 +struct _MDDir { 1.143 + DIR *d; 1.144 +}; 1.145 + 1.146 +#define PR_DIRECTORY_SEPARATOR '/' 1.147 +#define PR_DIRECTORY_SEPARATOR_STR "/" 1.148 +#define PR_PATH_SEPARATOR ':' 1.149 +#define PR_PATH_SEPARATOR_STR ":" 1.150 + 1.151 +#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL) 1.152 + 1.153 +/* --- Memory-mapped files stuff --- not implemented on BeOS */ 1.154 + 1.155 +struct _MDFileMap { 1.156 + PRInt8 unused; 1.157 +}; 1.158 + 1.159 +/* 1.160 + * Network related definitions. 1.161 + */ 1.162 + 1.163 +#ifndef BONE_VERSION 1.164 +#define IPPROTO_IP 0 1.165 +#define AF_UNIX 2 1.166 +#define TCP_NODELAY SO_NONBLOCK 1.167 +#define SO_LINGER -1 1.168 +#define SO_ERROR 4 1.169 +#endif 1.170 + 1.171 +#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 1.172 + 1.173 +#ifndef BONE_VERSION 1.174 +/* these aren't actually used. if they are, we're screwed */ 1.175 +struct protoent { 1.176 + char *p_name; /* official protocol name */ 1.177 + char **p_aliases; /* alias list */ 1.178 + int p_proto; /* protocol # */ 1.179 +}; 1.180 + 1.181 +struct protoent* getprotobyname(const char* name); 1.182 +struct protoent* getprotobynumber(int number); 1.183 +#endif 1.184 + 1.185 +/* 1.186 + * malloc() related definitions. 1.187 + */ 1.188 + 1.189 +#undef _PR_OVERRIDE_MALLOC 1.190 + 1.191 +/* Miscellaneous */ 1.192 + 1.193 +#define _MD_ERRNO() (errno) 1.194 + 1.195 +#define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit 1.196 +#define _MD_EXIT _MD_exit 1.197 + 1.198 +#define _MD_GET_ENV getenv 1.199 +#define _MD_PUT_ENV putenv 1.200 + 1.201 +#define _MD_EARLY_INIT _MD_early_init 1.202 +#define _MD_FINAL_INIT _MD_final_init 1.203 +#define _MD_EARLY_CLEANUP() 1.204 + 1.205 +/* CPU Stuff */ 1.206 + 1.207 +#define _MD_INIT_CPUS _MD_init_cpus 1.208 +#define _MD_WAKEUP_CPUS _MD_wakeup_cpus 1.209 +#define _MD_START_INTERRUPTS _MD_start_interrupts 1.210 +#define _MD_STOP_INTERRUPTS _MD_stop_interrupts 1.211 +#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts 1.212 +#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts 1.213 +#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts 1.214 +#define _MD_CLOCK_INTERRUPT _MD_clock_interrupt 1.215 +#define _MD_INIT_STACK _MD_init_stack 1.216 +#define _MD_CLEAR_STACK _MD_clear_stack 1.217 +// #define _MD_GET_INTSOFF _MD_get_intsoff 1.218 +// #define _MD_SET_INTSOFF _MD_set_intsoff 1.219 +#define _MD_CURRENT_CPU _MD_current_cpu 1.220 +#define _MD_SET_CURRENT_CPU _MD_set_current_cpu 1.221 +#define _MD_INIT_RUNNING_CPU _MD_init_running_cpu 1.222 +#define _MD_PAUSE_CPU _MD_pause_cpu 1.223 + 1.224 +/* Thread stuff */ 1.225 + 1.226 +#define _MD_CURRENT_THREAD() PR_GetCurrentThread() 1.227 +// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread 1.228 +#define _MD_LAST_THREAD _MD_last_thread 1.229 +#define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD 1.230 +#define _MD_SET_LAST_THREAD _MD_set_last_thread 1.231 +#define _MD_INIT_THREAD _MD_init_thread 1.232 +#define _MD_EXIT_THREAD _MD_exit_thread 1.233 +#define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread 1.234 + 1.235 +#define _MD_SUSPEND_THREAD _MD_suspend_thread 1.236 +#define _MD_RESUME_THREAD _MD_resume_thread 1.237 +#define _MD_SUSPEND_CPU _MD_suspend_cpu 1.238 +#define _MD_RESUME_CPU _MD_resume_cpu 1.239 +#define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all 1.240 +#define _MD_END_SUSPEND_ALL _MD_end_suspend_all 1.241 +#define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all 1.242 +#define _MD_END_RESUME_ALL _MD_end_resume_all 1.243 + 1.244 +#define _MD_GET_SP _MD_get_sp 1.245 + 1.246 +#define _MD_CLEAN_THREAD _MD_clean_thread 1.247 +#define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread 1.248 +#define _MD_CREATE_USER_THREAD _MD_create_user_thread 1.249 +#define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread 1.250 +#define _MD_CREATE_THREAD _MD_create_thread 1.251 +#define _MD_YIELD _MD_yield 1.252 +#define _MD_SET_PRIORITY _MD_set_priority 1.253 + 1.254 +#define _MD_SUSPENDALL _MD_suspendall 1.255 +#define _MD_RESUMEALL _MD_resumeall 1.256 + 1.257 +#define _MD_SWITCH_CONTEXT _MD_switch_context 1.258 +#define _MD_RESTORE_CONTEXT _MD_restore_context 1.259 + 1.260 +#define _MD_WAIT _MD_wait 1.261 +#define _MD_WAKEUP_WAITER _MD_wakeup_waiter 1.262 + 1.263 +#define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask 1.264 +#define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask 1.265 + 1.266 +/* Thread Synchronization */ 1.267 + 1.268 +#define _MD_INIT_LOCKS _MD_init_locks 1.269 +#define _MD_NEW_LOCK _MD_new_lock 1.270 +#define _MD_FREE_LOCK _MD_free_lock 1.271 +#define _MD_LOCK _MD_lock 1.272 +#define _MD_TEST_AND_LOCK _MD_test_and_lock 1.273 +#define _MD_UNLOCK _MD_unlock 1.274 +#define _MD_IOQ_LOCK _MD_ioq_lock 1.275 +#define _MD_IOQ_UNLOCK _MD_ioq_unlock 1.276 +#define _MD_NEW_SEM _MD_new_sem 1.277 +#define _MD_DESTROY_SEM _MD_destroy_sem 1.278 +#define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem 1.279 +#define _MD_WAIT_SEM _MD_wait_sem 1.280 +#define _MD_POST_SEM _MD_post_sem 1.281 +// #define _MD_NEW_CV _MD_new_cv 1.282 +// #define _MD_FREE_CV _MD_free_cv 1.283 +// #define _MD_WAIT_CV _MD_wait_cv 1.284 +// #define _MD_NOTIFY_CV _MD_notify_cv 1.285 +// #define _MD_NOTIFYALL_CV _MD_notifyall_cv 1.286 + 1.287 +/* File I/O */ 1.288 + 1.289 +/* don't need any I/O initializations */ 1.290 +#define _MD_INIT_IO() 1.291 +#define _MD_INIT_FILEDESC(fd) 1.292 + 1.293 +#define _MD_OPEN_DIR _MD_open_dir 1.294 +#define _MD_READ_DIR _MD_read_dir 1.295 +#define _MD_CLOSE_DIR _MD_close_dir 1.296 +#define _MD_MAKE_NONBLOCK _MD_make_nonblock 1.297 +#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable 1.298 +#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable 1.299 +#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable 1.300 +#define _MD_OPEN _MD_open 1.301 +#define _MD_OPEN_FILE _MD_open 1.302 +#define _MD_CLOSE_FILE _MD_close_file 1.303 +#define _MD_READ _MD_read 1.304 +#define _MD_WRITE _MD_write 1.305 +#define _MD_WRITEV _MD_writev 1.306 +#define _MD_LSEEK _MD_lseek 1.307 +#define _MD_LSEEK64 _MD_lseek64 1.308 +#define _MD_FSYNC _MD_fsync 1.309 +#define _MD_DELETE _MD_delete 1.310 +#define _MD_GETFILEINFO _MD_getfileinfo 1.311 +#define _MD_GETFILEINFO64 _MD_getfileinfo64 1.312 +#define _MD_GETOPENFILEINFO _MD_getopenfileinfo 1.313 +#define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64 1.314 +#define _MD_RENAME _MD_rename 1.315 +#define _MD_ACCESS _MD_access 1.316 +#define _MD_STAT stat 1.317 +#define _MD_MKDIR _MD_mkdir 1.318 +#define _MD_MAKE_DIR _MD_mkdir 1.319 +#define _MD_RMDIR _MD_rmdir 1.320 +#define _MD_PR_POLL _MD_pr_poll 1.321 + 1.322 +/* Network I/O */ 1.323 + 1.324 +#define _MD_CLOSE_SOCKET _MD_close_socket 1.325 +#define _MD_CONNECT _MD_connect 1.326 +#define _MD_ACCEPT _MD_accept 1.327 +#define _MD_BIND _MD_bind 1.328 +#define _MD_LISTEN _MD_listen 1.329 +#define _MD_SHUTDOWN _MD_shutdown 1.330 +#define _MD_RECV _MD_recv 1.331 +#define _MD_SEND _MD_send 1.332 +#define _MD_ACCEPT_READ _MD_accept_read 1.333 +#define _MD_GETSOCKNAME _MD_getsockname 1.334 +#define _MD_GETPEERNAME _MD_getpeername 1.335 +#define _MD_GETSOCKOPT _MD_getsockopt 1.336 +#define _MD_SETSOCKOPT _MD_setsockopt 1.337 +#define _MD_RECVFROM _MD_recvfrom 1.338 +#define _MD_SENDTO _MD_sendto 1.339 +#define _MD_SOCKETPAIR _MD_socketpair 1.340 +#define _MD_SOCKET _MD_socket 1.341 +#define _MD_SOCKETAVAILABLE _MD_socketavailable 1.342 +#define _MD_PIPEAVAILABLE _MD_socketavailable 1.343 + 1.344 +#define _MD_GET_SOCKET_ERROR() (errno) 1.345 +#define _MD_GETHOSTNAME _MD_gethostname 1.346 + 1.347 +#define _MD_SELECT select 1.348 + 1.349 +/* Process management */ 1.350 + 1.351 +#define _MD_CREATE_PROCESS _MD_create_process 1.352 +#define _MD_DETACH_PROCESS _MD_detach_process 1.353 +#define _MD_WAIT_PROCESS _MD_wait_process 1.354 +#define _MD_KILL_PROCESS _MD_kill_process 1.355 + 1.356 +/* Atomic data operations */ 1.357 + 1.358 +// #define _MD_INIT_ATOMIC _MD_init_atomic 1.359 +// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment 1.360 +// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement 1.361 +// #define _MD_ATOMIC_SET _MD_atomic_set 1.362 + 1.363 +/* memory management */ 1.364 + 1.365 +#define _MD_INIT_SEGS _MD_init_segs 1.366 +#define _MD_ALLOC_SEGMENT _MD_alloc_segment 1.367 +#define _MD_FREE_SEGMENT _MD_free_segment 1.368 + 1.369 +/* Memory mapped file I/O */ 1.370 + 1.371 +#define _MD_CREATE_FILE_MAP _MD_create_file_map 1.372 +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment 1.373 +#define _MD_MEM_MAP _MD_mem_map 1.374 +#define _MD_MEM_UNMAP _MD_mem_unmap 1.375 +#define _MD_CLOSE_FILE_MAP _MD_close_file_map 1.376 + 1.377 +/* Time related */ 1.378 + 1.379 +#define _MD_NOW _MD_now 1.380 +#define _MD_INTERVAL_INIT _MD_interval_init 1.381 +#define _MD_GET_INTERVAL _MD_get_interval 1.382 +#define _MD_INTERVAL_PER_SEC _MD_interval_per_sec 1.383 + 1.384 +/* File locking */ 1.385 + 1.386 +#define _MD_LOCKFILE _MD_lockfile 1.387 +#define _MD_TLOCKFILE _MD_tlockfile 1.388 +#define _MD_UNLOCKFILE _MD_unlockfile 1.389 + 1.390 +/** 1.391 + * Prototypes for machine dependent function implementations. (Too bad 1.392 + * NSPR's MD system blows so much that we have to reiterate every stinking 1.393 + * thing we implement here in our MD header file.) 1.394 + */ 1.395 + 1.396 +/* Miscellaneous */ 1.397 + 1.398 +NSPR_API(void) _MD_cleanup_before_exit(void); 1.399 +NSPR_API(void) _MD_exit(PRIntn status); 1.400 + 1.401 +NSPR_API(char*) _MD_get_env(const char *name); 1.402 +NSPR_API(PRIntn) _MD_put_env(const char *name); 1.403 + 1.404 +NSPR_API(void) _MD_early_init(void); 1.405 +NSPR_API(void) _MD_final_init(void); 1.406 + 1.407 +/* CPU Stuff */ 1.408 + 1.409 +NSPR_API(void) _MD_init_cpus(); 1.410 +NSPR_API(void) _MD_wakeup_cpus(); 1.411 +NSPR_API(void) _MD_start_interrupts(void); 1.412 +NSPR_API(void) _MD_stop_interrupts(void); 1.413 +NSPR_API(void) _MD_disable_clock_interrupts(void); 1.414 +NSPR_API(void) _MD_block_clock_interrupts(void); 1.415 +NSPR_API(void) _MD_unblock_clock_interrupts(void); 1.416 +NSPR_API(void) _MD_clock_interrupt(void); 1.417 +// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone); 1.418 +// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts); 1.419 +// NSPR_API(PRInt32) _MD_get_intsoff(void); 1.420 +// NSPR_API(void) _MD_set_intsoff(PRInt32 _val); 1.421 +// NSPR_API(_PRCPU*) _MD_current_cpu(void); 1.422 +// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu); 1.423 +// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu); 1.424 +NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout); 1.425 + 1.426 +/* Thread stuff */ 1.427 + 1.428 +// NSPR_API(PRThread*) _MD_current_thread(void); 1.429 +NSPR_API(PRThread*) _MD_get_attached_thread(void); 1.430 +NSPR_API(PRThread*) _MD_last_thread(void); 1.431 +NSPR_API(void) _MD_set_current_thread(PRThread *thread); 1.432 +NSPR_API(void) _MD_set_last_thread(PRThread *thread); 1.433 +NSPR_API(PRStatus) _MD_init_thread(PRThread *thread); 1.434 +NSPR_API(void) _MD_exit_thread(PRThread *thread); 1.435 +NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread); 1.436 + 1.437 +NSPR_API(void) _MD_suspend_thread(PRThread *thread); 1.438 +NSPR_API(void) _MD_resume_thread(PRThread *thread); 1.439 +// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu); 1.440 +// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu); 1.441 +NSPR_API(void) _MD_begin_suspend_all(void); 1.442 +NSPR_API(void) _MD_end_suspend_all(void); 1.443 +NSPR_API(void) _MD_begin_resume_all(void); 1.444 +NSPR_API(void) _MD_end_resume_all(void); 1.445 + 1.446 +NSPR_API(void *) _MD_get_sp(PRThread *thread); 1.447 + 1.448 +NSPR_API(void) _MD_clean_thread(PRThread *thread); 1.449 +NSPR_API(void) _MD_create_primordial_user_thread(PRThread *); 1.450 +NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg); 1.451 +NSPR_API(void) _MD_init_primordial_thread(PRThread *thread); 1.452 +NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize); 1.453 +NSPR_API(void) _MD_yield(void); 1.454 +NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri); 1.455 + 1.456 +NSPR_API(void) _MD_suspendall(void); 1.457 +NSPR_API(void) _MD_resumeall(void); 1.458 + 1.459 +NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status); 1.460 +NSPR_API(void) _MD_switch_context(PRThread *thread); 1.461 +NSPR_API(void) _MD_restore_context(PRThread *thread); 1.462 + 1.463 +NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout); 1.464 +NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *); 1.465 + 1.466 +NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask ); 1.467 +NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask); 1.468 + 1.469 +/* Thread Synchronization */ 1.470 + 1.471 +NSPR_API(void) _MD_init_locks(void); 1.472 +NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md); 1.473 +NSPR_API(void) _MD_free_lock(struct _MDLock *md); 1.474 +NSPR_API(void) _MD_lock(struct _MDLock *md); 1.475 +NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md); 1.476 +NSPR_API(void) _MD_unlock(struct _MDLock *md); 1.477 +NSPR_API(void) _MD_ioq_lock(void); 1.478 +NSPR_API(void) _MD_ioq_unlock(void); 1.479 +NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value); 1.480 +NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md); 1.481 +NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout); 1.482 +NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md); 1.483 +NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md); 1.484 +// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md); 1.485 +// NSPR_API(void) _MD_free_cv(struct _MDCVar *md); 1.486 +// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout); 1.487 +// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock); 1.488 +// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock); 1.489 + 1.490 +/* File I/O */ 1.491 + 1.492 +// NSPR_API(void) _MD_init_io(void); 1.493 +NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name); 1.494 +NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags); 1.495 +NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md); 1.496 +NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd); 1.497 +NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported); 1.498 +NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd); 1.499 +NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode); 1.500 +NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd); 1.501 +NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount); 1.502 +NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount); 1.503 +NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout); 1.504 +NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence); 1.505 +NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence); 1.506 +NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd); 1.507 +NSPR_API(PRInt32) _MD_delete(const char *name); 1.508 +NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info); 1.509 +NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info); 1.510 +NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info); 1.511 +NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info); 1.512 +NSPR_API(PRInt32) _MD_rename(const char *from, const char *to); 1.513 +NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how); 1.514 +NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf); 1.515 +NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode); 1.516 +NSPR_API(PRInt32) _MD_rmdir(const char *name); 1.517 +NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout); 1.518 + 1.519 +/* Network I/O */ 1.520 +NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd); 1.521 +NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout); 1.522 +NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout); 1.523 +NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen); 1.524 +NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog); 1.525 +NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how); 1.526 +NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout); 1.527 +NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout); 1.528 +NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout); 1.529 +// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg); 1.530 +// 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); 1.531 +// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls); 1.532 +NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen); 1.533 +NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen); 1.534 +NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen); 1.535 +NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen); 1.536 +NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout); 1.537 +NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout); 1.538 +NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd); 1.539 +NSPR_API(PRInt32) _MD_socket(int af, int type, int flags); 1.540 +NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd); 1.541 + 1.542 +// NSPR_API(PRInt32) _MD_get_socket_error(void); 1.543 +NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen); 1.544 + 1.545 +/* Process management */ 1.546 + 1.547 +NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr); 1.548 +NSPR_API(PRStatus) _MD_detach_process(PRProcess *process); 1.549 +NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode); 1.550 +NSPR_API(PRStatus) _MD_kill_process(PRProcess *process); 1.551 + 1.552 +/* Atomic data operations */ 1.553 + 1.554 +// NSPR_API(void) _MD_init_atomic(void); 1.555 +// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *); 1.556 +// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *); 1.557 +// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32); 1.558 + 1.559 +/* Memory management */ 1.560 + 1.561 +NSPR_API(void) _MD_init_segs(void); 1.562 +NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr); 1.563 +NSPR_API(void) _MD_free_segment(PRSegment *seg); 1.564 + 1.565 +/* Memory mapped file I/O */ 1.566 + 1.567 +NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size); 1.568 +NSPR_API(PRInt32) _MD_get_mem_map_alignment(void); 1.569 +NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len); 1.570 +NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size); 1.571 +NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap); 1.572 + 1.573 +/* Time related */ 1.574 + 1.575 +NSPR_API(PRTime) _MD_now(void); 1.576 +NSPR_API(void) _MD_interval_init(void); 1.577 +NSPR_API(PRIntervalTime) _MD_get_interval(void); 1.578 +NSPR_API(PRIntervalTime) _MD_interval_per_sec(void); 1.579 + 1.580 +/* File locking */ 1.581 + 1.582 +NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd); 1.583 +NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd); 1.584 +NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd); 1.585 + 1.586 +#endif /* _nspr_beos_defs_h___*/