Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / rx / rx_user.h
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #ifdef VALIDATE
11 error - foo error - foo error - foo
12 #endif /* VALIDATE */
13 #ifndef RX_USER_INCLUDE
14 #define RX_USER_INCLUDE
15 /* rx_user.h: definitions specific to the user-level implementation of Rx */
16 #include <afs/param.h>
17 #include <stdio.h>
18 #include <stdlib.h> /* for malloc() */
19 #include <lwp.h>
20 /* These routines are no-ops in the user level implementation */
21 #define SPLVAR
22 #define NETPRI
23 #define USERPRI
24 #define AFS_GLOCK()
25 #define AFS_GUNLOCK()
26 #define AFS_ASSERT_GLOCK()
27 #ifndef UKERNEL
28 /* Defined in rx/UKERNEL/rx_kmutex.h */
29 #define ISAFS_GLOCK()
30 #endif
31 /* Some "operating-system independent" stuff, for the user mode implementation */
32 #ifdef UAFS_CLIENT
33 typedef void *osi_socket;
34 #define OSI_NULLSOCKET ((osi_socket) 0)
35 #else /* UAFS_CLIENT */
36 #ifdef AFS_NT40_ENV
37 typedef SOCKET osi_socket;
38 #define OSI_NULLSOCKET INVALID_SOCKET
39 #else /* !AFS_NT40_ENV */
40 typedef afs_int32 osi_socket;
41 #define OSI_NULLSOCKET ((osi_socket) -1)
42 #endif /* !AFS_NT40_ENV */
43 #endif /* UAFS_CLIENT */
44
45 #define osi_rxSleep(x) rxi_Sleep(x)
46 #define osi_rxWakeup(x) rxi_Wakeup(x)
47
48 #ifndef AFS_AIX32_ENV
49
50 #ifndef osi_Alloc
51 #define osi_Alloc(size) malloc(size)
52 #endif
53
54 #ifndef osi_Free
55 #define osi_Free(ptr, size) free(ptr)
56 #endif
57
58 #endif
59
60 #define osi_GetTime(timevalptr) gettimeofday(timevalptr, 0)
61
62 /* Just in case it's possible to distinguish between relatively long-lived stuff and stuff which will be freed very soon, but which needs quick allocation (e.g. dynamically allocated xdr things) */
63 #define osi_QuickFree(ptr, size) osi_Free(ptr, size)
64 #define osi_QuickAlloc(size) osi_Alloc(size)
65
66 #define osi_Assert(e) opr_Assert(e)
67
68 #define osi_Msg fprintf)(stderr,
69 #define osi_VMsg vfprintf)(stderr,
70
71 #endif /* RX_USER_INCLUDE */