1 /* Copyright (C) 1995 Transarc Corporation - All rights reserved. */
4 * HPUX OSI header file. Extends afs_osi.h.
6 * afs_osi.h includes this file, which is the only way this file should
7 * be included in a source file. This file can redefine macros declared in
11 #ifndef _OSI_MACHDEP_H_
12 #define _OSI_MACHDEP_H_
14 #include "../h/kern_sem.h"
17 extern struct timeval time;
18 #define osi_Time() (time.tv_sec)
25 #define AFS_UCRED ucred
26 #define AFS_PROC proc_t
28 #define osi_vnhold(avc, r) do { VN_HOLD((struct vnode *)(avc)); } while(0)
29 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,aresid) \
30 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(aresid),0)
34 #define getpid() (afs_uint32)p_pid(u.u_procp)
36 #define getppid() (afs_uint32)p_ppid(u.u_procp)
40 * Global lock support.
42 * HP uses global mutex to protect afs land
45 extern sema_t afs_global_sema;
47 extern void osi_InitGlock(void);
49 extern void afsHash(int nbuckets);
50 extern sv_sema_t *afsHashInsertFind(tid_t key);
51 extern sv_sema_t *afsHashFind(tid_t key);
52 extern void afsHashRelease(tid_t key);
54 #define AFS_GLOCK_PID kt_tid(u.u_kthreadp)
55 #define AFS_SAVE_SEMA afsHashInsertFind(AFS_GLOCK_PID)
56 #define AFS_FIND_SEMA afsHashFind(AFS_GLOCK_PID)
57 #define AFS_GLOCK() MP_PXSEMA(&afs_global_sema, AFS_SAVE_SEMA)
58 #define AFS_GUNLOCK() (AFS_ASSERT_GLOCK(), MP_VXSEMA(&afs_global_sema,AFS_FIND_SEMA), (!uniprocessor ? (afsHashRelease(AFS_GLOCK_PID),0) : 0))
59 #define ISAFS_GLOCK() (!uniprocessor ? owns_sema(&afs_global_sema):1)
62 #define AFS_RXGUNLOCK()
63 #define ISAFS_RXGLOCK() 1
65 /* Uses splnet only in the SP case */
66 #define SPLVAR register ulong_t splvar
67 #define NETPRI NET_SPLNET(splvar)
68 #define USERPRI NET_SPLX(splvar)
72 * On HP, the global lock is an alpha semaphore, hence it is automatically
73 * released and reacquired aroubd a sleep() and wakeup().
76 #define afs_osi_Sleep(x) sleep((caddr_t) x,PZERO-2)
77 #define afs_osi_Wakeup(x) wakeup((caddr_t) x)
78 #define osi_NullHandle(x) ((x)->proc == (caddr_t) 0)
80 extern caddr_t kmem_alloc();
81 #include <sys/kthread_iface.h> /* for kt_cred() */
83 #endif /* _OSI_MACHDEP_H_ */