/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_beos_defs_h___
#define nspr_beos_defs_h___
#include "prtypes.h"
#include "prio.h"
#include "prthread.h"
#include "prproces.h"
#include "prmem.h"
#include <errno.h>
#include <support/SupportDefs.h>
#include <dirent.h>
/*
* Internal configuration macros
*/
#ifdef BONE_VERSION
#define _PR_HAVE_SOCKADDR_LEN
#endif
#ifdef __powerpc__
#else
#endif
#define HAVE_DLL
#define _PR_NO_CLOCK_TIMER
/*
* The Atomic operations
*/
#define _PR_HAVE_ATOMIC_OPS
#define HAVE_CVAR_BUILT_ON_SEM
#define _PR_GLOBAL_THREADS_ONLY
#define _PR_BTHREADS
#define _PR_NEED_FAKE_POLL
#define _PR_HAVE_PEEK_BUFFER
#define _PR_CONNECT_DOES_NOT_BIND
/* Define threading functions and objects as native BeOS */
struct _MDThread {
join this thread */
};
struct _MDThreadStack {
};
/*
* Lock and Semaphore related definitions
*/
struct _MDLock {
};
struct _MDCVar {
};
struct _MDSemaphore {
};
/*
** CPU-related definitions
*/
struct _MDCPU {
};
/*
** Process-related definitions
*/
struct _MDProcess {
};
struct _MDSegment {
};
/*
** File- and directory-related definitions
*/
#ifndef BONE_VERSION
#endif
struct _MDFileDesc {
#ifndef BONE_VERSION
int connectReturnValue;
int connectReturnError;
#endif
};
struct _MDDir {
DIR *d;
};
/* --- Memory-mapped files stuff --- not implemented on BeOS */
struct _MDFileMap {
};
/*
* Network related definitions.
*/
#ifndef BONE_VERSION
#define IPPROTO_IP 0
#endif
#ifndef BONE_VERSION
/* these aren't actually used. if they are, we're screwed */
struct protoent {
};
#endif
/*
* malloc() related definitions.
*/
/* Miscellaneous */
/* CPU Stuff */
// #define _MD_GET_INTSOFF _MD_get_intsoff
// #define _MD_SET_INTSOFF _MD_set_intsoff
/* Thread stuff */
// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
/* Thread Synchronization */
// #define _MD_NEW_CV _MD_new_cv
// #define _MD_FREE_CV _MD_free_cv
// #define _MD_WAIT_CV _MD_wait_cv
// #define _MD_NOTIFY_CV _MD_notify_cv
// #define _MD_NOTIFYALL_CV _MD_notifyall_cv
/* File I/O */
/* don't need any I/O initializations */
#define _MD_INIT_IO()
/* Network I/O */
/* Process management */
/* Atomic data operations */
// #define _MD_INIT_ATOMIC _MD_init_atomic
// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
// #define _MD_ATOMIC_SET _MD_atomic_set
/* memory management */
/* Memory mapped file I/O */
/* Time related */
/* File locking */
/**
* Prototypes for machine dependent function implementations. (Too bad
* NSPR's MD system blows so much that we have to reiterate every stinking
* thing we implement here in our MD header file.)
*/
/* Miscellaneous */
NSPR_API(void) _MD_cleanup_before_exit(void);
NSPR_API(void) _MD_early_init(void);
NSPR_API(void) _MD_final_init(void);
/* CPU Stuff */
NSPR_API(void) _MD_init_cpus();
NSPR_API(void) _MD_wakeup_cpus();
NSPR_API(void) _MD_start_interrupts(void);
NSPR_API(void) _MD_stop_interrupts(void);
NSPR_API(void) _MD_disable_clock_interrupts(void);
NSPR_API(void) _MD_block_clock_interrupts(void);
NSPR_API(void) _MD_unblock_clock_interrupts(void);
NSPR_API(void) _MD_clock_interrupt(void);
// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
// NSPR_API(PRInt32) _MD_get_intsoff(void);
// NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
// NSPR_API(_PRCPU*) _MD_current_cpu(void);
// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
/* Thread stuff */
// NSPR_API(PRThread*) _MD_current_thread(void);
// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
NSPR_API(void) _MD_begin_suspend_all(void);
NSPR_API(void) _MD_end_suspend_all(void);
NSPR_API(void) _MD_begin_resume_all(void);
NSPR_API(void) _MD_end_resume_all(void);
NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
NSPR_API(void) _MD_suspendall(void);
NSPR_API(void) _MD_resumeall(void);
/* Thread Synchronization */
NSPR_API(void) _MD_init_locks(void);
NSPR_API(void) _MD_ioq_lock(void);
NSPR_API(void) _MD_ioq_unlock(void);
// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
// NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
/* File I/O */
// NSPR_API(void) _MD_init_io(void);
NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
/* Network I/O */
NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
// 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);
// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
// NSPR_API(PRInt32) _MD_get_socket_error(void);
/* Process management */
NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
/* Atomic data operations */
// NSPR_API(void) _MD_init_atomic(void);
// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
/* Memory management */
NSPR_API(void) _MD_init_segs(void);
/* Memory mapped file I/O */
/* Time related */
NSPR_API(void) _MD_interval_init(void);
/* File locking */
#endif /* _nspr_beos_defs_h___*/