[OpenAFS-devel] AIX 5.1

Hartmut Reuter reuter@rzg.mpg.de
Thu, 12 Sep 2002 15:40:05 +0200


This is a multi-part message in MIME format.
--------------090201090401020206000303
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit


Here is the big patch to support AIX 5.1!

Some remarks:

This port is not perfect. I thought it would be nice for the 
OpenAFS-community to have some thing to start with and to play with. 
However, we are running the client on production systems right now and I 
also built and ran a fileserver for testing (namei of course).

We have only machines with 32-bit kernel. Therefore this patch presently 
will allow only to build the AFS-client for those machines. But it 
should not be really difficult to extend it for the 64-bit kernel. 
Probably you want to have separate MODLOAD (better DKLOAD) 
subdirectories in src/libafs in this case.

The code supports large file support for AFS under AIX 5.1 as it does 
for AIX 4.2, Linux 2.4 and Solaris 8 (only on 64-bit machines). This, 
however, is presently only usefull with MR-AFS fileservers.

If you see errors when using "cp -p ..." then your system needs a patch 
from IBM which replaces 'cp', 'mv', the libc.a and adds some files in 
/usr/lib/security/acl.

There are also some other changes mainly for debuging: better traces for 
sleep and wake-up and ifdef-ed for performance tests against the network.

With the afs_dynamic_auth we still see a strange side-effect that "llq" 
complaines about a unknown group-id. If you login via ssh without 
authentication (but with token-transfer) you don't see this error. At 
the moment we can live with this problem, but any ideas are appreciated.

Hartmut
-----------------------------------------------------------------
Hartmut Reuter                           e-mail reuter@rzg.mpg.de
					   phone +49-89-3299-1328
RZG (Rechenzentrum Garching)               fax   +49-89-3299-1301
Computing Center of the Max-Planck-Gesellschaft (MPG) and the
Institut fuer Plasmaphysik (IPP)
-----------------------------------------------------------------

--------------090201090401020206000303
Content-Type: text/plain;
 name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="diff"

Index: Makefile.in
===================================================================
RCS file: /cvs/openafs/Makefile.in,v
retrieving revision 1.42
diff -u -r1.42 Makefile.in
--- Makefile.in	2002/07/26 05:33:59	1.42
+++ Makefile.in	2002/09/12 13:30:48
@@ -258,7 +258,7 @@
 vfsck:	vol
 	set -x; \
 	case ${SYS_NAME} in \
-	sgi_* | *linux* | rs_aix42 | ppc_darwin* | hp_ux* | *fbsd* | *_obsd* | *_nbsd* ) \
+	sgi_* | *linux* | rs_aix* | ppc_darwin* | hp_ux* | *fbsd* | *_obsd* | *_nbsd* ) \
 		echo skip vfsck for ${SYS_NAME} ;; \
 	 * ) \
 		${COMPILE_PART1} vfsck ${COMPILE_PART2} ;; \
@@ -269,7 +269,7 @@
 	case ${SYS_NAME} in \
 	sgi_* ) \
 		${COMPILE_PART1} sgistuff ${COMPILE_PART2} ;; \
-	rs_aix42 ) \
+	rs_aix42 | rs_aix51 ) \
 		${COMPILE_PART1} tsm41 ${COMPILE_PART2} ;; \
 	alpha_dux* ) \
 		${COMPILE_PART1} sia ${COMPILE_PART2} ;; \
@@ -279,7 +279,7 @@
 		echo Skipping pam/login for parisc_linux24 ;; \
 	sun4x_* | sunx86_* | hp_ux11* | *linux* | *fbsd* ) \
 		${COMPILE_PART1} pam ${COMPILE_PART2} ;; \
-	ppc_darwin* | *_obsd* | *_nbsd* ) \
+	ppc_darwin* | *_obsd* | *_nbsd* | rs_aix5* ) \
 		echo Skipping login for ${SYS_NAME} ;; \
 	* ) \
 		${COMPILE_PART1} login ${COMPILE_PART2} ;; \
Index: src/afs/afs.h
===================================================================
RCS file: /cvs/openafs/src/afs/afs.h,v
retrieving revision 1.27
diff -u -r1.27 afs.h
--- src/afs/afs.h	2002/07/31 22:15:16	1.27
+++ src/afs/afs.h	2002/09/12 13:30:59
@@ -616,7 +616,11 @@
 #ifdef	AFS_AIX32_ENV
     afs_lock_t pvmlock;
     vmhandle_t vmh;
+#if defined(AFS_AIX51_ENV)
+    vmid_t segid;
+#else
     int  segid;
+#endif
     struct ucred *credp;
 #endif
 #ifdef AFS_AIX_ENV
@@ -868,7 +872,11 @@
 #if defined(AFS_LINUX_64BIT_KERNEL)
     long inode;	 		/* Unix inode for this chunk */
 #else
+#if defined(AFS_AIX51_ENV)
+    ino_t     inode;		/* Unix inode for this chunk */
+#else
     afs_int32 inode;		/* Unix inode for this chunk */
+#endif
 #endif
 #endif
     afs_int32 chunkBytes;	/* Num bytes in this chunk */
Index: src/afs/afs_daemons.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_daemons.c,v
retrieving revision 1.15
diff -u -r1.15 afs_daemons.c
--- src/afs/afs_daemons.c	2002/03/25 17:26:51	1.15
+++ src/afs/afs_daemons.c	2002/09/12 13:30:59
@@ -48,7 +48,7 @@
 /* PAG garbage collection */
 /* We induce a compile error if param.h does not define AFS_GCPAGS */
 afs_int32 afs_gcpags=AFS_GCPAGS;
-afs_int32 afs_gcpags_procsize;
+afs_int32 afs_gcpags_procsize = 0;
 
 afs_int32 afs_CheckServerDaemonStarted = 0;
 afs_int32 PROBE_INTERVAL=180;	/* default to 3 min */
Index: src/afs/afs_dcache.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_dcache.c,v
retrieving revision 1.18
diff -u -r1.18 afs_dcache.c
--- src/afs/afs_dcache.c	2002/05/09 20:37:29	1.18
+++ src/afs/afs_dcache.c	2002/09/12 13:31:00
@@ -1334,7 +1334,9 @@
 	    osi_FreeLargeSpace(tbuffer);
 	    return EIO;
 	}
-	afs_Trace1(afs_iclSetp, CM_TRACE_STOREPROC2, ICL_TYPE_INT32, got);
+	afs_Trace2(afs_iclSetp, CM_TRACE_STOREPROC2, 
+			ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(*tbuffer),
+			ICL_TYPE_INT32, got);
 	RX_AFS_GUNLOCK();
 	code = rx_Write(acall, tbuffer, got);  /* writing 0 bytes will
 	* push a short packet.  Is that really what we want, just because the
@@ -1417,6 +1419,7 @@
     (*abytesXferredP) = 0;
 #endif /* AFS_NOSTATS */
     tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
+    adc->validPos = abase;
     do {
 	if (moredata) {
 	    RX_AFS_GUNLOCK();
@@ -1449,9 +1452,17 @@
 #endif				/* AFS_NOSTATS */
 	while (length > 0) {
 	    tlen = (length > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : length);
+#ifdef RX_KERNEL_TRACE
+	    afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP,
+			ICL_TYPE_STRING, "before rx_Read");
+#endif
 	    RX_AFS_GUNLOCK();
 	    code = rx_Read(acall, tbuffer, tlen);
 	    RX_AFS_GLOCK();
+#ifdef RX_KERNEL_TRACE
+	    afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP,
+			ICL_TYPE_STRING, "after rx_Read");
+#endif
 #ifndef AFS_NOSTATS
 	    (*abytesXferredP) += code;
 #endif				/* AFS_NOSTATS */
@@ -1470,12 +1481,12 @@
 	    abase += tlen;
 	    length -= tlen;
 	    adc->validPos = abase;
-	    afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT,
+	    if (afs_osi_Wakeup(&adc->validPos) == 0)
+	        afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE,
 		       ICL_TYPE_STRING, __FILE__,
 		       ICL_TYPE_INT32, __LINE__,
 		       ICL_TYPE_POINTER, adc,
 		       ICL_TYPE_INT32, adc->dflags);
-	    afs_osi_Wakeup(&adc->validPos);
 	}
     } while (moredata);
     osi_FreeLargeSpace(tbuffer);
@@ -2088,7 +2099,12 @@
 	tdc->validPos = Position;	/*  which is AFS_CHUNKBASE(abyte) */
 	if (tdc->mflags & DFFetchReq) {
 	    tdc->mflags &= ~DFFetchReq;
-	    afs_osi_Wakeup(&tdc->validPos);
+	    if (afs_osi_Wakeup(&tdc->validPos) == 0)
+	        afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE,
+		       ICL_TYPE_STRING, __FILE__,
+		       ICL_TYPE_INT32, __LINE__,
+		       ICL_TYPE_POINTER, tdc,
+		       ICL_TYPE_INT32, tdc->dflags);
 	}
 	tsmall = (struct tlocal1 *) osi_AllocLargeSpace(sizeof(struct tlocal1));
 	setVcacheStatus = 0;
@@ -2185,8 +2201,6 @@
 		    } else {
 		        bytes = rx_Read(tcall, (char *)&length_hi, sizeof(afs_int32));
 			RX_AFS_GLOCK();
-			afs_Trace2(afs_iclSetp, CM_TRACE_FETCH64CODE,
-				   ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code);
 		        if (bytes == sizeof(afs_int32)) {
 			    length_hi = ntohl(length_hi);
 		        } else {
@@ -2396,12 +2410,12 @@
 #endif /* AFS_NOSTATS */
 
 	tdc->dflags &= ~DFFetching;
-	afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT,
+	if (afs_osi_Wakeup(&tdc->validPos) == 0)
+	    afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE,
 		   ICL_TYPE_STRING, __FILE__,
 		   ICL_TYPE_INT32, __LINE__,
 		   ICL_TYPE_POINTER, tdc,
 		   ICL_TYPE_INT32, tdc->dflags);
-	afs_osi_Wakeup(&tdc->validPos);
 	if (avc->execsOrWriters == 0) tdc->f.states &= ~DWriting;
 
 	/* now, if code != 0, we have an error and should punt.
@@ -2487,7 +2501,7 @@
 	    *aoffset = abyte;
 	else
 	    *aoffset = AFS_CHUNKOFFSET(abyte);
-	*alen = *aoffset + tdc->f.chunkBytes - abyte;
+	*alen = (tdc->f.chunkBytes - *aoffset);
 	ReleaseSharedLock(&tdc->lock);
     }
 
Index: src/afs/afs_init.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_init.c,v
retrieving revision 1.15
diff -u -r1.15 afs_init.c
--- src/afs/afs_init.c	2002/05/21 06:35:57	1.15
+++ src/afs/afs_init.c	2002/09/12 13:31:00
@@ -229,7 +229,7 @@
 #endif /* AFS_VM_RDWR_ENV */
 #endif /* AFS_64BIT_CLIENT */
 
-#if defined(AFS_AIX_ENV)
+#if defined(AFS_AIX_ENV) && !defined(AFS_AIX51_ENV)
     {
 	static void afs_procsize_init(void);
 
@@ -569,7 +569,7 @@
 
 } /*afs_ResourceInit*/
 
-#if defined(AFS_AIX_ENV)
+#if defined(AFS_AIX_ENV) && !defined(AFS_AIX51_ENV)
 
 /*
  * AIX dynamic sizeof(struct proc)
@@ -616,6 +616,9 @@
 {
     struct proc *p0;	/* pointer to process 0 */
     struct proc *pN;	/* pointer to process 0's first child */
+#ifdef AFS_AIX51_ENV
+    struct pvproc *pV;
+#endif
     int pN_index;
     ptrdiff_t pN_offset;
     int procsize;
@@ -626,7 +629,17 @@
 	return;
     }
 
+#ifdef AFS_AIX51_ENV
+    pN = (struct proc *)0;
+    pV = p0->p_pvprocp;
+    if (pV) {
+	pV = pV->pv_child;
+	if (pV)
+	    pN = pV->pv_procp;
+    }
+#else
     pN = p0->p_child;
+#endif
     if (!pN) {
 	afs_gcpags = AFS_GCPAGS_EPROCN;
 	return;
@@ -663,7 +676,6 @@
 
     afs_gcpags_procsize = procsize;
 }
-
 #endif
 
 /*
Index: src/afs/afs_osi.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_osi.c,v
retrieving revision 1.17
diff -u -r1.17 afs_osi.c
--- src/afs/afs_osi.c	2002/07/31 22:29:38	1.17
+++ src/afs/afs_osi.c	2002/09/12 13:31:00
@@ -718,6 +718,9 @@
 #endif	/* AFS_SGI_ENV */
 
 #if defined(AFS_AIX_ENV)
+#ifdef AFS_AIX51_ENV
+#define max_proc v.ve_proc
+#endif
 void afs_osi_TraverseProcTable()
 {
     struct proc *p;
@@ -731,17 +734,28 @@
     if (!afs_gcpags_procsize)
 	return;
 
+#ifndef AFS_AIX51_ENV
     simple_lock(&proc_tbl_lock);
+#endif
     for (p = (struct proc *)v.vb_proc, i = 0;
          p < max_proc;
 	 p = (struct proc *)((char *)p + afs_gcpags_procsize), i++) {
 
+#ifdef AFS_AIX51_ENV
+	if (p->p_pvprocp->pv_stat == SNONE)
+	    continue;
+	if (p->p_pvprocp->pv_stat == SIDL)
+	    continue;
+	if (p->p_pvprocp->pv_stat == SEXIT)
+	    continue;
+#else
 	if (p->p_stat == SNONE)
 	    continue;
 	if (p->p_stat == SIDL)
 	    continue;
 	if (p->p_stat == SEXIT)
 	    continue;
+#endif
 
 	/* sanity check */
 
@@ -759,7 +773,9 @@
 
 	afs_GCPAGs_perproc_func(p);
     }
+#ifndef AFS_AIX51_ENV
     simple_unlock(&proc_tbl_lock);
+#endif
 }
 #endif
 
@@ -898,16 +914,28 @@
     /* simple_lock(&proc_tbl_lock); */
     if (pproc->p_adspace != NULLSEGVAL) {
 
+#ifdef AFS_AIX51_ENV
+	simple_lock(&pproc->p_pvprocp->pv_lock);
+#else
 	simple_lock(&pproc->p_lock);
+#endif
 
 	if (pproc->p_threadcount &&
+#ifdef AFS_AIX51_ENV
+	    pproc->p_pvprocp->pv_threadlist) {
+#else
 	    pproc->p_threadlist) {
+#endif
 
 	    /*
 	     * arbitrarily pick the first thread in pproc
 	     */
 	    struct thread *pproc_thread =
+#ifdef AFS_AIX51_ENV
+	        pproc->p_pvprocp->pv_threadlist;
+#else
 		pproc->p_threadlist;
+#endif
 
 	    /*
 	     * location of 'struct user' in pproc's
@@ -930,7 +958,11 @@
 			  &dp, SYS_ADSPACE);
 	}
 
+#ifdef AFS_AIX51_ENV
+	simple_unlock(&pproc->p_pvprocp->pv_lock);
+#else
 	simple_unlock(&pproc->p_lock);
+#endif
     }
     /* simple_unlock(&proc_tbl_lock); */
     if (xm == XMEM_SUCC) {
Index: src/afs/afs_osi_pag.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_osi_pag.c,v
retrieving revision 1.8
diff -u -r1.8 afs_osi_pag.c
--- src/afs/afs_osi_pag.c	2001/07/12 19:58:15	1.8
+++ src/afs/afs_osi_pag.c	2002/09/12 13:31:00
@@ -437,16 +437,27 @@
     g1 = cred->cr_groups[2];
 #else
 #ifdef	AFS_AIX_ENV
+#ifdef AFS_AIX51_ENV
+    if (kcred_getpag(cred, PAG_AFS, &pag) < 0 || pag == 0)
+	pag = NOPAG;
+    return pag;
+#else
     if (cred->cr_ngrps < 2) {
 	return NOPAG;
     }
+#endif
 #else
 #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV)
     if (cred->cr_ngroups < 2) return NOPAG;
 #endif
 #endif
+#ifdef AFS_AIX51_ENV
+    g0 = cred->cr_groupset.gs_union.un_groups[0];
+    g1 = cred->cr_groupset.gs_union.un_groups[1];
+#else
     g0 = cred->cr_groups[0];
     g1 = cred->cr_groups[1];
+#endif
 #endif
     pag = (afs_int32)afs_get_pag_from_groups(g0, g1);
     return pag;
Index: src/afs/afs_pioctl.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_pioctl.c,v
retrieving revision 1.38
diff -u -r1.38 afs_pioctl.c
--- src/afs/afs_pioctl.c	2002/07/31 22:15:16	1.38
+++ src/afs/afs_pioctl.c	2002/09/12 13:31:01
@@ -285,6 +285,9 @@
        default:
 
 	 code = EINVAL;
+#ifdef AFS_AIX51_ENV
+	 code = ENOSYS;
+#endif
 	 break;
        }
        return code;		/* so far, none implemented */
@@ -361,13 +364,21 @@
 #ifndef AFS_HPUX102_ENV
 #if !defined(AFS_SGI_ENV)
 #ifdef	AFS_AIX32_ENV
+#ifdef AFS_AIX51_ENV
+kioctl(fdes, com, arg, ext, arg2, arg3)
+     caddr_t arg2, arg3;
+#else
 kioctl(fdes, com, arg, ext)
+#endif
      int fdes, com;
      caddr_t arg, ext;
 {
   struct a {
     int fd, com;
     caddr_t arg, ext;
+#ifdef AFS_AIX51_ENV
+     caddr_t arg2, arg3;
+#endif
   } u_uap, *uap = &u_uap;
 #else
 #ifdef	AFS_SUN5_ENV
@@ -463,6 +474,12 @@
       uap->fd = fdes;
       uap->com = com;
       uap->arg = arg;
+#ifdef AFS_AIX51_ENV
+      uap->arg2 = arg2;
+      uap->arg3 = arg3;
+#endif
+
+  
       if (setuerror(getf(uap->fd, &fd))) {
 	return -1;
     }
@@ -584,7 +601,11 @@
       if (!ioctlDone) {
 #ifdef	AFS_AIX41_ENV
 	  ufdrele(uap->fd);
+#ifdef AFS_AIX51_ENV
+	  code = okioctl(fdes, com, arg, ext, arg2, arg3);
+#else
 	  code = okioctl(fdes, com, arg, ext);
+#endif
 	  return code;
 #else
 #ifdef	AFS_AIX32_ENV
@@ -3520,8 +3541,13 @@
     setuerror(0);	
 #endif
     newcred->cr_gid = RMTUSER_REQ;
+#ifdef AFS_AIX51_ENV
+    newcred->cr_groupset.gs_union.un_groups[0] = g0;
+    newcred->cr_groupset.gs_union.un_groups[1] = g1;
+#else
     newcred->cr_groups[0] = g0;
     newcred->cr_groups[1] = g1;
+#endif
 #ifdef AFS_AIX_ENV
     newcred->cr_ngrps = 2;
 #else
Index: src/afs/afs_trace.et
===================================================================
RCS file: /cvs/openafs/src/afs/afs_trace.et,v
retrieving revision 1.11
diff -u -r1.11 afs_trace.et
--- src/afs/afs_trace.et	2002/07/22 03:47:24	1.11
+++ src/afs/afs_trace.et	2002/09/12 13:31:01
@@ -150,15 +150,23 @@
 	ec	CM_TRACE_STOREDATA64, "StoreData64: fid (%d:%d.%d.%d) offs (0x%x, 0x%x) len (0x%x, 0x%x) file length (0x%x, 0x%x)"
 	ec	CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)"
 	ec	CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)"
-	ec	CM_TRACE_STOREPROC2, "StoreProc got 0x%x"
+	ec	CM_TRACE_STOREPROC2, "StoreProc got (0x%x, 0x%x) length 0x%x"
 	ec	CM_TRACE_ADJUSTSIZE, "AdjustSize index %d oldSize %d newSize %d blocksUsed %d"
 	ec	CM_TRACE_SETLENGTH, "%s line %d: m.Length was (0x%x, 0x%x), now (0x%x, 0x%x)"
-	ec	CM_TRACE_DCACHEWAIT, "%s line %d: sleeping or waiting for 0x%x flags 0x%x" 
-	ec	CM_TRACE_VNODEREAD, "UFSRead: tdc 0x%x, offset (0x%x, 0x%x) len (0x%x 0x%x)" 
+	ec	CM_TRACE_DCACHEWAIT, "%s line %d: waiting for 0x%x flags 0x%x" 
+	ec	CM_TRACE_VNODEREAD, "UFSRead: tdc 0x%x, offset (0x%x, 0x%x) len (0x%x, 0x%x)" 
 	ec	CM_TRACE_SLEEP, "Sleep: evp 0x%x, count %d seq 0x%x evp->seq 0x%x" 
 	ec	CM_TRACE_WAKE, "Wakeup: evp 0x%x, evp->seq 0x%x"
 	ec	CM_TRACE_DENTRYDELETE, "d_delete inode 0x%x d_name %s/%s"
 	ec	CM_TRACE_DENTRYIPUT, "d_iput inode 0x%x d_name %s/%s"
 	ec	CM_TRACE_TRYFLUSHDCACHECHILDREN, "TryFlushDcacheChildren ip 0x%x"
+	ec	CM_TRACE_DCACHEWAKE, "%s line %d: waked up waiter(s) for 0x%x flags 0x%x" 
+	ec	CM_TRACE_VERSIONNO, "At offset (0x%x, 0x%x) vc shows (0x%x, 0x%x), dc (0x%x, 0x%x)"
+	ec	CM_TRACE_TIMESTAMP, "%s"
+	ec	CM_TRACE_RXSLEEP, "osi_rxSleep() at %s line %d"
+	ec	CM_TRACE_RXWAKE, "osi_rxWakeup() at %s line %d"
+	ec	CM_TRACE_GNGETACL, "Gn_getacl vp 0x%lx (returns 0x%x)"
+	ec	CM_TRACE_EINVAL, "EINVAL in %s at line %d"
+	ec	CM_TRACE_VNODEREAD2, "negative length tdc 0x%lx validPos (0x%x, 0x%x) chunkBytes 0x%x dflags 0x%x"
 end
 
Index: src/afs/sysincludes.h
===================================================================
RCS file: /cvs/openafs/src/afs/sysincludes.h,v
retrieving revision 1.9
diff -u -r1.9 sysincludes.h
--- src/afs/sysincludes.h	2002/06/08 04:43:34	1.9
+++ src/afs/sysincludes.h	2002/09/12 13:31:01
@@ -102,6 +102,9 @@
 #ifdef AFS_AIX41_ENV
 #include "sys/statfs.h"
 #endif
+#ifdef AFS_AIX51_ENV
+#include "sys/acl.h"
+#endif
 #include "../h/file.h"
 #include "../h/fullstat.h"
 #include "../h/vattr.h"
Index: src/afs/AIX/osi_config.c
===================================================================
RCS file: /cvs/openafs/src/afs/AIX/osi_config.c,v
retrieving revision 1.4
diff -u -r1.4 osi_config.c
--- src/afs/AIX/osi_config.c	2001/07/12 19:58:18	1.4
+++ src/afs/AIX/osi_config.c	2002/09/12 13:31:01
@@ -260,7 +260,9 @@
 	{ (void *) &vnodefops,		"vnodefops"		},
 	{ (void *) &ifnet,		"ifnet"			},
  	{ (void *) &jfs_icache_lock,	"jfs_icache_lock"	},
+#ifndef AFS_AIX51_ENV
  	{ (void *) &proc_tbl_lock,	"proc_tbl_lock"		},
+#endif
 	{ 0,				0			},
 };
 
Index: src/afs/AIX/osi_groups.c
===================================================================
RCS file: /cvs/openafs/src/afs/AIX/osi_groups.c,v
retrieving revision 1.4
diff -u -r1.4 osi_groups.c
--- src/afs/AIX/osi_groups.c	2001/07/12 19:58:18	1.4
+++ src/afs/AIX/osi_groups.c	2002/09/12 13:31:01
@@ -36,6 +36,7 @@
     gid_t *gidset,
     int change_parent);
 
+#ifndef AFS_AIX5_ENV
 int
 setgroups(ngroups, gidset)
     int ngroups;
@@ -77,8 +78,8 @@
     }
     return code;
 }
+#endif
 
-
 int
 setpag(cred, pagvalue, newpag, change_parent)
     struct ucred **cred;
@@ -91,6 +92,7 @@
     int j;
 
     AFS_STATCNT(setpag);
+#ifndef AFS_AIX51_ENV
     ngroups = afs_getgroups(*cred, NGROUPS, gidset);
     if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
 	/* We will have to shift grouplist to make room for pag */
@@ -102,15 +104,29 @@
  	}
 	ngroups += 2;
     }
+#endif
     *newpag = (pagvalue == -1 ? genpag(): pagvalue);
+#ifdef AFS_AIX51_ENV
+    if (change_parent) {
+	code = kcred_setpag(*cred, PAG_AFS, *newpag);
+    } else {
+	struct ucred *newcr = crdup(*cred);
+
+	crset(newcr);
+	code = kcred_setpag(newcr, PAG_AFS, *newpag);
+	*cred = newcr;
+    }
+#else
     afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
     if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
 	return (setuerror(code), code);
     }
+#endif
     return code;
 }
 
 
+#ifndef AFS_AIX51_ENV
 static int
 afs_getgroups(
     struct ucred *cred,
@@ -198,3 +214,4 @@
     }
     return 0;
 }
+#endif
Index: src/afs/AIX/osi_vfsops.c
===================================================================
RCS file: /cvs/openafs/src/afs/AIX/osi_vfsops.c,v
retrieving revision 1.6
diff -u -r1.6 osi_vfsops.c
--- src/afs/AIX/osi_vfsops.c	2002/03/25 17:11:51	1.6
+++ src/afs/AIX/osi_vfsops.c	2002/09/12 13:31:01
@@ -58,6 +58,7 @@
 
     afs_globalVFS = afsp;
     afsp->vfs_bsize = 8192;
+    afsp->vfs_count = 0;
 #ifdef AFS_64BIT_CLIENT
     afsp->vfs_flag |= VFS_DEVMOUNT;
 #endif /* AFS_64BIT_CLIENT */
@@ -233,6 +234,9 @@
 	afs_vget,
 	afs_badop,	/* vfs_cntl */
 	afs_badop	/* vfs_quotactl */
+#ifdef AFS_AIX51_ENV
+	,afs_badop	/* vfs_syncvfs */
+#endif
 };
 
 /*
Index: src/afs/AIX/osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/AIX/osi_vnodeops.c,v
retrieving revision 1.8
diff -u -r1.8 osi_vnodeops.c
--- src/afs/AIX/osi_vnodeops.c	2002/03/25 17:11:51	1.8
+++ src/afs/AIX/osi_vnodeops.c	2002/09/12 13:31:02
@@ -24,6 +24,9 @@
 #include "../h/chownx.h"
 #include "../h/systm.h"
 #include "../h/access.h"
+#ifdef AFS_AIX51_ENV
+#include "../h/acl.h"
+#endif
 #include "../rpc/types.h"
 #include "../afs/osi_vfs.h"
 #include "../netinet/in.h"
@@ -145,13 +148,13 @@
 	afs_gn_getpcl,
 	afs_gn_setpcl,
 	afs_gn_enosys,	/* vn_seek */
-	afs_gn_enosys,	/* vn_spare0 */
-	afs_gn_enosys,	/* vn_spare1 */
-	afs_gn_enosys,	/* vn_spare2 */
-	afs_gn_enosys,	/* vn_spare3 */
-	afs_gn_enosys,	/* vn_spare4 */
-	afs_gn_enosys,	/* vn_spare5 */
-	afs_gn_enosys,	/* vn_spare6 */
+	afs_gn_enosys,	/* vn_fsync_range */
+	afs_gn_enosys,	/* vn_create_attr */
+	afs_gn_enosys,	/* vn_finfo */ 
+	afs_gn_enosys,	/* vn_map_lloff */
+	afs_gn_enosys,	/* vn_readdir_eofp */
+	afs_gn_enosys,	/* vn_rdwr_attr */
+	afs_gn_enosys,	/* vn_memcntl */
 	afs_gn_enosys,	/* vn_spare7 */
 	afs_gn_enosys,	/* vn_spare8 */
 	afs_gn_enosys,	/* vn_spare9 */
@@ -161,6 +164,13 @@
 	afs_gn_enosys,	/* vn_spareD */
 	afs_gn_enosys,	/* vn_spareE */
 	afs_gn_enosys	/* vn_spareF */
+#ifdef AFS_AIX51_ENV
+	,afs_gn_enosys, /* pagerBackRange */
+ 	afs_gn_enosys,  /* pagerGetFileSize */
+	afs_gn_enosys,  /* pagerReadAhead */
+	afs_gn_enosys,  /* pagerWriteBehind */
+	afs_gn_enosys   /* pagerEndCopy */
+#endif
 };
 struct vnodeops *afs_ops = &afs_gn_vnodeops;
 
@@ -183,15 +193,20 @@
 
 
 int
-afs_gn_mkdir(dp, name, mode, cred)
+afs_gn_mkdir(dp, name, Mode, cred)
 struct	vnode	*dp;
 char		*name;
-int		mode;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Mode;
+#else
+int		Mode;
+#endif
 struct ucred	*cred;
 {
     struct	vattr	va;
     struct	vnode	*vp;
     int		error;
+    int 	mode = Mode;
 
     AFS_STATCNT(afs_gn_mkdir);
     VATTR_NULL(&va);
@@ -208,16 +223,21 @@
 
 
 int
-afs_gn_mknod(dp, name, mode, dev, cred)
+afs_gn_mknod(dp, name, Mode, dev, cred)
 struct	vnode	*dp;
 char		*name;
-int		mode;
+#ifdef AFS_AIX51_ENV
+int		Mode;
+#else
+int		Mode;
+#endif
 dev_t		dev;
 struct ucred	*cred;
 {
     struct	vattr	va;
     struct	vnode	*vp;
     int		error;
+    int 	mode = Mode;
 
     AFS_STATCNT(afs_gn_mknod);
     VATTR_NULL(&va);
@@ -309,15 +329,20 @@
 
 
 int
-afs_gn_lookup(dp, vpp, name, flags, vattrp, cred)
+afs_gn_lookup(dp, vpp, name, Flags, vattrp, cred)
 struct	vattr	*vattrp;
 struct	vnode	*dp;
 struct	vnode	**vpp;
 char		*name;
-afs_uint32         flags;  /* includes FOLLOW... */
+#ifdef AFS_AIX51_ENV
+int32long64_t      Flags;  /* includes FOLLOW... */
+#else
+afs_uint32         Flags;  /* includes FOLLOW... */
+#endif
 struct ucred	*cred;
 {
    int		error;
+   int		flags = Flags;
 
    AFS_STATCNT(afs_gn_lookup);
     error = afs_lookup(dp, name, vpp, cred);
@@ -346,10 +371,15 @@
 
 
 int
-afs_gn_open(vp, flags, ext, vinfop, cred)
+afs_gn_open(vp, Flags, ext, vinfop, cred)
 struct	vnode	*vp;
-int		flags;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Flags;
+ext_t		ext;		/* Ignored in AFS */
+#else
+int		Flags;
 int		ext;		/* Ignored in AFS */
+#endif
 struct ucred	**vinfop;	/* return ptr for fp->f_vinfo, used as fp->f_cred */
 struct ucred	*cred;
 {
@@ -357,6 +387,7 @@
     struct vattr	va;
     struct vcache *tvp = VTOAFS(vp);
     afs_int32 modes;
+    int 	flags = Flags;
 
     AFS_STATCNT(afs_gn_open);
     modes = 0;
@@ -409,18 +440,25 @@
 
 
 int
-afs_gn_create(dp, vpp, flags, name, mode, vinfop, cred)
+afs_gn_create(dp, vpp, Flags, name, Mode, vinfop, cred)
 struct	vnode	*dp;
 struct	vnode	**vpp;
-int		flags;
 char		*name;
-int		mode;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Flags;
+int32long64_t	Mode;
+#else
+int		Flags;
+int		Mode;
+#endif
 struct ucred	**vinfop; /* return ptr for fp->f_vinfo, used as fp->f_cred */
 struct ucred	*cred;
 {
     struct	vattr	va;
     enum	vcexcl	exclusive;
     int		error, modes=0;
+    int 	flags = Flags;
+    int 	mode = Mode;
 
     AFS_STATCNT(afs_gn_create);
     if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT))
@@ -495,14 +533,19 @@
 
 
 int
-afs_gn_close(vp, flags, vinfo, cred)
+afs_gn_close(vp, Flags, vinfo, cred)
 struct	vnode	*vp;
-int		flags;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Flags;
+#else
+int		Flags;
+#endif
 caddr_t		vinfo;		/* Ignored in AFS */
 struct ucred	*cred;
 {
     int		error;
     struct vcache *tvp = VTOAFS(vp);
+    int 	flags = Flags;
 
     AFS_STATCNT(afs_gn_close);
 
@@ -519,15 +562,23 @@
 
 
 int
-afs_gn_map(vp, addr, len, off, flag, cred)
+afs_gn_map(vp, addr, Len, Off, Flag, cred)
 struct	vnode	*vp;
 caddr_t		addr;
-u_int 		len, off, flag;
+#ifdef AFS_AIX51_ENV
+uint32long64_t  Len, Off, Flag;
+#else
+u_int 		Len, Off, Flag;
+#endif
 struct ucred	*cred;
 {
     struct vcache *vcp = VTOAFS(vp);
     struct vrequest treq;
     afs_int32 error;
+    afs_int32 len = Len;
+    afs_int32 off = Off;
+    afs_int32 flag = Flag;
+
     AFS_STATCNT(afs_gn_map);
 #ifdef	notdef
     if (error = afs_InitReq(&treq, cred)) return error;
@@ -580,7 +631,11 @@
 int
 afs_gn_unmap(vp, flag, cred)
 struct	vnode	*vp;
+#ifdef AFS_AIX51_ENV
+int32long64_t	flag;
+#else
 int 		flag;
+#endif
 struct ucred	*cred;
 {
     struct vcache *vcp = VTOAFS(vp);
@@ -602,18 +657,27 @@
 
 
 int
-afs_gn_access(vp, mode, who, cred)
+afs_gn_access(vp, Mode, Who, cred)
 struct	vnode		*vp;
-int			mode;
-int			who;
+#ifdef AFS_AIX51_ENV
+int32long64_t		Mode;
+int32long64_t		Who;
+#else
+int			Mode;
+int			Who;
+#endif
 struct ucred		*cred;
 {
     int	error;
     struct vattr vattr;
+    int mode = Mode;
+    int who = Who;
 
     AFS_STATCNT(afs_gn_access);
-    if (mode & ~0x7)
-	return(EINVAL);
+    if (mode & ~0x7) {
+	error = EINVAL;
+	goto out;
+    }
 
     error = afs_access(vp, mode, cred);
     if (!error) {
@@ -668,16 +732,27 @@
 
 
 int
-afs_gn_setattr(vp, op, arg1, arg2, arg3, cred)
+afs_gn_setattr(vp, Op, Arg1, Arg2, Arg3, cred)
 struct	vnode	*vp;
-int		op;
-int		arg1;
-int		arg2;
-int		arg3;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Op;
+int32long64_t	Arg1;
+int32long64_t	Arg2;
+int32long64_t	Arg3;
+#else
+int		Op;
+int		Arg1;
+int		Arg2;
+int		Arg3;
+#endif
 struct ucred	*cred;
 {
     struct	vattr	va;
     int		error = 0;
+    int		op = Op;
+    int		arg1 = Arg1;
+    int		arg2 = Arg2;
+    int		arg3 = Arg3;
 
    AFS_STATCNT(afs_gn_setattr);
     VATTR_NULL(&va);
@@ -696,7 +771,7 @@
 #ifdef	notdef
 	    error = afs_access(vp, VWRITE, cred);
 	    if (error) 
-		return(error);
+		goto out;
 #endif
 	    if (arg1 & T_SETTIME) {
 		va.va_atime.tv_sec = time;
@@ -707,10 +782,12 @@
 	    }
 	    break;
 	default:
-	    return(EINVAL);
+	    error = EINVAL;
+	    goto out;
     }
 
     error = afs_setattr(vp, &va, cred);
+out:
     afs_Trace2(afs_iclSetp, CM_TRACE_GSETATTR, ICL_TYPE_POINTER, (afs_int32)vp,
 	       ICL_TYPE_LONG, error);
     return(error);
@@ -721,7 +798,11 @@
 int
 afs_gn_fclear(vp, flags, offset, length, vinfo, cred) 
 struct	vnode	*vp;
+#ifdef AFS_AIX51_ENV
+int32long64_t	flags;
+#else
 int		flags;
+#endif
 offset_t	offset;
 offset_t	length;
 caddr_t		vinfo;
@@ -772,8 +853,13 @@
 int
 afs_gn_fsync(vp, flags, vinfo, cred)
 struct	vnode	*vp;
+#ifdef AFS_AIX51_ENV
+int32long64_t	flags;	    /* Not used by AFS */
+int32long64_t	vinfo;	    /* Not used by AFS */
+#else
 int		flags;	    /* Not used by AFS */
 caddr_t		vinfo;	    /* Not used by AFS */
+#endif
 struct ucred	*cred;
 {
    int		error;
@@ -789,7 +875,11 @@
 int
 afs_gn_ftrunc(vp, flags, length, vinfo, cred)
 struct	vnode	*vp;
+#ifdef AFS_AIX51_ENV
+int32long64_t	flags;	    /* Ignored in AFS */
+#else
 int		flags;	    /* Ignored in AFS */
+#endif
 offset_t	length;
 caddr_t		vinfo;	    /* Ignored in AFS */
 struct ucred	*cred;
@@ -811,12 +901,17 @@
 /* Min size of a file which is dumping core before we declare it a page hog. */
 #define MIN_PAGE_HOG_SIZE 8388608
 
-int afs_gn_rdwr(vp, op, flags, ubuf, ext, vinfo, vattrp, cred)
+int afs_gn_rdwr(vp, op, Flags, ubuf, ext, vinfo, vattrp, cred)
 struct	vnode	*vp;
 enum	uio_rw	op;
-int		flags;
-struct	uio	*ubuf;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Flags;
+ext_t		ext;	    /* Ignored in AFS */
+#else
+int		Flags;
 int		ext;	    /* Ignored in AFS */
+#endif
+struct	uio	*ubuf;
 caddr_t		vinfo;	    /* Ignored in AFS */
 struct	vattr	*vattrp;
 struct ucred	*cred;
@@ -825,6 +920,7 @@
     struct vrequest treq;
     int error=0;
     int free_cred = 0;
+    int flags = Flags;
 
     AFS_STATCNT(afs_gn_rdwr);
 
@@ -1141,6 +1237,8 @@
 	     */
 	    if (counter > 0 && code == 0 && xfrOffset == offset) {
 		ObtainWriteLock(&vcp->lock,403);
+		if (xfrOffset > vcp->m.Length)
+		    vcp->m.Length = xfrOffset;
 	        code = afs_DoPartialWrite(vcp, &treq);
 		vcp->states |= CDirty;
 		ReleaseWriteLock(&vcp->lock);
@@ -1326,7 +1424,8 @@
 	    if (code != 0) return code;
 	    lckdat->l_start += (off_t) vattr.va_size;
 	    break;
-	default: return EINVAL;
+	default: 
+	    return EINVAL;
     }
     lckdat->l_whence = 0;
     return 0;
@@ -1341,6 +1440,11 @@
 offset_t	offset;
 struct	eflock	*lckdat;
 struct ucred	*cred;
+#ifdef AFS_AIX51_ENV
+int32long64_t	cmd;
+#else
+int		cmd;
+#endif
 {
    int		error, ncmd=0;
    struct flock	flkd;
@@ -1380,15 +1484,21 @@
 
 
 /* NOTE: In the nfs glue routine (nfs_gn2sun.c) the order was wrong (vp, flags, cmd, arg, ext); was that another typo? */
-int afs_gn_ioctl(vp, cmd, arg, flags, channel, ext)
+int afs_gn_ioctl(vp, Cmd, arg, flags, channel, ext)
 struct	vnode	*vp;
-int		cmd;
+#ifdef AFS_AIX51_ENV
+int32long64_t	Cmd;
+#else
+int		Cmd;
+#endif
 int		arg;
 int		flags;		/* Ignored in AFS */
 int		channel;	/* Ignored in AFS */
 int		ext;		/* Ignored in AFS */
 {
     int	error;
+    int cmd = Cmd;
+
     AFS_STATCNT(afs_gn_ioctl);
     /* This seems to be a perfect fit for our ioctl redirection (afs_xioctl hack); thus the ioctl(2) entry in sysent.c is unaffected in the aix/afs port. */ 
     error = afs_ioctl(vp, cmd, arg);
@@ -1806,7 +1916,24 @@
 	return ret;
 }
 
+#ifdef AFS_AIX51_ENV
+static
+vfs_syncvfs(struct gfs *a, struct vfs *b, int c, struct ucred *d)
+{
+	register glockOwner, ret;
 
+	glockOwner = ISAFS_GLOCK();
+	if (!glockOwner)
+	    AFS_GLOCK();
+	ret = (*Afs_vfsops.vfs_syncvfs)(a, b, c, d);
+	if (!glockOwner)
+	    AFS_GUNLOCK();
+
+	return ret;
+}
+#endif
+
+
 struct vfsops locked_Afs_vfsops = {
 	vfs_mount,
 	vfs_unmount,
@@ -1816,6 +1943,9 @@
 	vfs_vget,
 	vfs_cntl,
 	vfs_quotactl,
+#ifdef AFS_AIX51_ENV
+	vfs_syncvfs
+#endif
 };
 
 static
@@ -1833,7 +1963,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_mkdir(struct vnode *a, char *b, int32long64_t c, struct ucred *d) {
+#else
 vn_mkdir(struct vnode *a, char *b, int c, struct ucred *d) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -1847,7 +1981,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_mknod(struct vnode *a, caddr_t b, int32long64_t c, dev_t d, struct ucred *e) {
+#else
 vn_mknod(struct vnode *a, caddr_t b, int c, dev_t d, struct ucred *e) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -1904,7 +2042,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_lookup(struct vnode *a, struct vnode **b, char *c, int32long64_t d,
+#else
 vn_lookup(struct vnode *a, struct vnode **b, char *c, int d,
+#endif
 	  struct vattr *v, struct ucred *e) {
 	register glockOwner, ret;
 
@@ -1933,7 +2075,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
 vn_open(struct vnode *a, int b, int c, caddr_t *d, struct ucred *e) {
+#else
+vn_open(struct vnode *a, int32long64_t b, ext_t c, caddr_t *d, struct ucred *e) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -1947,8 +2093,13 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_create(struct vnode *a, struct vnode **b, int32long64_t c, caddr_t d
+	  , int32long64_t e, caddr_t *f, struct ucred *g) {
+#else
 vn_create(struct vnode *a, struct vnode **b, int c, caddr_t d
 	  , int e, caddr_t *f, struct ucred *g) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -1990,7 +2141,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_close(struct vnode *a, int32long64_t b, caddr_t c, struct ucred *d) {
+#else
 vn_close(struct vnode *a, int b, caddr_t c, struct ucred *d) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2004,7 +2159,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_map(struct vnode *a, caddr_t b, uint32long64_t c, uint32long64_t d, uint32long64_t e, struct ucred *f) {
+#else
 vn_map(struct vnode *a, caddr_t b, uint c, uint d, uint e, struct ucred *f) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2018,7 +2177,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_unmap(struct vnode *a, int32long64_t b, struct ucred *c) {
+#else
 vn_unmap(struct vnode *a, int b, struct ucred *c) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2032,7 +2195,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_access(struct vnode *a, int32long64_t b, int32long64_t c, struct ucred *d) {
+#else
 vn_access(struct vnode *a, int b, int c, struct ucred *d) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2060,7 +2227,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_setattr(struct vnode *a, int32long64_t b, int32long64_t c, int32long64_t d, int32long64_t e, struct ucred *f) {
+#else
 vn_setattr(struct vnode *a, int b, int c, int d, int e, struct ucred *f) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2074,7 +2245,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_fclear(struct vnode *a, int32long64_t b, offset_t c, offset_t d
+#else
 vn_fclear(struct vnode *a, int b, offset_t c, offset_t d
+#endif
 	  , caddr_t e, struct ucred *f) {
 	register glockOwner, ret;
 
@@ -2089,7 +2264,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_fsync(struct vnode *a, int32long64_t b, int32long64_t c, struct ucred *d) {
+#else
 vn_fsync(struct vnode *a, int b, int c, struct ucred *d) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2103,7 +2282,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_ftrunc(struct vnode *a, int32long64_t b, offset_t c, caddr_t d, struct ucred *e) {
+#else
 vn_ftrunc(struct vnode *a, int b, offset_t c, caddr_t d, struct ucred *e) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2117,8 +2300,13 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_rdwr(struct vnode *a, enum uio_rw b, int32long64_t c, struct uio *d
+	, ext_t e, caddr_t f, struct vattr *v, struct ucred *g) {
+#else
 vn_rdwr(struct vnode *a, enum uio_rw b, int c, struct uio *d
 	, int e, caddr_t f, struct vattr *v, struct ucred *g) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2132,8 +2320,13 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_lockctl(struct vnode *a, offset_t b, struct eflock *c, int32long64_t d
+	   , int (*e)(), ulong32int64_t *f, struct ucred *g) {
+#else
 vn_lockctl(struct vnode *a, offset_t b, struct eflock *c, int d
 	   , int (*e)(), ulong *f, struct ucred *g) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2147,7 +2340,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_ioctl(struct vnode *a, int32long64_t b, caddr_t c, size_t d, ext_t e, struct ucred *f) {
+#else
 vn_ioctl(struct vnode *a, int b, caddr_t c, size_t d, int e, struct ucred *f) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2175,7 +2372,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_select(struct vnode *a, int32long64_t b, ushort c, ushort *d, void (*e)()
+#else
 vn_select(struct vnode *a, int b, ushort c, ushort *d, void (*e)()
+#endif
 	  , caddr_t f, struct ucred *g) {
 	register glockOwner, ret;
 
@@ -2218,7 +2419,11 @@
 }
 
 static
+#ifdef AFS_AIX51_ENV
+vn_revoke(struct vnode *a, int32long64_t b, int32long64_t c, struct vattr *d, struct ucred *e) {
+#else
 vn_revoke(struct vnode *a, int b, int c, struct vattr *d, struct ucred *e) {
+#endif
 	register glockOwner, ret;
 
 	glockOwner = ISAFS_GLOCK();
@@ -2324,6 +2529,30 @@
 	vn_setacl,
 	vn_getpcl,
 	vn_setpcl,
+	afs_gn_enosys,	/* vn_seek */
+	afs_gn_enosys,	/* vn_fsync_range */
+	afs_gn_enosys,	/* vn_create_attr */
+	afs_gn_enosys,	/* vn_finfo */ 
+	afs_gn_enosys,	/* vn_map_lloff */
+	afs_gn_enosys,	/* vn_readdir_eofp */
+	afs_gn_enosys,	/* vn_rdwr_attr */
+	afs_gn_enosys,	/* vn_memcntl */
+	afs_gn_enosys,	/* vn_spare7 */
+	afs_gn_enosys,	/* vn_spare8 */
+	afs_gn_enosys,	/* vn_spare9 */
+	afs_gn_enosys,	/* vn_spareA */
+	afs_gn_enosys,	/* vn_spareB */
+	afs_gn_enosys,	/* vn_spareC */
+	afs_gn_enosys,	/* vn_spareD */
+	afs_gn_enosys,	/* vn_spareE */
+	afs_gn_enosys	/* vn_spareF */
+#ifdef AFS_AIX51_ENV
+	,afs_gn_enosys, /* pagerBackRange */
+ 	afs_gn_enosys,  /* pagerGetFileSize */
+	afs_gn_enosys,  /* pagerReadAhead */
+	afs_gn_enosys,  /* pagerWriteBehind */
+	afs_gn_enosys   /* pagerEndCopy */
+#endif
 };
 
 struct gfs afs_gfs = {
Index: src/afs/LINUX/osi_sleep.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_sleep.c,v
retrieving revision 1.16
diff -u -r1.16 osi_sleep.c
--- src/afs/LINUX/osi_sleep.c	2002/07/31 22:29:42	1.16
+++ src/afs/LINUX/osi_sleep.c	2002/09/12 13:31:02
@@ -18,7 +18,7 @@
 
 
 static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
-void afs_osi_Wakeup(char *event);
+int afs_osi_Wakeup(char *event);
 void afs_osi_Sleep(char *event);
 
 static char waitV, dummyV;
@@ -277,17 +277,23 @@
 }
 
 
-void afs_osi_Wakeup(char *event)
+/* returns 0 if really someone was waked up, 1 if event not found and 2 
+   if event refcount was zero. (return code used for tracing only) */
+
+int afs_osi_Wakeup(char *event)
 {
     struct afs_event *evp;
 
     evp = afs_getevent(event);
     if (!evp)                          /* No sleepers */
-	return;
+	return 1;
 
     if (evp->refcount > 1) {
 	evp->seq++;    
 	wake_up(&evp->cond);
+        relevent(evp);
+        return 0;
     }
     relevent(evp);
+    return 2;
 }
Index: src/afs/LINUX/osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.50
diff -u -r1.50 osi_vnodeops.c
--- src/afs/LINUX/osi_vnodeops.c	2002/08/01 18:08:17	1.50
+++ src/afs/LINUX/osi_vnodeops.c	2002/09/12 13:31:02
@@ -105,6 +105,10 @@
             code = afs_read(vcp, &tuio, credp, 0, 0, 0);
 	    xfered += count - tuio.uio_resid;
 	    if (code != 0) {
+    		afs_Trace4(afs_iclSetp, CM_TRACE_READOP, ICL_TYPE_POINTER, vcp,
+	       		ICL_TYPE_OFFSET, offp,
+	       		ICL_TYPE_INT32, -1,
+	       		ICL_TYPE_INT32, code);
 		code = xfered;
 		*offp += count - tuio.uio_resid;
 	    } else {
Index: src/afs/VNOPS/afs_vnop_attrs.c
===================================================================
RCS file: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v
retrieving revision 1.13
diff -u -r1.13 afs_vnop_attrs.c
--- src/afs/VNOPS/afs_vnop_attrs.c	2002/05/16 13:47:28	1.13
+++ src/afs/VNOPS/afs_vnop_attrs.c	2002/09/12 13:31:02
@@ -181,6 +181,24 @@
     /* And linux has it's own stash as well. */
     vattr2inode(AFSTOV(avc), attrs);
 #endif
+#ifdef notdef
+#ifdef AFS_AIX51_ENV
+    afs_Trace2(afs_iclSetp, CM_TRACE_STATACLX, 
+		ICL_TYPE_POINTER, attrs->va_acl, 
+		ICL_TYPE_INT32, attrs->va_aclsiz);
+    if (attrs->va_acl && attrs->va_aclsiz >= 12) {
+	struct acl *ap;
+
+	ap = (struct acl *) attrs->va_acl;
+	ap->acl_len = 8;
+	ap->acl_mode = ACL_MODE;
+	ap->acl_rsvd = 0;
+	ap->u_access = 7;
+    }
+    /* temporary fix ? */
+    attrs->va_aclsiz = 1;
+#endif
+#endif
     return 0;
 }
 
Index: src/afs/VNOPS/afs_vnop_read.c
===================================================================
RCS file: /cvs/openafs/src/afs/VNOPS/afs_vnop_read.c,v
retrieving revision 1.15
diff -u -r1.15 afs_vnop_read.c
--- src/afs/VNOPS/afs_vnop_read.c	2002/07/30 19:34:32	1.15
+++ src/afs/VNOPS/afs_vnop_read.c	2002/09/12 13:31:02
@@ -195,6 +195,11 @@
 		    code = 0;
 		    ConvertSToRLock(&tdc->mflock);
 		    while (!code && tdc->mflags & DFFetchReq) {
+			afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT,
+				ICL_TYPE_STRING, __FILE__,
+				ICL_TYPE_INT32, __LINE__,
+				ICL_TYPE_POINTER, tdc,
+				ICL_TYPE_INT32, tdc->dflags);
 			/* don't need waiting flag on this one */
 			ReleaseReadLock(&tdc->mflock);
 			ReleaseReadLock(&tdc->lock);
@@ -248,6 +253,10 @@
 		}
 		else {
 		    /* don't have current data, so get it below */
+		    afs_Trace3(afs_iclSetp, CM_TRACE_VERSIONNO,
+				ICL_TYPE_INT64, ICL_HANDLE_OFFSET(filePos),
+				ICL_TYPE_HYPER, &avc->m.DataVersion,
+				ICL_TYPE_HYPER, &tdc->f.versionNo);
 		    ReleaseReadLock(&tdc->lock);
 		    afs_PutDCache(tdc);
 		    tdc = (struct dcache *) 0;
@@ -735,6 +744,11 @@
 		    code = 0;
 		    ConvertSToRLock(&tdc->mflock);
 		    while (!code && tdc->mflags & DFFetchReq) {
+			afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAIT,
+				ICL_TYPE_STRING, __FILE__,
+				ICL_TYPE_INT32, __LINE__,
+				ICL_TYPE_POINTER, tdc,
+				ICL_TYPE_INT32, tdc->dflags);
 			/* don't need waiting flag on this one */
 			ReleaseReadLock(&tdc->mflock);
 			ReleaseReadLock(&tdc->lock);
@@ -785,12 +799,17 @@
 	    else {
 		/* no longer fetching, verify data version (avoid new
 		 * GetDCache call) */
-		if (hsame(avc->m.DataVersion, tdc->f.versionNo)) {
+		if (hsame(avc->m.DataVersion, tdc->f.versionNo) 
+							&& tdc->f.chunkBytes) {
 		    offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk);
 		    len = tdc->f.chunkBytes - offset;
 		}
 		else {
 		    /* don't have current data, so get it below */
+		    afs_Trace3(afs_iclSetp, CM_TRACE_VERSIONNO,
+				ICL_TYPE_INT64, ICL_HANDLE_OFFSET(filePos),
+				ICL_TYPE_HYPER, &avc->m.DataVersion,
+				ICL_TYPE_HYPER, &tdc->f.versionNo);
 		    ReleaseReadLock(&tdc->lock);
 		    afs_PutDCache(tdc);
 		    tdc = (struct dcache *) 0;
@@ -798,6 +817,10 @@
 	    }
 
 	    if (!tdc) {
+		/* If we get, it was not possible to start the 
+		 * background daemon. With flag == 1 afs_GetDCache
+		 * does the FetchData rpc synchronously.
+		 */
 		ReleaseReadLock(&avc->lock);
 		tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 1);
 		ObtainReadLock(&avc->lock);
@@ -815,6 +838,11 @@
 	}
 	if (len	> totalLength) len = totalLength;   /* will read len bytes */
 	if (len	<= 0) {	/* shouldn't get here if DFFetching is on */
+	    afs_Trace4(afs_iclSetp, CM_TRACE_VNODEREAD2,
+			ICL_TYPE_POINTER, tdc,
+			ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tdc->validPos),
+			ICL_TYPE_INT32, tdc->f.chunkBytes,
+			ICL_TYPE_INT32, tdc->dflags);
 	    /* read past the end of a chunk, may not be at next chunk yet, and yet
 		also not at eof, so may have to supply fake zeros */
 	    len	= AFS_CHUNKTOSIZE(tdc->f.chunk) - offset; /* bytes left in chunk addr space */
Index: src/afs/VNOPS/afs_vnop_write.c
===================================================================
RCS file: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v
retrieving revision 1.22
diff -u -r1.22 afs_vnop_write.c
--- src/afs/VNOPS/afs_vnop_write.c	2002/08/01 18:08:13	1.22
+++ src/afs/VNOPS/afs_vnop_write.c	2002/09/12 13:31:03
@@ -435,6 +435,20 @@
     avc->states |= CDirty;
     tvec = (struct iovec *) osi_AllocSmallSpace(sizeof(struct iovec));
     while (totalLength > 0) {
+        /* 
+         *  The following lines are necessary because afs_GetDCache with
+	 *  flag == 4 expects the length field to be filled. It decides
+	 *  from this whether it's necessary to fetch data into the chunk
+	 *  before writing or not (when the whole chunk is overwritten!).
+	 */
+	len = totalLength;	/* write this amount by default */
+	offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk);
+	max = AFS_CHUNKTOSIZE(tdc->f.chunk);	/* max size of this chunk */
+	if (max	<= len + offset)	{   /*if we'd go past the end of this chunk */
+	    /* it won't all fit in this chunk, so write as much
+		as will fit */
+	    len = max - offset;
+	}
 	/* read the cached info */
 	if (noLock) {
 	    tdc = afs_FindDCache(avc, filePos);
Index: src/cf/osconf.m4
===================================================================
RCS file: /cvs/openafs/src/cf/osconf.m4,v
retrieving revision 1.16
diff -u -r1.16 osconf.m4
--- src/cf/osconf.m4	2002/06/30 17:13:37	1.16
+++ src/cf/osconf.m4	2002/09/12 13:31:04
@@ -261,6 +261,21 @@
 		XLIBS="${LIB_AFSDB} -ldl"
 		;;
 
+	rs_aix51)
+		DBG=""
+		LEX="lex"
+		LIBSYS_AIX_EXP="afsl.exp"
+		LWP_OPTMZ="-O"
+		MT_CC="xlc_r"
+		MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}'
+		MT_LIBS="-lpthreads"
+		OPTMZ="-O"
+		SHLIB_SUFFIX="o"
+		TXLIBS="-lcurses"
+		XCFLAGS="-K -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void"
+		XLIBS="${LIB_AFSDB} -ldl"
+		;;
+
 	s390_linux22)
 		CC="gcc"
 		LD="gcc"
Index: src/comerr/compile_et.c
===================================================================
RCS file: /cvs/openafs/src/comerr/compile_et.c,v
retrieving revision 1.9
diff -u -r1.9 compile_et.c
--- src/comerr/compile_et.c	2001/10/17 23:07:03	1.9
+++ src/comerr/compile_et.c	2002/09/12 13:31:04
@@ -46,7 +46,11 @@
 /* lex stuff */
 extern FILE *yyin;
 extern FILE *yyout;
+#ifdef AFS_AIX51_ENV
+int yylineno = 0;
+#else
 extern int yylineno;
+#endif
 
 char * xmalloc (size) unsigned int size; {
     char * p = malloc (size);
Index: src/config/afs_sysnames.h
===================================================================
RCS file: /cvs/openafs/src/config/afs_sysnames.h,v
retrieving revision 1.22
diff -u -r1.22 afs_sysnames.h
--- src/config/afs_sysnames.h	2002/06/30 17:13:37	1.22
+++ src/config/afs_sysnames.h	2002/09/12 13:31:05
@@ -57,6 +57,8 @@
 #define SYS_NAME_ID_rs_aix32		 701
 #define SYS_NAME_ID_rs_aix41		 702
 #define SYS_NAME_ID_rs_aix42		 703
+#define SYS_NAME_ID_rs_aix51		 704
+#define SYS_NAME_ID_rs_aix43		 705
 
 #define SYS_NAME_ID_sun3_411		 906
 #define SYS_NAME_ID_sun3x_411		 912
Index: src/config/stds.h
===================================================================
RCS file: /cvs/openafs/src/config/stds.h,v
retrieving revision 1.7
diff -u -r1.7 stds.h
--- src/config/stds.h	2001/08/08 00:03:41	1.7
+++ src/config/stds.h	2002/09/12 13:31:05
@@ -54,8 +54,8 @@
 #define ZeroInt64(a)       (a) = 0
 #define AssignInt64(a, b)   *(a) = (b)
 #define AddInt64(a,b,c) *(c) = (a) + (b)
-#define SubtractInt64(a,b,c) *(c) = (a) - (b)
-#define CompareInt64(a,b) (a) - (b)
+#define SubtractInt64(a,b,c) *(c) = (afs_int64)(a) - (afs_int64)(b)
+#define CompareInt64(a,b) (afs_int64)(a) - (afs_int64)(b)
 #define NonZeroInt64(a)                (a)
 #define Int64ToInt32(a)    (a) & 0xFFFFFFFFL
 #define FillInt64(t,h,l) (t) = (h); (t) <<= 32; (t) |= (l);
Index: src/export/Makefile.in
===================================================================
RCS file: /cvs/openafs/src/export/Makefile.in,v
retrieving revision 1.6
diff -u -r1.6 Makefile.in
--- src/export/Makefile.in	2001/11/01 04:59:48	1.6
+++ src/export/Makefile.in	2002/09/12 13:31:05
@@ -12,6 +12,7 @@
      INCS = -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR}
    CFLAGS = ${OPTMZ} ${DEFS} ${INCS}
   EXPORTS = -bexport:export.exp
+  EXPORTS5 = -bexport:export5.exp
   IMPORTS = /lib/kernex.exp /lib/syscalls.exp extras.exp
      KOBJ = export.o symtab.o
 
@@ -32,10 +33,16 @@
 	${INSTALL} export.exp ${UKERNELDIR}
 
 export.ext: ${KOBJ}
-	${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS} -lcsys
+	case ${SYS_NAME} in \
+	rs_aix4* ) \
+		${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS} -lcsys ;; \
+	rs_aix5* ) \
+		${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS5} -lcsys ;; \
+	esac
 
 export.ext.nonfs: export.nonfs.o symtab.o
-	${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o symtab.o ${EXPORTS} -lcsys
+	${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o \
+		symtab.o ${EXPORTS} -lcsys
 
 export.nonfs.o:
 	${CC} ${INCS} -DAFS_NONFSTRANS -c export.c
Index: src/export/cfgexport.c
===================================================================
RCS file: /cvs/openafs/src/export/cfgexport.c,v
retrieving revision 1.5
diff -u -r1.5 cfgexport.c
--- src/export/cfgexport.c	2001/08/08 00:03:44	1.5
+++ src/export/cfgexport.c	2002/09/12 13:31:05
@@ -32,7 +32,7 @@
 extern int	errno;
 extern int	sysconfig(int cmd, void *arg, int len);
 
-int debug;
+int debug = 0 ;
 char *syms = "/unix";
 
 #include "AFS_component_version_number.c"
Index: src/export/export.c
===================================================================
RCS file: /cvs/openafs/src/export/export.c,v
retrieving revision 1.5
diff -u -r1.5 export.c
--- src/export/export.c	2001/10/24 15:56:00	1.5
+++ src/export/export.c	2002/09/12 13:31:07
@@ -90,7 +90,11 @@
 
 	if (toc_nsyms * sizeof (sym_t) != conf.symt_sz
 	    || toc_size > (1024 * 1024))
+#ifdef AFS_AIX51_ENV
+		return EFBIG;
+#else
 		return EINVAL;
+#endif
 
 	toc_syms = (sym_t *) xmalloc(toc_size, 2, kernel_heap);
 
@@ -227,6 +231,7 @@
 /*
  * Call vanilla syscalls
  */
+#ifndef AFS_AIX51_ENV
 osetgroups(ngroups, gidset)
     int ngroups;
     gid_t *gidset;
@@ -236,15 +241,25 @@
     error = setgroups(ngroups, gidset);
     return (error);
 }
+#endif
 
-
+#ifdef AFS_AIX51_ENV
+okioctl(fdes, cmd, arg, ext, arg2, arg3)
+    int fdes, cmd;
+    caddr_t ext, arg, arg2, arg3;
+#else
 okioctl(fdes, cmd, arg, ext)
     int fdes, cmd, arg;
     caddr_t ext;
+#endif
 {
     int error;
     
+#ifdef AFS_AIX51_ENV
+    error = kioctl(fdes, cmd, arg, ext, arg2, arg3);
+#else
     error = kioctl(fdes, cmd, arg, ext);
+#endif
     return (error);
 }
 
Index: src/libafs/MakefileProto.AIX.in
===================================================================
RCS file: /cvs/openafs/src/libafs/MakefileProto.AIX.in,v
retrieving revision 1.14
diff -u -r1.14 MakefileProto.AIX.in
--- src/libafs/MakefileProto.AIX.in	2002/06/14 17:22:37	1.14
+++ src/libafs/MakefileProto.AIX.in	2002/09/12 13:31:07
@@ -121,13 +121,13 @@
 
 $(LIBAFSIAUTH): $(AFSAOBJS) $(AFSIAUTHOBJS)
 	${LD} ${LDSTUFF} -bloadmap:afs.ext.iauth.loadmap \
-	 -bmap:afs.ext.iauth.map -o afs.ext.iauth \
-	${AFSAOBJS} ${AFSIAUTHOBJS} ${LIBS} ${LDFLAGS}
+		-bmap:afs.ext.iauth.map -o afs.ext.iauth \
+		${AFSAOBJS} ${AFSIAUTHOBJS} ${LIBS} ${LDFLAGS} 
 
 $(LIBAFS): $(AFSAOBJS) $(AFSNOIAUTHOBJS)
 	${LD} ${LDSTUFF} -bloadmap:afs.ext.loadmap \
-	 -bmap:afs.ext.map -o afs.ext \
-	${AFSAOBJS} $(AFSNOIAUTHOBJS) ${LIBS} ${LDFLAGS}
+	 	-bmap:afs.ext.map -o afs.ext \
+		${AFSAOBJS} ${AFSNOIAUTHOBJS} ${LIBS} ${LDFLAGS}
 
 libafs: $(LIBAFS) $(LIBAFSIAUTH)
 install_libafs: $(INST_LIBAFS) $(INST_LIBAFSIAUTH)
Index: src/rx/rx_getaddr.c
===================================================================
RCS file: /cvs/openafs/src/rx/rx_getaddr.c,v
retrieving revision 1.11
diff -u -r1.11 rx_getaddr.c
--- src/rx/rx_getaddr.c	2001/10/05 20:39:01	1.11
+++ src/rx/rx_getaddr.c	2002/09/12 13:31:09
@@ -327,8 +327,8 @@
     struct ifconf   ifc;
     struct ifreq    ifs[NIFS], *ifr;
     struct sockaddr_in *a;
-#if     defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV)
-    char	*cp, *cplim;	/* used only for AIX 41 */
+#if    defined(AFS_AIX41_ENV) || defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+    char	*cp, *cplim, *cpnext;	/* used only for AIX 41 */
 #endif
 
     s = socket(AF_INET, SOCK_DGRAM, 0);
@@ -351,8 +351,12 @@
 #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 	        cp += _SIZEOF_ADDR_IFREQ(*ifr))
 #else
+#ifdef AFS_AIX51_ENV
+                cp = cpnext)
+#else
                 cp += sizeof(ifr->ifr_name) + MAX(a->sin_len, sizeof(*a)))
 #endif
+#endif
        {
 	ifr = (struct ifreq *)cp;
 #else
@@ -360,11 +364,16 @@
 	ifr = &ifs[i];
 #endif
 	a = (struct sockaddr_in *) &ifr->ifr_addr;
-	if (a->sin_addr.s_addr != 0 && a->sin_family == AF_INET) {
-	    if ( ioctl(s, SIOCGIFFLAGS, ifr) < 0 ) {
-		perror("SIOCGIFFLAGS");
-		continue; /* ignore this address */
-	    }
+#ifdef AFS_AIX51_ENV
+	cpnext = cp + sizeof(ifr->ifr_name) + MAX(a->sin_len, sizeof(*a));
+#endif
+	if (a->sin_family != AF_INET)
+	    continue;
+	if ( ioctl(s, SIOCGIFFLAGS, ifr) < 0 ) {
+	    perror("SIOCGIFFLAGS");
+	    continue; /* ignore this address */
+	}
+	if (a->sin_addr.s_addr != 0) {
 	    if (ifr->ifr_flags & IFF_LOOPBACK) {
 		continue;	 /* skip aliased loopbacks as well. */
 	    }
Index: src/rx/rx_kcommon.c
===================================================================
RCS file: /cvs/openafs/src/rx/rx_kcommon.c,v
retrieving revision 1.19
diff -u -r1.19 rx_kcommon.c
--- src/rx/rx_kcommon.c	2002/07/16 20:58:59	1.19
+++ src/rx/rx_kcommon.c	2002/09/12 13:31:09
@@ -891,7 +891,15 @@
 #ifdef RX_ENABLE_LOCKS
 	AFS_GLOCK();
 #endif /* RX_ENABLE_LOCKS */
+#ifdef RX_KERNEL_TRACE
+    afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP,
+		ICL_TYPE_STRING, "before afs_osi_Wait()");
+#endif
 	afs_osi_Wait(500, (char *)0, 0);
+#ifdef RX_KERNEL_TRACE
+    afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP,
+		ICL_TYPE_STRING, "after afs_osi_Wait()");
+#endif
 	if (afs_termState == AFSOP_STOP_RXEVENT )
 	{
 #ifdef RXK_LISTENER_ENV
@@ -899,7 +907,7 @@
 #else
 		afs_termState = AFSOP_STOP_COMPLETE;
 #endif
-		afs_osi_Wakeup(&afs_termState);
+		osi_rxWakeup(&afs_termState);
 		return;
 	}
     }
@@ -940,9 +948,21 @@
     p->wirevec[p->niovecs-1].iov_len = savelen + RX_EXTRABUFFERSIZE;
 
     nbytes = tlen + sizeof(afs_int32);
+#ifdef RX_KERNEL_TRACE
+    AFS_GLOCK();
+    afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP,
+		ICL_TYPE_STRING, "before osi_NetRecive()");
+    AFS_GUNLOCK();
+#endif
     code = osi_NetReceive(rx_socket, &from, p->wirevec, p->niovecs,
 			    &nbytes);
 
+#ifdef RX_KERNEL_TRACE
+    AFS_GLOCK();
+    afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP,
+		ICL_TYPE_STRING, "after osi_NetRecive()");
+    AFS_GUNLOCK();
+#endif
    /* restore the vec to its correct state */
     p->wirevec[p->niovecs-1].iov_len = savelen;
 
@@ -1057,11 +1077,11 @@
 #endif /* RX_ENABLE_LOCKS */
     if (afs_termState == AFSOP_STOP_RXK_LISTENER) {
 	afs_termState = AFSOP_STOP_COMPLETE;
-	afs_osi_Wakeup(&afs_termState);
+	osi_rxWakeup(&afs_termState);
     }
     rxk_ListenerPid = 0;
 #if defined(AFS_LINUX22_ENV) || defined(AFS_SUN5_ENV)
-    afs_osi_Wakeup(&rxk_ListenerPid);
+    osi_rxWakeup(&rxk_ListenerPid);
 #endif
 #ifdef AFS_SUN5_ENV
     AFS_GUNLOCK();
Index: src/rx/rx_kernel.h
===================================================================
RCS file: /cvs/openafs/src/rx/rx_kernel.h,v
retrieving revision 1.3
diff -u -r1.3 rx_kernel.h
--- src/rx/rx_kernel.h	2001/02/12 19:25:53	1.3
+++ src/rx/rx_kernel.h	2002/09/12 13:31:09
@@ -31,8 +31,18 @@
 extern osi_socket rxi_GetUDPSocket();
 
 #if (!defined(AFS_GLOBAL_SUNLOCK) && !defined(RX_ENABLE_LOCKS)) || (defined(AFS_HPUX_ENV) && !defined(RX_ENABLE_LOCKS))
+#define RX_KERNEL_TRACE 1
+#ifdef RX_KERNEL_TRACE
+#include "../afs/icl.h"
+#include "../afs/afs_trace.h"
+#define osi_rxSleep(a)  afs_Trace2(afs_iclSetp, CM_TRACE_RXSLEEP, \
+        ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__); afs_osi_Sleep(a)
+#define osi_rxWakeup(a) if (afs_osi_Wakeup(a) == 0) afs_Trace2(afs_iclSetp, \
+        CM_TRACE_RXWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__)
+#else /* RX_KERNEL_TRACE */
 #define	osi_rxSleep(a)	afs_osi_Sleep(a)
 #define	osi_rxWakeup(a)	afs_osi_Wakeup(a)
+#endif /* RX_KERNEL_TRACE */
 #endif
 
 extern void osi_Panic();
Index: src/tsm41/aix41_auth.c
===================================================================
RCS file: /cvs/openafs/src/tsm41/aix41_auth.c,v
retrieving revision 1.5
diff -u -r1.5 aix41_auth.c
--- src/tsm41/aix41_auth.c	2001/08/08 00:04:11	1.5
+++ src/tsm41/aix41_auth.c	2002/09/12 13:31:11
@@ -28,7 +28,6 @@
 #include <afs/kauth.h>
 #include <afs/kautils.h>
 
-
 int afs_authenticate (char *userName, char *response, int  *reenter, char **message) {
     char *reason, *pword, prompt[256];
     struct passwd *pwd;
@@ -83,23 +82,60 @@
     return NULL;
 }
 
-int afs_getgrgid (int id) {
+struct group *afs_getgrgid (int id) {
     return NULL;
 }
 
-int afs_getgrnam (char *name) {
+struct group *afs_getgrnam (char *name) {
     return NULL;
 }
 
+#ifdef AFS_AIX51_ENV
+/*
+ *  This is a nasty hack. It seems getpwnam calls this routine and is not
+ *  happy with NULL as result. Trying to call here getpwnam in order to get
+ *  a reasonable result kills the whole program. So I tried to return
+ *  a dummy pwd and it seems to work!
+ */
+struct passwd *afs_getpwnam (char *user) {
+    char name[64];
+    char *passwd = "*";
+    char *gecos = "";
+    char *dir = "/";
+    char *shell = "/bin/sh";
+    char *nobody = "nobody";
+    struct passwd p;
+
+    strncpy((char *)&name, user, sizeof(name));
+    name[63] = 0;
+    p.pw_name = &name;
+    p.pw_name = nobody;
+    p.pw_passwd = passwd;
+    p.pw_uid = 4294967294;
+    p.pw_gid = 4294967294;
+    p.pw_gecos = gecos;
+    p.pw_dir = dir;
+    p.pw_shell = shell;
+
+    return &p;
+}
+#else
 int afs_getpwnam(int id)
 {
     return NULL;
 }
+#endif
 
+#ifdef AFS_AIX52_ENV
+struct passwd *afs_getpwuid (uid_t uid) {
+    return pwd;
+}
+#else
 int afs_getpwuid(char *name)
 {
     return NULL;
 }
+#endif
 
 int afs_initialize(struct secmethod_table *meths) {
     /*
Index: src/util/snprintf.c
===================================================================
RCS file: /cvs/openafs/src/util/snprintf.c,v
retrieving revision 1.10
diff -u -r1.10 snprintf.c
--- src/util/snprintf.c	2001/07/12 19:59:23	1.10
+++ src/util/snprintf.c	2002/09/12 13:31:12
@@ -118,7 +118,11 @@
  *       both '0' and ' ' are given, the ' ' flag will be ignored.
  *     + The '#' and '+' flags have no effect.
  */
+#ifdef AFS_AIX51_ENV
+static int  vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
+#else
 static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
+#endif
 {
   unsigned int width, precision, haveprec, len;
   int ljust, plsign, spsign, altform, zfill;
@@ -382,7 +386,11 @@
 }
 
 
+#ifdef AFS_AIX51_ENV
+int snprintf(char *p, size_t avail, const char *fmt, ...)
+#else
 void snprintf(char *p, unsigned int avail, char *fmt, ...)
+#endif
 {
   va_list ap;
 
Index: src/vol/fssync.c
===================================================================
RCS file: /cvs/openafs/src/vol/fssync.c,v
retrieving revision 1.7
diff -u -r1.7 fssync.c
--- src/vol/fssync.c	2002/06/12 22:07:08	1.7
+++ src/vol/fssync.c	2002/09/12 13:31:12
@@ -417,7 +417,7 @@
 	    tvolName[0] = '/';
 	    sprintf(&tvolName[1], VFORMAT, command.volume);
 
-	    vp = VAttachVolumeByName_r(&error, command.partName, tvolName, V_UPDATE);
+	    vp = VAttachVolumeByName_r(&error, command.partName, tvolName, V_VOLUPD);
 	    if (vp)
 	        VPutVolume_r(vp);
 	    break;
@@ -571,7 +571,7 @@
 
 	    tvolName[0] = '/';
 	    sprintf(&tvolName[1], VFORMAT, p[i].volumeID);
-	    vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName, V_UPDATE);
+	    vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName, V_VOLUPD);
 	    if (vp)
 	        VPutVolume_r(vp);
 	    p[i].volumeID = 0;
Index: src/vol/volume.c
===================================================================
RCS file: /cvs/openafs/src/vol/volume.c,v
retrieving revision 1.13
diff -u -r1.13 volume.c
--- src/vol/volume.c	2001/09/13 23:19:24	1.13
+++ src/vol/volume.c	2002/09/12 13:31:12
@@ -283,7 +283,7 @@
 		    Error error;
 		    Volume *vp;
 		    vp = VAttachVolumeByName(&error, diskP->name, dp->d_name,
-					     V_UPDATE);
+					     V_VOLUPD);
 		    (*(vp?&nAttached:&nUnattached))++;
 		    if (error == VOFFLINE)
 			Log("Volume %u stays offline (/vice/offline/%s exists)\n", 
Index: src/vol/volume.h
===================================================================
RCS file: /cvs/openafs/src/vol/volume.h,v
retrieving revision 1.3
diff -u -r1.3 volume.h
--- src/vol/volume.h	2001/07/05 15:21:20	1.3
+++ src/vol/volume.h	2002/09/12 13:31:13
@@ -460,7 +460,7 @@
 			   the volume is read-only, the file server may continue to
 			   server it; it may also continue to server it in read/write
 			   mode if the writes are deferred */
-#define V_UPDATE   3	/* General update or volume purge is possible.  Volume must
+#define V_VOLUPD   3	/* General update or volume purge is possible.  Volume must
 			   go offline */
 #define V_DUMP	   4	/* A dump of the volume is requested; the volume can be served
 			   read-only during this time */
Index: src/volser/volprocs.c
===================================================================
RCS file: /cvs/openafs/src/volser/volprocs.c,v
retrieving revision 1.11
diff -u -r1.11 volprocs.c
--- src/volser/volprocs.c	2002/03/10 19:08:08	1.11
+++ src/volser/volprocs.c	2002/09/12 13:31:13
@@ -323,7 +323,7 @@
      * server doesn't try to use it (and abort) while (or after) we delete it.
      * If we don't get the volume, that's fine, too.  We just won't put it back.
      */
-    tvp = XAttachVolume(&error, avolID, apartID, V_UPDATE);
+    tvp = XAttachVolume(&error, avolID, apartID, V_VOLUPD);
     code = nuke(partName, avolID);
     if (tvp) VDetachVolume(&error, tvp);
     return code;
@@ -547,7 +547,7 @@
     
     
     if (purgeId) {
-	purgevp = VAttachVolume(&error, purgeId, V_UPDATE);
+	purgevp = VAttachVolume(&error, purgeId, V_VOLUPD);
 	if (error) {
 	    Log("1 Volser: Clone: Could not attach 'purge' volume %u; clone aborted\n", purgeId);
 	    goto fail;
@@ -725,7 +725,7 @@
        goto fail;
     }
 
-    clonevp = VAttachVolume(&error, cloneId, V_UPDATE);
+    clonevp = VAttachVolume(&error, cloneId, V_VOLUPD);
     if (error) {
 	Log("1 Volser: can't attach clone %d\n", cloneId);
 	goto fail;
@@ -862,7 +862,7 @@
     if (iflags & ITCreate) mode = V_SECRETLY;
     else if (iflags & ITBusy) mode = V_CLONE;
     else if (iflags & ITReadOnly) mode = V_READONLY;
-    else if (iflags & ITOffline) mode = V_UPDATE;
+    else if (iflags & ITOffline) mode = V_VOLUPD;
     else  { 
 	Log("1 Volser: TransCreate: Could not create trans, error %u\n",EINVAL);
 	LogError(EINVAL);

--------------090201090401020206000303--