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 * AIX 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_
22 #undef osi_ThreadUnique
23 #define osi_ThreadUnique() thread_self()
27 #define osi_Time() (time)
29 typedef struct ucred afs_ucred_t;
30 typedef struct proc afs_proc_t;
32 #define afs_bufferpages v.v_bufhw
34 #define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while (0)
37 #define gop_lookupname(fnamep,segflg,followlink,compvpp) \
38 lookupvp((fnamep), (followlink), (compvpp), &afs_osi_cred)
40 #undef gop_lookupname_user
41 #define gop_lookupname_user(fnamep,segflg,followlink,compvpp) \
42 lookupvp((fnamep), (followlink), (compvpp), &afs_osi_cred)
48 /* #undef getpid getpid() provided by native kernel */
50 #define get_ulimit() (ulimit(GET_FSIZE, 0) << UBSHIFT)
52 #include <sys/lockl.h>
53 #include <sys/lock_def.h>
54 #include <sys/lock_alloc.h>
55 #include <sys/sleep.h>
57 extern simple_lock_data afs_global_lock;
58 #define AFS_GLOCK() do { \
59 if (lock_mine((void *)&afs_global_lock)) \
60 osi_Panic("AFS_GLOCK %s %d", \
61 __FILE__, __LINE__); \
62 simple_lock((void *)&afs_global_lock); \
64 #define AFS_GUNLOCK() do { \
65 if (!lock_mine((void *)&afs_global_lock)) \
66 osi_Panic("AFS_GUNLOCK %s %d", \
67 __FILE__, __LINE__); \
68 simple_unlock((void *)&afs_global_lock); \
70 #define ISAFS_GLOCK() lock_mine((void *)&afs_global_lock)
72 #if defined(AFS_AIX41_ENV)
73 #define osi_InitGlock() \
75 lock_alloc((void *)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1); \
76 simple_lock_init((void *)&afs_global_lock); \
79 #define osi_InitGlock() \
80 mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL)
83 /* Reading the current proc name from kernelspace is difficult. It is
84 * probably possible via indexing into v.vb_proc, but for now don't bother.
85 * To actually obtain the proc name, look at afs_procsize_init and
86 * src/afs/AIX/osi_gcpags.c for how to look at the process list */
87 #define osi_procname(procname, size) strncpy(procname, "", size)
89 #endif /* _OSI_MACHDEP_H_ */