compile on modern FreeBSD. After Robert Watson <rwatson@FreeBSD.org> and Alec Kloss
[arla.git] / rx / rx_user.h
blobe8f0c5f11b33abe6ecd237ebbe10286df1bff4fb
1 /* $Id$ */
3 /*
4 ****************************************************************************
5 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
6 * *
7 * Permission to use, copy, modify, and distribute this software and its *
8 * documentation for any purpose and without fee is hereby granted, *
9 * provided that the above copyright notice appear in all copies and *
10 * that both that copyright notice and this permission notice appear in *
11 * supporting documentation, and that the name of IBM not be used in *
12 * advertising or publicity pertaining to distribution of the software *
13 * without specific, written prior permission. *
14 * *
15 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
19 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
20 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
21 ****************************************************************************
24 #ifndef RX_USER_INCLUDE
25 #define RX_USER_INCLUDE
27 /*
28 * rx_user.h:
29 * definitions specific to the user-level implementation of Rx
32 #include <stdio.h>
33 #include <lwp.h>
35 #ifdef RXDEBUG
36 extern FILE *rx_debugFile;
37 #endif
39 /* These routines are no-ops in the user level implementation */
40 #define SPLVAR
41 #define NETPRI
42 #define USERPRI
43 #if defined(AFS_SGIMP_ENV)
44 #define AFS_GLOCK()
45 #define AFS_GUNLOCK()
46 #define ISAFS_GLOCK()
47 #endif
49 void rxi_StartListener(void);
50 void rxi_StartServerProcs(int);
51 void rxi_ReScheduleEvents(void);
53 void rxi_PacketsUnWait(void);
56 *Some "operating-system independent" stuff, for the user mode implementation
58 typedef short osi_socket;
60 osi_socket rxi_GetUDPSocket(uint16_t, uint16_t *);
61 osi_socket rxi_GetICMPSocket(void);
63 #define OSI_NULLSOCKET ((osi_socket) -1)
65 #define rx_Sleep(x) osi_Sleep(x)
66 #define rx_Wakeup(x) osi_Wakeup(x)
67 #define osi_rxSleep(x) osi_Sleep(x)
68 #define osi_rxWakeup(x) osi_Wakeup(x)
69 #define osi_Sleep(x) LWP_WaitProcess(x)
70 #define osi_Wakeup(x) LWP_NoYieldSignal(x)
71 /*
72 * osi_WakeupAndYieldIfPossible doesn't actually have to yield, but
73 * its better if it does
75 #define osi_WakeupAndYieldIfPossible(x) LWP_SignalProcess(x)
76 #define osi_YieldIfPossible() LWP_DispatchProcess();
78 #ifndef osi_Alloc
79 #define osi_Alloc(size) (malloc(size))
80 #endif
82 #ifndef osi_Free
83 #define osi_Free(ptr, size) free(ptr)
84 #endif
86 #define osi_GetTime(timevalptr) gettimeofday(timevalptr, 0)
89 * Just in case it's possible to distinguish between relatively
90 * long-lived stuff and stuff which will be freed very soon, but which
91 * needs quick allocation (e.g. dynamically allocated xdr things)
94 #define osi_QuickFree(ptr, size) osi_Free(ptr, size)
95 #define osi_QuickAlloc(size) osi_Alloc(size)
98 void osi_Panic(const char *fmt, ...);
99 void osi_vMsg(const char *fmt, ...);
101 #define osi_Msg(x) do { osi_vMsg x ; } while(0)
103 #endif /* RX_USER_INCLUDE */