afs-suser-consistent-20040728
[openafs.git] / src / afs / SOLARIS / osi_machdep.h
index ef27ae5..304d400 100644 (file)
@@ -19,7 +19,7 @@
 #define _OSI_MACHDEP_H_
 
 #ifdef AFS_SUN57_64BIT_ENV
-#include <sys/model.h> /* for get_udatamodel() */
+#include <sys/model.h>         /* for get_udatamodel() */
 #endif
 
 #define getpid()               curproc->p_pid
  * Time related macros
  */
 #define        afs_hz      hz
+#ifdef AFS_SUN59_ENV
+#define osi_Time() local_osi_Time()
+extern void gethrestime(timespec_t *);
+static int
+local_osi_Time()
+{
+    timespec_t start;
+    gethrestime(&start);
+    return start.tv_sec;
+}
+#else
 #define osi_Time() (hrestime.tv_sec)
+#endif
 
 #undef afs_osi_Alloc_NoSleep
 extern void *afs_osi_Alloc_NoSleep(size_t size);
@@ -48,7 +60,7 @@ extern void *afs_osi_Alloc_NoSleep(size_t size);
 #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
 
-#define        afs_suser           suser
+#define        afs_suser(x)        suser(x)
 
 
 #ifdef KERNEL
@@ -59,7 +71,7 @@ extern void *afs_osi_Alloc_NoSleep(size_t size);
 extern kmutex_t afs_global_lock;
 extern kmutex_t afs_rxglobal_lock;
 
-#define AFS_GLOCK()    mutex_enter(&afs_global_lock);          
+#define AFS_GLOCK()    mutex_enter(&afs_global_lock);
 #define AFS_GUNLOCK()  mutex_exit(&afs_global_lock);
 #define ISAFS_GLOCK()  mutex_owned(&afs_global_lock)
 
@@ -70,10 +82,10 @@ extern kmutex_t afs_rxglobal_lock;
 
 
 /* Associate the Berkley signal equivalent lock types to System V's */
-#define        LOCK_SH 1       /* F_RDLCK */
-#define        LOCK_EX 2       /* F_WRLCK */
-#define        LOCK_NB 4       /* XXX */
-#define        LOCK_UN 8       /* F_UNLCK */
+#define        LOCK_SH 1               /* F_RDLCK */
+#define        LOCK_EX 2               /* F_WRLCK */
+#define        LOCK_NB 4               /* XXX */
+#define        LOCK_UN 8               /* F_UNLCK */
 
 #ifndef        IO_APPEND
 #define        IO_APPEND       FAPPEND
@@ -90,8 +102,7 @@ extern kmutex_t afs_rxglobal_lock;
 #undef AfsLargeFileUio
 #define AfsLargeFileUio(uio)       ( (uio)->_uio_offset._p._u ? 1 : 0 )
 #undef AfsLargeFileSize
-#define AfsLargeFileSize(pos, off) ( ((offset_t)(pos)+(offset_t)(off) > (offset_t)MAXOFF_T)?1:0)
+#define AfsLargeFileSize(pos, off) ( ((offset_t)(pos)+(offset_t)(off) > (offset_t)0x7fffffff)?1:0)
 #endif
 
 #endif /* _OSI_MACHDEP_H_ */
-