2 * Copyright 2000, International Business Machines Corporation and others.
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
11 * HPUX OSI header file. Extends afs_osi.h.
13 * afs_osi.h includes this file, which is the only way this file should
14 * be included in a source file. This file can redefine macros declared in
18 #ifndef _OSI_MACHDEP_H_
19 #define _OSI_MACHDEP_H_
21 #include "h/kern_sem.h"
24 extern struct timeval time;
25 #define osi_Time() (time.tv_sec)
32 #define AFS_UCRED ucred
33 #define AFS_PROC proc_t
35 #define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
36 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,aresid) \
37 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(aresid),0)
41 #define osi_curcred() (p_cred(u.u_procp))
43 #define getpid() (afs_uint32)p_pid(u.u_procp)
45 #define getppid() (afs_uint32)p_ppid(u.u_procp)
49 * Global lock support.
51 * HP uses global mutex to protect afs land
54 extern sema_t afs_global_sema;
56 extern void osi_InitGlock(void);
58 extern void afsHash(int nbuckets);
59 extern sv_sema_t *afsHashInsertFind(tid_t key);
60 extern sv_sema_t *afsHashFind(tid_t key);
61 extern void afsHashRelease(tid_t key);
63 #define AFS_GLOCK_PID kt_tid(u.u_kthreadp)
64 #define AFS_SAVE_SEMA afsHashInsertFind(AFS_GLOCK_PID)
65 #define AFS_FIND_SEMA afsHashFind(AFS_GLOCK_PID)
66 #define AFS_GLOCK() MP_PXSEMA(&afs_global_sema, AFS_SAVE_SEMA)
67 #define AFS_GUNLOCK() (AFS_ASSERT_GLOCK(), MP_VXSEMA(&afs_global_sema,AFS_FIND_SEMA), (!uniprocessor ? (afsHashRelease(AFS_GLOCK_PID),0) : 0))
68 #define ISAFS_GLOCK() (!uniprocessor ? owns_sema(&afs_global_sema):1)
71 #define AFS_RXGUNLOCK()
72 #define ISAFS_RXGLOCK() 1
74 /* Uses splnet only in the SP case */
75 #define SPLVAR register ulong_t splvar
76 #define NETPRI NET_SPLNET(splvar)
77 #define USERPRI NET_SPLX(splvar)
81 * On HP, the global lock is an alpha semaphore, hence it is automatically
82 * released and reacquired aroubd a sleep() and wakeup().
85 #define afs_osi_Sleep(x) sleep((caddr_t) x,PZERO-2)
86 #define osi_NullHandle(x) ((x)->proc == (caddr_t) 0)
88 extern caddr_t kmem_alloc();
89 #include <sys/kthread_iface.h> /* for kt_cred() */
91 /* Expected to be available as a patch from HP */
92 /* See section D of the top level README for details */
95 #endif /* _OSI_MACHDEP_H_ */