~ubuntu-branches/ubuntu/trusty/virtualbox-lts-xenial/trusty-proposed

« back to all changes in this revision

Viewing changes to src/libs/xpcom18a4/nsprpub/pr/include/md/_beos.h

  • Committer: Package Import Robot
  • Author(s): Gianfranco Costamagna
  • Date: 2016-02-23 14:28:26 UTC
  • Revision ID: package-import@ubuntu.com-20160223142826-bdu69el2z6wa2a44
Tags: upstream-4.3.36-dfsg
ImportĀ upstreamĀ versionĀ 4.3.36-dfsg

Show diffs side-by-side

added added

removed removed

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