Back to index

lightning-sunbird  0.9+nobinonly
_beos.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nspr_beos_defs_h___
00039 #define nspr_beos_defs_h___
00040 
00041 #include "prtypes.h"
00042 #include "prio.h"
00043 #include "prthread.h"
00044 #include "prproces.h"
00045 #include "prmem.h"
00046 #include "obsolete/prsem.h"
00047 #include <errno.h>
00048 
00049 #include <support/SupportDefs.h>
00050 #include <kernel/OS.h>
00051 #include <dirent.h>
00052 
00053 /*
00054  * Internal configuration macros
00055  */
00056 
00057 #ifdef BONE_VERSION
00058 #define _PR_HAVE_SOCKADDR_LEN
00059 #endif
00060 
00061 #define PR_LINKER_ARCH      "beos"
00062 #define _PR_SI_SYSNAME  "BEOS"
00063 #ifdef __powerpc__
00064 #define _PR_SI_ARCHITECTURE "ppc"
00065 #else
00066 #define _PR_SI_ARCHITECTURE "x86"
00067 #endif
00068 #define PR_DLL_SUFFIX              ".so"
00069 
00070 #define _PR_VMBASE              0x30000000
00071 #define _PR_STACK_VMBASE    0x50000000
00072 #define _MD_DEFAULT_STACK_SIZE     65536L
00073 #define _MD_MMAP_FLAGS          MAP_PRIVATE
00074 
00075 #undef HAVE_STACK_GROWING_UP
00076 #define HAVE_DLL
00077 #define _PR_NO_CLOCK_TIMER
00078 
00079 /*
00080  * The Atomic operations
00081  */
00082 
00083 #define _PR_HAVE_ATOMIC_OPS
00084 #define _MD_INIT_ATOMIC _MD_AtomicInit
00085 #define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
00086 #define _MD_ATOMIC_ADD _MD_AtomicAdd
00087 #define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
00088 #define _MD_ATOMIC_SET _MD_AtomicSet
00089 
00090 #define HAVE_CVAR_BUILT_ON_SEM
00091 #define _PR_GLOBAL_THREADS_ONLY
00092 #define _PR_BTHREADS
00093 #define _PR_NEED_FAKE_POLL
00094 #define _PR_HAVE_PEEK_BUFFER
00095 #define _PR_PEEK_BUFFER_MAX (16 * 1024)
00096 #define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
00097 #define _PR_CONNECT_DOES_NOT_BIND
00098 #define _PR_HAVE_O_APPEND
00099 
00100 /* Define threading functions and objects as native BeOS */
00101 struct _MDThread {
00102     thread_id tid;   /* BeOS thread handle */
00103        sem_id        joinSem;      /* sems used to synchronzie joining */
00104        PRBool is_joining;   /* TRUE if someone is currently waiting to
00105                                              join this thread */
00106 };
00107 
00108 struct _MDThreadStack {
00109     PRInt8    notused;
00110 };
00111 
00112 /*
00113  * Lock and Semaphore related definitions
00114  */
00115 
00116 struct _MDLock {
00117     sem_id semaphoreID;
00118     int32  benaphoreCount;
00119 };
00120 
00121 struct _MDCVar {
00122     sem_id sem1;
00123     sem_id sem2;
00124     int16  count;
00125 };
00126 
00127 struct _MDSemaphore {
00128     sem_id sid;
00129 };
00130 
00131 /*
00132 ** CPU-related definitions
00133 */
00134 struct _MDCPU {
00135     int8             unused;
00136 };
00137 
00138 /*
00139 ** Process-related definitions
00140 */
00141 struct _MDProcess {
00142     pid_t pid;
00143 };
00144 
00145 struct _MDSegment {
00146     PRInt8 notused;
00147 };
00148 
00149 /*
00150 ** File- and directory-related definitions
00151 */
00152 
00153 #ifndef BONE_VERSION
00154 #define BE_SOCK_SHUTDOWN_READ      0x01
00155 #define BE_SOCK_SHUTDOWN_WRITE     0x02
00156 #endif
00157 
00158 struct _MDFileDesc {
00159     PRInt32   osfd;
00160     PRInt32   sock_state;
00161     PRBool    accepted_socket;
00162     PRNetAddr peer_addr;
00163 #ifndef BONE_VERSION
00164     PRBool    connectValueValid;
00165     int              connectReturnValue;
00166     int              connectReturnError;
00167 #endif
00168 };
00169 
00170 struct _MDDir {
00171     DIR              *d;
00172 };
00173 
00174 #define PR_DIRECTORY_SEPARATOR            '/'
00175 #define PR_DIRECTORY_SEPARATOR_STR "/"
00176 #define PR_PATH_SEPARATOR          ':'
00177 #define PR_PATH_SEPARATOR_STR             ":"
00178 
00179 #define GETTIMEOFDAY(tp)    gettimeofday((tp), NULL)
00180 
00181 /* --- Memory-mapped files stuff --- not implemented on BeOS */
00182 
00183 struct _MDFileMap {
00184     PRInt8 unused;
00185 };
00186 
00187 /*
00188  * Network related definitions.
00189  */
00190 
00191 #ifndef BONE_VERSION
00192 #define IPPROTO_IP 0
00193 #define AF_UNIX 2
00194 #define TCP_NODELAY SO_NONBLOCK
00195 #define SO_LINGER -1
00196 #define SO_ERROR 4
00197 #endif
00198 
00199 #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
00200 
00201 #ifndef BONE_VERSION
00202 /* these aren't actually used. if they are, we're screwed */
00203 struct  protoent {
00204     char    *p_name;        /* official protocol name */
00205     char    **p_aliases;    /* alias list */
00206     int     p_proto;        /* protocol # */
00207 };
00208 
00209 struct protoent* getprotobyname(const char* name);
00210 struct protoent* getprotobynumber(int number);
00211 #endif
00212 
00213 /*
00214  * malloc() related definitions.
00215  */
00216 
00217 #undef _PR_OVERRIDE_MALLOC
00218 
00219 /* Miscellaneous */
00220 
00221 #define _MD_ERRNO()             (errno)
00222 
00223 #define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
00224 #define _MD_EXIT _MD_exit
00225 
00226 #define _MD_GET_ENV getenv
00227 #define _MD_PUT_ENV putenv
00228 
00229 #define _MD_EARLY_INIT _MD_early_init
00230 #define _MD_FINAL_INIT _MD_final_init
00231 
00232 /* CPU Stuff */
00233 
00234 #define _MD_INIT_CPUS _MD_init_cpus
00235 #define _MD_WAKEUP_CPUS _MD_wakeup_cpus
00236 #define _MD_START_INTERRUPTS _MD_start_interrupts
00237 #define _MD_STOP_INTERRUPTS _MD_stop_interrupts
00238 #define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
00239 #define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
00240 #define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
00241 #define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
00242 #define _MD_INIT_STACK _MD_init_stack
00243 #define _MD_CLEAR_STACK _MD_clear_stack
00244 // #define _MD_GET_INTSOFF _MD_get_intsoff
00245 // #define _MD_SET_INTSOFF _MD_set_intsoff
00246 #define _MD_CURRENT_CPU _MD_current_cpu
00247 #define _MD_SET_CURRENT_CPU _MD_set_current_cpu
00248 #define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
00249 #define _MD_PAUSE_CPU _MD_pause_cpu
00250 
00251 /* Thread stuff */
00252 
00253 #define _MD_CURRENT_THREAD() PR_GetCurrentThread()
00254 // #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
00255 #define _MD_LAST_THREAD _MD_last_thread
00256 #define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
00257 #define _MD_SET_LAST_THREAD _MD_set_last_thread
00258 #define _MD_INIT_THREAD _MD_init_thread
00259 #define _MD_EXIT_THREAD _MD_exit_thread
00260 #define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
00261 
00262 #define _MD_SUSPEND_THREAD _MD_suspend_thread
00263 #define _MD_RESUME_THREAD _MD_resume_thread
00264 #define _MD_SUSPEND_CPU _MD_suspend_cpu
00265 #define _MD_RESUME_CPU _MD_resume_cpu
00266 #define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
00267 #define _MD_END_SUSPEND_ALL _MD_end_suspend_all
00268 #define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
00269 #define _MD_END_RESUME_ALL _MD_end_resume_all
00270 
00271 #define _MD_GET_SP _MD_get_sp
00272 
00273 #define _MD_CLEAN_THREAD _MD_clean_thread
00274 #define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
00275 #define _MD_CREATE_USER_THREAD _MD_create_user_thread
00276 #define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
00277 #define _MD_CREATE_THREAD _MD_create_thread
00278 #define _MD_YIELD _MD_yield
00279 #define _MD_SET_PRIORITY _MD_set_priority
00280 
00281 #define _MD_SUSPENDALL _MD_suspendall
00282 #define _MD_RESUMEALL _MD_resumeall
00283 
00284 #define _MD_SWITCH_CONTEXT _MD_switch_context
00285 #define _MD_RESTORE_CONTEXT _MD_restore_context
00286 
00287 #define _MD_WAIT _MD_wait
00288 #define _MD_WAKEUP_WAITER _MD_wakeup_waiter
00289 
00290 #define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
00291 #define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
00292 
00293 /* Thread Synchronization */
00294 
00295 #define _MD_INIT_LOCKS _MD_init_locks
00296 #define _MD_NEW_LOCK _MD_new_lock
00297 #define _MD_FREE_LOCK _MD_free_lock
00298 #define _MD_LOCK _MD_lock
00299 #define _MD_TEST_AND_LOCK _MD_test_and_lock
00300 #define _MD_UNLOCK _MD_unlock
00301 #define _MD_IOQ_LOCK _MD_ioq_lock
00302 #define _MD_IOQ_UNLOCK _MD_ioq_unlock
00303 #define _MD_NEW_SEM _MD_new_sem
00304 #define _MD_DESTROY_SEM _MD_destroy_sem
00305 #define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
00306 #define _MD_WAIT_SEM _MD_wait_sem
00307 #define _MD_POST_SEM _MD_post_sem
00308 // #define _MD_NEW_CV _MD_new_cv
00309 // #define _MD_FREE_CV _MD_free_cv
00310 // #define _MD_WAIT_CV _MD_wait_cv
00311 // #define _MD_NOTIFY_CV _MD_notify_cv
00312 // #define _MD_NOTIFYALL_CV _MD_notifyall_cv
00313 
00314 /* File I/O */
00315 
00316 /* don't need any I/O initializations */
00317 #define _MD_INIT_IO()
00318 #define _MD_INIT_FILEDESC(fd)
00319 
00320 #define _MD_OPEN_DIR _MD_open_dir
00321 #define _MD_READ_DIR _MD_read_dir
00322 #define _MD_CLOSE_DIR _MD_close_dir
00323 #define _MD_MAKE_NONBLOCK _MD_make_nonblock
00324 #define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
00325 #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
00326 #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
00327 #define _MD_OPEN _MD_open
00328 #define _MD_OPEN_FILE _MD_open
00329 #define _MD_CLOSE_FILE _MD_close_file
00330 #define _MD_READ _MD_read
00331 #define _MD_WRITE _MD_write
00332 #define _MD_WRITEV _MD_writev
00333 #define _MD_LSEEK _MD_lseek
00334 #define _MD_LSEEK64 _MD_lseek64
00335 #define _MD_FSYNC _MD_fsync
00336 #define _MD_DELETE _MD_delete
00337 #define _MD_GETFILEINFO _MD_getfileinfo
00338 #define _MD_GETFILEINFO64 _MD_getfileinfo64
00339 #define _MD_GETOPENFILEINFO _MD_getopenfileinfo
00340 #define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
00341 #define _MD_RENAME _MD_rename
00342 #define _MD_ACCESS _MD_access
00343 #define _MD_STAT stat
00344 #define _MD_MKDIR _MD_mkdir
00345 #define _MD_MAKE_DIR _MD_mkdir
00346 #define _MD_RMDIR _MD_rmdir
00347 #define _MD_PR_POLL _MD_pr_poll
00348 
00349 /* Network I/O */
00350 
00351 #define _MD_CLOSE_SOCKET _MD_close_socket
00352 #define _MD_CONNECT _MD_connect
00353 #define _MD_ACCEPT _MD_accept
00354 #define _MD_BIND _MD_bind
00355 #define _MD_LISTEN _MD_listen
00356 #define _MD_SHUTDOWN _MD_shutdown
00357 #define _MD_RECV _MD_recv
00358 #define _MD_SEND _MD_send
00359 #define _MD_ACCEPT_READ _MD_accept_read
00360 #define _MD_GETSOCKNAME _MD_getsockname
00361 #define _MD_GETPEERNAME _MD_getpeername
00362 #define _MD_GETSOCKOPT _MD_getsockopt
00363 #define _MD_SETSOCKOPT _MD_setsockopt
00364 #define _MD_RECVFROM _MD_recvfrom
00365 #define _MD_SENDTO _MD_sendto
00366 #define _MD_SOCKETPAIR _MD_socketpair
00367 #define _MD_SOCKET _MD_socket
00368 #define _MD_SOCKETAVAILABLE _MD_socketavailable
00369 #define _MD_PIPEAVAILABLE _MD_socketavailable
00370 
00371 #define _MD_GET_SOCKET_ERROR()     (errno)
00372 #define _MD_GETHOSTNAME _MD_gethostname
00373 
00374 #define _MD_SELECT select
00375 
00376 /* Process management */
00377 
00378 #define _MD_CREATE_PROCESS _MD_create_process
00379 #define _MD_DETACH_PROCESS _MD_detach_process
00380 #define _MD_WAIT_PROCESS _MD_wait_process
00381 #define _MD_KILL_PROCESS _MD_kill_process
00382 
00383 /* Atomic data operations */
00384 
00385 // #define _MD_INIT_ATOMIC _MD_init_atomic
00386 // #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
00387 // #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
00388 // #define _MD_ATOMIC_SET _MD_atomic_set
00389 
00390 /* memory management */
00391 
00392 #define _MD_INIT_SEGS _MD_init_segs
00393 #define _MD_ALLOC_SEGMENT _MD_alloc_segment
00394 #define _MD_FREE_SEGMENT _MD_free_segment
00395 
00396 /* Memory mapped file I/O */
00397 
00398 #define _MD_CREATE_FILE_MAP _MD_create_file_map
00399 #define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment
00400 #define _MD_MEM_MAP _MD_mem_map
00401 #define _MD_MEM_UNMAP _MD_mem_unmap
00402 #define _MD_CLOSE_FILE_MAP _MD_close_file_map
00403 
00404 /* Time related */
00405 
00406 #define _MD_NOW _MD_now
00407 #define _MD_INTERVAL_INIT _MD_interval_init
00408 #define _MD_GET_INTERVAL _MD_get_interval
00409 #define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
00410 
00411 /* File locking */
00412 
00413 #define _MD_LOCKFILE _MD_lockfile
00414 #define _MD_TLOCKFILE _MD_tlockfile
00415 #define _MD_UNLOCKFILE _MD_unlockfile
00416 
00423 /* Miscellaneous */
00424 
00425 NSPR_API(void) _MD_cleanup_before_exit(void);
00426 NSPR_API(void) _MD_exit(PRIntn status);
00427 
00428 NSPR_API(char*) _MD_get_env(const char *name);
00429 NSPR_API(PRIntn) _MD_put_env(const char *name);
00430 
00431 NSPR_API(void) _MD_early_init(void);
00432 NSPR_API(void) _MD_final_init(void);
00433 
00434 /* CPU Stuff */
00435 
00436 NSPR_API(void) _MD_init_cpus();
00437 NSPR_API(void) _MD_wakeup_cpus();
00438 NSPR_API(void) _MD_start_interrupts(void);
00439 NSPR_API(void) _MD_stop_interrupts(void);
00440 NSPR_API(void) _MD_disable_clock_interrupts(void);
00441 NSPR_API(void) _MD_block_clock_interrupts(void);
00442 NSPR_API(void) _MD_unblock_clock_interrupts(void);
00443 NSPR_API(void) _MD_clock_interrupt(void);
00444 // NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
00445 // NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
00446 // NSPR_API(PRInt32) _MD_get_intsoff(void);
00447 // NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
00448 // NSPR_API(_PRCPU*) _MD_current_cpu(void);
00449 // NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
00450 // NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
00451 NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
00452 
00453 /* Thread stuff */
00454 
00455 // NSPR_API(PRThread*) _MD_current_thread(void);
00456 NSPR_API(PRThread*) _MD_get_attached_thread(void);
00457 NSPR_API(PRThread*) _MD_last_thread(void);
00458 NSPR_API(void) _MD_set_current_thread(PRThread *thread);
00459 NSPR_API(void) _MD_set_last_thread(PRThread *thread);
00460 NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
00461 NSPR_API(void) _MD_exit_thread(PRThread *thread);
00462 NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
00463 
00464 NSPR_API(void) _MD_suspend_thread(PRThread *thread);
00465 NSPR_API(void) _MD_resume_thread(PRThread *thread);
00466 // NSPR_API(void) _MD_suspend_cpu(_PRCPU  *cpu);
00467 // NSPR_API(void) _MD_resume_cpu(_PRCPU  *cpu);
00468 NSPR_API(void) _MD_begin_suspend_all(void);
00469 NSPR_API(void) _MD_end_suspend_all(void);
00470 NSPR_API(void) _MD_begin_resume_all(void);
00471 NSPR_API(void) _MD_end_resume_all(void);
00472 
00473 NSPR_API(void *) _MD_get_sp(PRThread *thread);
00474 
00475 NSPR_API(void) _MD_clean_thread(PRThread *thread);
00476 NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
00477 NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
00478 NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
00479 NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
00480 NSPR_API(void) _MD_yield(void);
00481 NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
00482 
00483 NSPR_API(void) _MD_suspendall(void);
00484 NSPR_API(void) _MD_resumeall(void);
00485 
00486 NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
00487 NSPR_API(void) _MD_switch_context(PRThread *thread);
00488 NSPR_API(void) _MD_restore_context(PRThread *thread);
00489 
00490 NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
00491 NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
00492 
00493 NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
00494 NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
00495 
00496 /* Thread Synchronization */
00497 
00498 NSPR_API(void) _MD_init_locks(void);
00499 NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
00500 NSPR_API(void) _MD_free_lock(struct _MDLock *md);
00501 NSPR_API(void) _MD_lock(struct _MDLock *md);
00502 NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
00503 NSPR_API(void) _MD_unlock(struct _MDLock *md);
00504 NSPR_API(void) _MD_ioq_lock(void);
00505 NSPR_API(void) _MD_ioq_unlock(void);
00506 NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
00507 NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
00508 NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
00509 NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
00510 NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
00511 // NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
00512 // NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
00513 // NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
00514 // NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
00515 // NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
00516 
00517 /* File I/O */
00518 
00519 // NSPR_API(void) _MD_init_io(void);
00520 NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
00521 NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
00522 NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
00523 NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
00524 NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
00525 NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
00526 NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
00527 NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
00528 NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
00529 NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
00530 NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
00531 NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
00532 NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
00533 NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
00534 NSPR_API(PRInt32) _MD_delete(const char *name);
00535 NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
00536 NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
00537 NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
00538 NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
00539 NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
00540 NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
00541 NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
00542 NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
00543 NSPR_API(PRInt32) _MD_rmdir(const char *name);
00544 NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
00545 
00546 /* Network I/O */
00547 NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
00548 NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
00549 NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
00550 NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
00551 NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
00552 NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
00553 NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
00554 NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
00555 NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
00556 // NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
00557 // 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);
00558 // NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
00559 NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
00560 NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
00561 NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
00562 NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
00563 NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
00564 NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
00565 NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
00566 NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
00567 NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
00568 
00569 // NSPR_API(PRInt32) _MD_get_socket_error(void);
00570 NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
00571 
00572 /* Process management */
00573 
00574 NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
00575 NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
00576 NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
00577 NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
00578 
00579 /* Atomic data operations */
00580 
00581 // NSPR_API(void) _MD_init_atomic(void);
00582 // NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
00583 // NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
00584 // NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
00585 
00586 /* Memory management */
00587 
00588 NSPR_API(void) _MD_init_segs(void);
00589 NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
00590 NSPR_API(void) _MD_free_segment(PRSegment *seg);
00591 
00592 /* Memory mapped file I/O */
00593 
00594 NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
00595 NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
00596 NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
00597 NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
00598 NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
00599 
00600 /* Time related */
00601 
00602 NSPR_API(PRTime) _MD_now(void);
00603 NSPR_API(void) _MD_interval_init(void);
00604 NSPR_API(PRIntervalTime) _MD_get_interval(void);
00605 NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
00606 
00607 /* File locking */
00608 
00609 NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
00610 NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
00611 NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
00612 
00613 #endif /* _nspr_beos_defs_h___*/