1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * The contents of this file are subject to the Mozilla Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/MPL/
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
13 * The Original Code is the Netscape Portable Runtime (NSPR).
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 1998-2000 Netscape Communications Corporation. All
22 * Alternatively, the contents of this file may be used under the
23 * terms of the GNU General Public License Version 2 or later (the
24 * "GPL"), in which case the provisions of the GPL are applicable
25 * instead of those above. If you wish to allow use of your
26 * version of this file only under the terms of the GPL and not to
27 * allow others to use your version of this file under the MPL,
28 * indicate your decision by deleting the provisions above and
29 * replace them with the notice and other provisions required by
30 * the GPL. If you do not delete the provisions above, a recipient
31 * may use your version of this file under either the MPL or the
35 #ifndef nspr_beos_defs_h___
36 #define nspr_beos_defs_h___
43 #include "obsolete/prsem.h"
46 #include <support/SupportDefs.h>
47 #include <kernel/OS.h>
51 * Internal configuration macros
55 #define _PR_HAVE_SOCKADDR_LEN
58 #define PR_LINKER_ARCH "beos"
59 #define _PR_SI_SYSNAME "BEOS"
61 #define _PR_SI_ARCHITECTURE "ppc"
63 #define _PR_SI_ARCHITECTURE "x86"
65 #define PR_DLL_SUFFIX ".so"
67 #define _PR_VMBASE 0x30000000
68 #define _PR_STACK_VMBASE 0x50000000
69 #define _MD_DEFAULT_STACK_SIZE 65536L
70 #define _MD_MMAP_FLAGS MAP_PRIVATE
72 #undef HAVE_STACK_GROWING_UP
74 #define _PR_NO_CLOCK_TIMER
77 * The Atomic operations
80 #define _PR_HAVE_ATOMIC_OPS
81 #define _MD_INIT_ATOMIC _MD_AtomicInit
82 #define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
83 #define _MD_ATOMIC_ADD _MD_AtomicAdd
84 #define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
85 #define _MD_ATOMIC_SET _MD_AtomicSet
87 #define HAVE_CVAR_BUILT_ON_SEM
88 #define _PR_GLOBAL_THREADS_ONLY
90 #define _PR_NEED_FAKE_POLL
91 #define _PR_HAVE_PEEK_BUFFER
92 #define _PR_PEEK_BUFFER_MAX (16 * 1024)
93 #define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
94 #define _PR_CONNECT_DOES_NOT_BIND
96 /* Define threading functions and objects as native BeOS */
98 thread_id tid; /* BeOS thread handle */
99 sem_id joinSem; /* sems used to synchronzie joining */
100 PRBool is_joining; /* TRUE if someone is currently waiting to
104 struct _MDThreadStack {
109 * Lock and Semaphore related definitions
114 int32 benaphoreCount;
123 struct _MDSemaphore {
128 ** CPU-related definitions
135 ** Process-related definitions
146 ** File- and directory-related definitions
150 #define BE_SOCK_SHUTDOWN_READ 0x01
151 #define BE_SOCK_SHUTDOWN_WRITE 0x02
157 PRBool accepted_socket;
160 PRBool connectValueValid;
161 int connectReturnValue;
162 int connectReturnError;
170 #define PR_DIRECTORY_SEPARATOR '/'
171 #define PR_DIRECTORY_SEPARATOR_STR "/"
172 #define PR_PATH_SEPARATOR ':'
173 #define PR_PATH_SEPARATOR_STR ":"
175 #define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
177 /* --- Memory-mapped files stuff --- not implemented on BeOS */
184 * Network related definitions.
190 #define TCP_NODELAY SO_NONBLOCK
195 #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
198 /* these aren't actually used. if they are, we're screwed */
200 char *p_name; /* official protocol name */
201 char **p_aliases; /* alias list */
202 int p_proto; /* protocol # */
205 struct protoent* getprotobyname(const char* name);
206 struct protoent* getprotobynumber(int number);
210 * malloc() related definitions.
213 #undef _PR_OVERRIDE_MALLOC
217 #define _MD_ERRNO() (errno)
219 #define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
220 #define _MD_EXIT _MD_exit
222 #define _MD_GET_ENV getenv
223 #define _MD_PUT_ENV putenv
225 #define _MD_EARLY_INIT _MD_early_init
226 #define _MD_FINAL_INIT _MD_final_init
230 #define _MD_INIT_CPUS _MD_init_cpus
231 #define _MD_WAKEUP_CPUS _MD_wakeup_cpus
232 #define _MD_START_INTERRUPTS _MD_start_interrupts
233 #define _MD_STOP_INTERRUPTS _MD_stop_interrupts
234 #define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
235 #define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
236 #define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
237 #define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
238 #define _MD_INIT_STACK _MD_init_stack
239 #define _MD_CLEAR_STACK _MD_clear_stack
240 // #define _MD_GET_INTSOFF _MD_get_intsoff
241 // #define _MD_SET_INTSOFF _MD_set_intsoff
242 #define _MD_CURRENT_CPU _MD_current_cpu
243 #define _MD_SET_CURRENT_CPU _MD_set_current_cpu
244 #define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
245 #define _MD_PAUSE_CPU _MD_pause_cpu
249 #define _MD_CURRENT_THREAD() PR_GetCurrentThread()
250 // #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
251 #define _MD_LAST_THREAD _MD_last_thread
252 #define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
253 #define _MD_SET_LAST_THREAD _MD_set_last_thread
254 #define _MD_INIT_THREAD _MD_init_thread
255 #define _MD_EXIT_THREAD _MD_exit_thread
256 #define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
258 #define _MD_SUSPEND_THREAD _MD_suspend_thread
259 #define _MD_RESUME_THREAD _MD_resume_thread
260 #define _MD_SUSPEND_CPU _MD_suspend_cpu
261 #define _MD_RESUME_CPU _MD_resume_cpu
262 #define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
263 #define _MD_END_SUSPEND_ALL _MD_end_suspend_all
264 #define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
265 #define _MD_END_RESUME_ALL _MD_end_resume_all
267 #define _MD_GET_SP _MD_get_sp
269 #define _MD_CLEAN_THREAD _MD_clean_thread
270 #define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
271 #define _MD_CREATE_USER_THREAD _MD_create_user_thread
272 #define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
273 #define _MD_CREATE_THREAD _MD_create_thread
274 #define _MD_YIELD _MD_yield
275 #define _MD_SET_PRIORITY _MD_set_priority
277 #define _MD_SUSPENDALL _MD_suspendall
278 #define _MD_RESUMEALL _MD_resumeall
280 #define _MD_SWITCH_CONTEXT _MD_switch_context
281 #define _MD_RESTORE_CONTEXT _MD_restore_context
283 #define _MD_WAIT _MD_wait
284 #define _MD_WAKEUP_WAITER _MD_wakeup_waiter
286 #define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
287 #define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
289 /* Thread Synchronization */
291 #define _MD_INIT_LOCKS _MD_init_locks
292 #define _MD_NEW_LOCK _MD_new_lock
293 #define _MD_FREE_LOCK _MD_free_lock
294 #define _MD_LOCK _MD_lock
295 #define _MD_TEST_AND_LOCK _MD_test_and_lock
296 #define _MD_UNLOCK _MD_unlock
297 #define _MD_IOQ_LOCK _MD_ioq_lock
298 #define _MD_IOQ_UNLOCK _MD_ioq_unlock
299 #define _MD_NEW_SEM _MD_new_sem
300 #define _MD_DESTROY_SEM _MD_destroy_sem
301 #define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
302 #define _MD_WAIT_SEM _MD_wait_sem
303 #define _MD_POST_SEM _MD_post_sem
304 // #define _MD_NEW_CV _MD_new_cv
305 // #define _MD_FREE_CV _MD_free_cv
306 // #define _MD_WAIT_CV _MD_wait_cv
307 // #define _MD_NOTIFY_CV _MD_notify_cv
308 // #define _MD_NOTIFYALL_CV _MD_notifyall_cv
312 /* don't need any I/O initializations */
313 #define _MD_INIT_IO()
314 #define _MD_INIT_FILEDESC(fd)
316 #define _MD_OPEN_DIR _MD_open_dir
317 #define _MD_READ_DIR _MD_read_dir
318 #define _MD_CLOSE_DIR _MD_close_dir
319 #define _MD_MAKE_NONBLOCK _MD_make_nonblock
320 #define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
321 #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
322 #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
323 #define _MD_OPEN _MD_open
324 #define _MD_OPEN_FILE _MD_open
325 #define _MD_CLOSE_FILE _MD_close_file
326 #define _MD_READ _MD_read
327 #define _MD_WRITE _MD_write
328 #define _MD_WRITEV _MD_writev
329 #define _MD_LSEEK _MD_lseek
330 #define _MD_LSEEK64 _MD_lseek64
331 #define _MD_FSYNC _MD_fsync
332 #define _MD_DELETE _MD_delete
333 #define _MD_GETFILEINFO _MD_getfileinfo
334 #define _MD_GETFILEINFO64 _MD_getfileinfo64
335 #define _MD_GETOPENFILEINFO _MD_getopenfileinfo
336 #define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
337 #define _MD_RENAME _MD_rename
338 #define _MD_ACCESS _MD_access
339 #define _MD_STAT stat
340 #define _MD_MKDIR _MD_mkdir
341 #define _MD_MAKE_DIR _MD_mkdir
342 #define _MD_RMDIR _MD_rmdir
343 #define _MD_PR_POLL _MD_pr_poll
347 #define _MD_CLOSE_SOCKET _MD_close_socket
348 #define _MD_CONNECT _MD_connect
349 #define _MD_ACCEPT _MD_accept
350 #define _MD_BIND _MD_bind
351 #define _MD_LISTEN _MD_listen
352 #define _MD_SHUTDOWN _MD_shutdown
353 #define _MD_RECV _MD_recv
354 #define _MD_SEND _MD_send
355 #define _MD_ACCEPT_READ _MD_accept_read
356 #define _MD_GETSOCKNAME _MD_getsockname
357 #define _MD_GETPEERNAME _MD_getpeername
358 #define _MD_GETSOCKOPT _MD_getsockopt
359 #define _MD_SETSOCKOPT _MD_setsockopt
360 #define _MD_RECVFROM _MD_recvfrom
361 #define _MD_SENDTO _MD_sendto
362 #define _MD_SOCKETPAIR _MD_socketpair
363 #define _MD_SOCKET _MD_socket
364 #define _MD_SOCKETAVAILABLE _MD_socketavailable
365 #define _MD_PIPEAVAILABLE _MD_socketavailable
367 #define _MD_GET_SOCKET_ERROR() (errno)
368 #define _MD_GETHOSTNAME _MD_gethostname
370 #define _MD_SELECT select
372 /* Process management */
374 #define _MD_CREATE_PROCESS _MD_create_process
375 #define _MD_DETACH_PROCESS _MD_detach_process
376 #define _MD_WAIT_PROCESS _MD_wait_process
377 #define _MD_KILL_PROCESS _MD_kill_process
379 /* Atomic data operations */
381 // #define _MD_INIT_ATOMIC _MD_init_atomic
382 // #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
383 // #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
384 // #define _MD_ATOMIC_SET _MD_atomic_set
386 /* memory management */
388 #define _MD_INIT_SEGS _MD_init_segs
389 #define _MD_ALLOC_SEGMENT _MD_alloc_segment
390 #define _MD_FREE_SEGMENT _MD_free_segment
392 /* Memory mapped file I/O */
394 #define _MD_CREATE_FILE_MAP _MD_create_file_map
395 #define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment
396 #define _MD_MEM_MAP _MD_mem_map
397 #define _MD_MEM_UNMAP _MD_mem_unmap
398 #define _MD_CLOSE_FILE_MAP _MD_close_file_map
402 #define _MD_NOW _MD_now
403 #define _MD_INTERVAL_INIT _MD_interval_init
404 #define _MD_GET_INTERVAL _MD_get_interval
405 #define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
409 #define _MD_LOCKFILE _MD_lockfile
410 #define _MD_TLOCKFILE _MD_tlockfile
411 #define _MD_UNLOCKFILE _MD_unlockfile
414 * Prototypes for machine dependent function implementations. (Too bad
415 * NSPR's MD system blows so much that we have to reiterate every stinking
416 * thing we implement here in our MD header file.)
421 NSPR_API(void) _MD_cleanup_before_exit(void);
422 NSPR_API(void) _MD_exit(PRIntn status);
424 NSPR_API(char*) _MD_get_env(const char *name);
425 NSPR_API(PRIntn) _MD_put_env(const char *name);
427 NSPR_API(void) _MD_early_init(void);
428 NSPR_API(void) _MD_final_init(void);
432 NSPR_API(void) _MD_init_cpus();
433 NSPR_API(void) _MD_wakeup_cpus();
434 NSPR_API(void) _MD_start_interrupts(void);
435 NSPR_API(void) _MD_stop_interrupts(void);
436 NSPR_API(void) _MD_disable_clock_interrupts(void);
437 NSPR_API(void) _MD_block_clock_interrupts(void);
438 NSPR_API(void) _MD_unblock_clock_interrupts(void);
439 NSPR_API(void) _MD_clock_interrupt(void);
440 // NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
441 // NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
442 // NSPR_API(PRInt32) _MD_get_intsoff(void);
443 // NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
444 // NSPR_API(_PRCPU*) _MD_current_cpu(void);
445 // NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
446 // NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
447 NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
451 // NSPR_API(PRThread*) _MD_current_thread(void);
452 NSPR_API(PRThread*) _MD_get_attached_thread(void);
453 NSPR_API(PRThread*) _MD_last_thread(void);
454 NSPR_API(void) _MD_set_current_thread(PRThread *thread);
455 NSPR_API(void) _MD_set_last_thread(PRThread *thread);
456 NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
457 NSPR_API(void) _MD_exit_thread(PRThread *thread);
458 NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
460 NSPR_API(void) _MD_suspend_thread(PRThread *thread);
461 NSPR_API(void) _MD_resume_thread(PRThread *thread);
462 // NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
463 // NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
464 NSPR_API(void) _MD_begin_suspend_all(void);
465 NSPR_API(void) _MD_end_suspend_all(void);
466 NSPR_API(void) _MD_begin_resume_all(void);
467 NSPR_API(void) _MD_end_resume_all(void);
469 NSPR_API(void *) _MD_get_sp(PRThread *thread);
471 NSPR_API(void) _MD_clean_thread(PRThread *thread);
472 NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
473 NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
474 NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
475 NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
476 NSPR_API(void) _MD_yield(void);
477 NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
479 NSPR_API(void) _MD_suspendall(void);
480 NSPR_API(void) _MD_resumeall(void);
482 NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
483 NSPR_API(void) _MD_switch_context(PRThread *thread);
484 NSPR_API(void) _MD_restore_context(PRThread *thread);
486 NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
487 NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
489 NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
490 NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
492 /* Thread Synchronization */
494 NSPR_API(void) _MD_init_locks(void);
495 NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
496 NSPR_API(void) _MD_free_lock(struct _MDLock *md);
497 NSPR_API(void) _MD_lock(struct _MDLock *md);
498 NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
499 NSPR_API(void) _MD_unlock(struct _MDLock *md);
500 NSPR_API(void) _MD_ioq_lock(void);
501 NSPR_API(void) _MD_ioq_unlock(void);
502 NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
503 NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
504 NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
505 NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
506 NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
507 // NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
508 // NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
509 // NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
510 // NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
511 // NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
515 // NSPR_API(void) _MD_init_io(void);
516 NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
517 NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
518 NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
519 NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
520 NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
521 NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
522 NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
523 NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
524 NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
525 NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
526 NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
527 NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
528 NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
529 NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
530 NSPR_API(PRInt32) _MD_delete(const char *name);
531 NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
532 NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
533 NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
534 NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
535 NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
536 NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
537 NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
538 NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
539 NSPR_API(PRInt32) _MD_rmdir(const char *name);
540 NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
543 NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
544 NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
545 NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
546 NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
547 NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
548 NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
549 NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
550 NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
551 NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
552 // NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
553 // 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);
554 // NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
555 NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
556 NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
557 NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
558 NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
559 NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
560 NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
561 NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
562 NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
563 NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
565 // NSPR_API(PRInt32) _MD_get_socket_error(void);
566 NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
568 /* Process management */
570 NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
571 NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
572 NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
573 NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
575 /* Atomic data operations */
577 // NSPR_API(void) _MD_init_atomic(void);
578 // NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
579 // NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
580 // NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
582 /* Memory management */
584 NSPR_API(void) _MD_init_segs(void);
585 NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
586 NSPR_API(void) _MD_free_segment(PRSegment *seg);
588 /* Memory mapped file I/O */
590 NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
591 NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
592 NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
593 NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
594 NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
598 NSPR_API(PRTime) _MD_now(void);
599 NSPR_API(void) _MD_interval_init(void);
600 NSPR_API(PRIntervalTime) _MD_get_interval(void);
601 NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
605 NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
606 NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
607 NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
609 #endif /* _nspr_beos_defs_h___*/