]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Merge changes from 1.2.6 to 1.2.7
authorSam Hartman <hartmans@debian.org>
Thu, 26 Sep 2002 19:18:09 +0000 (19:18 +0000)
committerSam Hartman <hartmans@debian.org>
Thu, 26 Sep 2002 19:18:09 +0000 (19:18 +0000)
20 files changed:
Makefile.in
NEWS
src/afs/LINUX/osi_misc.c
src/afs/Makefile.in
src/afs/VNOPS/afs_vnop_lookup.c
src/afs/VNOPS/afs_vnop_readdir.c
src/afs/afs.h
src/afs/afs_call.c
src/afs/afs_pioctl.c
src/bozo/bosoprocs.c
src/config/Makefile.i386_linux22.in
src/config/Makefile.ppc_linux22.in
src/config/Makefile.ppc_linux24.in
src/lwp/lwp.h
src/lwp/preempt.c
src/lwp/process.c
src/rx/rx.c
src/rx/rx_packet.c
src/viced/afsfileprocs.c
src/vol/partition.c

index 3452d72d146961837b5c795f49aecd9aed5653b9..3d8492f7082dcd01ebee3906fb97539cb7b829ed 100644 (file)
@@ -240,7 +240,7 @@ viced: project vlserver audit
 
 tviced: project viced vlserver libafsrpc libafsauthent
        case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun*_*|rs_aix*|*linux*|hp_ux110) \
+       alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux110) \
                ${COMPILE_PART1} tviced  ${COMPILE_PART2} ;; \
        *) \
                echo Not building MT viced for ${SYS_NAME} ;; \
@@ -292,7 +292,7 @@ bozo: project ntp audit
 vfsck: vol
        set -x; \
        case ${SYS_NAME} in \
-       sgi_* | *linux* | rs_aix42 | ppc_darwin* | hp_ux* | *fbsd* | *_obsd* ) \
+       sgi_* | *linux* | rs_aix42 | ppc_darwin* | hp_ux* | *fbsd* | *_obsd* | sun*_4* ) \
                echo skip vfsck for ${SYS_NAME} ;; \
         * ) \
                ${COMPILE_PART1} vfsck ${COMPILE_PART2} ;; \
@@ -379,7 +379,7 @@ libafs_tree: libafs_setup ${KERNELDIR}
 libuafs: libuafs_setup ${UKERNELDIR}
        set -x; \
        case ${SYS_NAME} in \
-       hp_ux102* | *_obsd* ) \
+       hp_ux102* | *_obsd* | sun*_4* ) \
                echo Skipping libuafs for ${SYS_NAME} ;; \
        * ) \
                ${COMPILE_PART1} libuafs ${COMPILE_PART2} ;; \
@@ -434,7 +434,7 @@ tests: rxtests ubiktests
 # pthread based user space RX library
 libafsrpc: rx rxkad des
        case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110|*fbsd*) \
        ${COMPILE_PART1} libafsrpc  ${COMPILE_PART2} ;; \
        *) \
                echo Not building MT libafsrpc for ${SYS_NAME} ;; \
@@ -442,12 +442,28 @@ libafsrpc: rx rxkad des
 
 libafsauthent: ubik auth kauth libafsrpc
        case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110|*fbsd*) \
        ${COMPILE_PART1} libafsauthent  ${COMPILE_PART2} ;; \
        *) \
                echo Not building MT libafsrpc for ${SYS_NAME} ;; \
        esac
 
+shlibafsrpc: rx rxkad des
+       case ${SYS_NAME} in \
+       alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux110) \
+       ${COMPILE_PART1} shlibafsrpc ${COMPILE_PART2} ;; \
+       *) \
+               echo Not building shared libafsrpc for ${SYS_NAME} ;; \
+       esac
+
+shlibafsauthent: ubik auth kauth shlibafsrpc
+       case ${SYS_NAME} in \
+       alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux110) \
+       ${COMPILE_PART1} shlibafsauthent ${COMPILE_PART2} ;; \
+       *) \
+               echo Not building shared libafsrpc for ${SYS_NAME} ;; \
+       esac
+
 libadmin_real: 
        ${COMPILE_PART1} libadmin ${COMPILE_PART2}
        ${COMPILE_PART1} libadmin/adminutil ${COMPILE_PART2}
@@ -471,13 +487,13 @@ libadmin: libafsauthent bozo
 finale: project cmd comerr afsd allrcmds butc tbutc @ENABLE_KERNEL_MODULE@ libuafs audit kauth log package \
        ptserver scout bu_utils ubik uss bozo vfsck volser \
        venus update xstat afsmonitor dauth rxdebug libafsrpc \
-       libafsauthent libadmin
+       libafsauthent shlibafsrpc shlibafsauthent libadmin
        ${COMPILE_PART1} finale ${COMPILE_PART2}
 
 finale_nolibafs: project cmd comerr afsd allrcmds butc tbutc libuafs audit kauth log package \
        ptserver scout bu_utils ubik uss bozo vfsck volser \
        venus update xstat afsmonitor dauth rxdebug libafsrpc \
-       libafsauthent libadmin
+       libafsauthent shlibafsrpc shlibafsauthent libadmin
        ${COMPILE_PART1} finale ${COMPILE_PART2}
 
 # Use washtool to ensure MakefileProto is current and obj/libafs exists.
@@ -570,6 +586,8 @@ clean2:
        -${COMPILE_PART1} rxdebug ${COMPILE_CLEAN}
        -${COMPILE_PART1} libafsrpc ${COMPILE_CLEAN}
        -${COMPILE_PART1} libafsauthent ${COMPILE_CLEAN}
+       -${COMPILE_PART1} shlibafsrpc ${COMPILE_CLEAN}
+       -${COMPILE_PART1} shlibafsauthent ${COMPILE_CLEAN}
        -${COMPILE_PART1} libadmin ${COMPILE_CLEAN}
        -${COMPILE_PART1} libadmin/adminutil ${COMPILE_CLEAN}
        -${COMPILE_PART1} libadmin/client ${COMPILE_CLEAN}
@@ -690,6 +708,8 @@ distclean: clean
        src/rxstat/Makefile \
        src/scout/Makefile \
        src/sgistuff/Makefile \
+       src/shlibafsauthent/Makefile \
+       src/shlibafsrpc/Makefile \
        src/sia/Makefile \
        src/sys/Makefile \
        src/tbutc/Makefile \
diff --git a/NEWS b/NEWS
index 736db1339c95898d369588a163d681544849f927..9981852192dfb2c05acbae34dedcc8c428b90d9a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,19 @@
-OpenAFS News -- history of user-visible changes.  August 2, 2002.
+OpenAFS News -- history of user-visible changes.  September 25, 2002.
+
+* Changes incorporated in OpenAFS 1.2.7
+
+** MacOS X 10.2 is now supported.  FreeBSD 4.3 and later support is included
+   in this release, but is still under active development and should only
+   be used by those doing active development on the OpenAFS FreeBSD client.
+
+** When fakestat is enabled on MacOSX, the Finder can be used to browse
+   a fully-populated /afs directory.  However, this precludes reliable
+   use of entire volumes as MacOS bundles (i.e. containing a Contents
+   directory in the root of the volume).
+
+** The fileserver will now use Rx pings to determine if clients are reachable
+   prior to allocating resources to them, to prevent asymmetric clients from
+   consuming all fileserver resources.
 
 * Changes incorporated in OpenAFS 1.2.6
 
index 6523df5ccceb94a20d94813e3c64080cbb1292c0..2f426235b21e29bca4c952c14ca52e4fd1b5f8db 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_misc.c,v 1.11 2002/08/02 04:57:38 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_misc.c,v 1.12 2002/09/26 19:18:06 hartmans Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -91,7 +91,7 @@ int osi_InitCacheInfo(char *aname)
 
     cacheInode = dp->d_inode->i_ino;
     cacheDev.dev = dp->d_inode->i_dev;
-    afs_fsfragsize = dp->d_inode->i_sb->s_blocksize;
+    afs_fsfragsize = dp->d_inode->i_sb->s_blocksize - 1;
     afs_cacheSBp = dp->d_inode->i_sb;
 
     dput(dp);
@@ -114,6 +114,7 @@ int osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize,
     KERNEL_SPACE_DECL;
     struct file *filp = &file->file;
     off_t offset = file->offset;
+    unsigned long savelim;
 
     /* Seek to the desired position. Return -1 on error. */
     if (filp->f_op->llseek) {
@@ -123,6 +124,9 @@ int osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize,
     else
        filp->f_pos = offset;
 
+    savelim = current->rlim[RLIMIT_FSIZE].rlim_cur;
+    current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
+
     /* Read/Write the data. */
     TO_USER_SPACE();
     if (rw == UIO_READ)
@@ -133,6 +137,8 @@ int osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize,
        code = asize;
     TO_KERNEL_SPACE();
 
+    current->rlim[RLIMIT_FSIZE].rlim_cur = savelim;
+
     if (code >=0) {
        *resid = asize - code;
        return 0;
@@ -152,6 +158,10 @@ int osi_file_uio_rdwr(struct osi_file *osifile, uio_t *uiop, int rw)
     int code = 0;
     struct iovec *iov;
     int count;
+    unsigned long savelim;
+
+    savelim = current->rlim[RLIMIT_FSIZE].rlim_cur;
+    current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
 
     if (uiop->uio_seg == AFS_UIOSYS)
        TO_USER_SPACE();
@@ -165,7 +175,7 @@ int osi_file_uio_rdwr(struct osi_file *osifile, uio_t *uiop, int rw)
            uiop->uio_iovcnt--;
            continue;
        }
-       
+
        if (rw == UIO_READ)
            code = FOP_READ(filp, iov->iov_base, count);
        else
@@ -186,6 +196,8 @@ int osi_file_uio_rdwr(struct osi_file *osifile, uio_t *uiop, int rw)
     if (uiop->uio_seg == AFS_UIOSYS)
        TO_KERNEL_SPACE();
 
+    current->rlim[RLIMIT_FSIZE].rlim_cur = savelim;
+
     return code;
 }
 
index bc594922b8ca3d0c03a7c9248900f6c69c17ec66..90011537d08c86c1b1a0067ba89a84427004bfd0 100644 (file)
@@ -48,6 +48,8 @@ kinstall: ${KERNELDIR}/afs AFS_component_version_number.c
        case ${SYS_NAME} in \
                sgi_* ) \
                        gencat -m afszcm.cat afs_trace.msf ;; \
+               sun*_4* ) \
+                       /usr/etc/gencat afszcm.cat afs_trace.msf ;; \
                *_linux* ) \
                        gencat --new afszcm.cat afs_trace.msf ;; \
                ppc_darwin* | i386_fbsd*) \
index 24e27eeee9231b3508d6451cd9109df729f20feb..d17ef1e8aa9e719b1be2c61ef4584e57f68d53d1 100644 (file)
@@ -22,7 +22,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.11 2002/08/02 04:57:38 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.12 2002/09/26 19:18:06 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -110,7 +110,7 @@ EvalMountPoint(avc, advc, avolpp, areq)
     struct VenusFid tfid;
     struct cell *tcell;
     char   *cpos, *volnamep;
-    char   type, buf[128];
+    char   type, *buf;
     afs_int32  prefetchRO;          /* 1=>No  2=>Yes */
     afs_int32  mtptCell, assocCell, hac=0;
     afs_int32  samecell, roname, len;
@@ -179,15 +179,18 @@ EvalMountPoint(avc, advc, avolpp, areq)
      * Don't know why we do this. Would have still found it in above call - jpm.
      */
     if (!tvp && (prefetchRO == 2)) {
-       strcpy(buf, volnamep);
-       afs_strcat(buf, ".readonly");
+       buf = (char *)osi_AllocSmallSpace(strlen(volnamep)+10);
 
-       tvp = afs_GetVolumeByName(buf, mtptCell, 1, areq, WRITE_LOCK);
+       strcpy(buf, volnamep);
+       afs_strcat(buf, ".readonly");
 
-       /* Try the associated linked cell if failed */
-       if (!tvp && hac && areq->volumeError) {
-         tvp = afs_GetVolumeByName(buf, assocCell, 1, areq, WRITE_LOCK);
-       }
+       tvp = afs_GetVolumeByName(buf, mtptCell, 1, areq, WRITE_LOCK);
+       
+       /* Try the associated linked cell if failed */
+       if (!tvp && hac && areq->volumeError) {
+           tvp = afs_GetVolumeByName(buf, assocCell, 1, areq, WRITE_LOCK);
+       }
+       osi_FreeSmallSpace(buf);
     }
   
     if (!tvp) return ENODEV;       /* Couldn't find the volume */
@@ -195,7 +198,7 @@ EvalMountPoint(avc, advc, avolpp, areq)
     /* Don't cross mountpoint from a BK to a BK volume */
     if ((avc->states & CBackup) && (tvp->states & VBackup)) {
        afs_PutVolume(tvp, WRITE_LOCK);
-       return ELOOP;
+       return ENODEV;
     }
 
     /* If we want (prefetched) the RO and it exists, then drop the
@@ -1088,6 +1091,7 @@ afs_lookup(adp, aname, avcp, acred)
     struct sysname_info sysState;   /* used only for @sys checking */
     int dynrootRetry = 1;
     struct afs_fakestat_state fakestate;
+    int tryEvalOnly = 0;
 
     AFS_STATCNT(afs_lookup);
     afs_InitFakeStat(&fakestate);
@@ -1095,15 +1099,33 @@ afs_lookup(adp, aname, avcp, acred)
     if (code = afs_InitReq(&treq, acred))
        goto done;
 
-    code = afs_EvalFakeStat(&adp, &fakestate, &treq);
-    if (code)
-       goto done;
 #ifdef AFS_OSF_ENV
     ndp->ni_dvp = AFSTOV(adp);
     memcpy(aname, ndp->ni_ptr, ndp->ni_namelen);
     aname[ndp->ni_namelen] = '\0';
 #endif /* AFS_OSF_ENV */
 
+#if defined(AFS_DARWIN_ENV)
+    /* Workaround for MacOSX Finder, which tries to look for
+     * .DS_Store and Contents under every directory.
+     */
+    if (afs_fakestat_enable && adp->mvstat == 1) {
+       if (strcmp(aname, ".DS_Store") == 0)
+           tryEvalOnly = 1;
+       if (strcmp(aname, "Contents") == 0)
+           tryEvalOnly = 1;
+    }
+#endif
+
+    if (tryEvalOnly)
+       code = afs_TryEvalFakeStat(&adp, &fakestate, &treq);
+    else
+       code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+    if (tryEvalOnly && adp->mvstat == 1)
+       code = ENOENT;
+    if (code)
+       goto done;
+
     *avcp = (struct vcache *) 0;   /* Since some callers don't initialize it */
 
     /* come back to here if we encounter a non-existent object in a read-only
index cc185b71db9455662a2b98de89ca9f2a066a6979..8f7af7f67f31dc74d69b09f6e35fade390e955a5 100644 (file)
@@ -22,7 +22,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.8 2002/08/02 04:57:38 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.9 2002/09/26 19:18:06 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -140,7 +140,7 @@ struct irix5_min_dirent {     /* miniature dirent structure */
 #else
 struct min_direct {    /* miniature direct structure */
                        /* If struct direct changes, this must too */
-#ifdef AFS_DARWIN_ENV
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     afs_uint32  d_fileno;
     u_short     d_reclen;
     u_char      d_type;
@@ -226,6 +226,45 @@ int        afs_rd_stash_i = 0;
 #endif /* AFS_SUN56_ENV */
 #endif /* AFS_HPUX100_ENV */
 
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+int afs_readdir_type(avc, ade) 
+struct DirEntry *      ade;
+struct vcache *                avc;
+{
+     struct VenusFid tfid;
+     struct vcache *tvc;
+     int vtype;
+     tfid.Cell=avc->fid.Cell;
+     tfid.Fid.Volume=avc->fid.Fid.Volume;
+     tfid.Fid.Vnode=ntohl(ade->fid.vnode);
+     tfid.Fid.Unique=ntohl(ade->fid.vunique);
+     if ((avc->states & CForeign) == 0 &&
+         (ntohl(ade->fid.vnode) & 1)) {
+          return DT_DIR;
+     } else if ((tvc=afs_FindVCache(&tfid,0,0,0,0))) {
+           if (tvc->mvstat) {
+               afs_PutVCache(tvc, WRITE_LOCK);
+               return DT_DIR;
+          } else if (((tvc->states) & (CStatd|CTruth))) {
+               /* CTruth will be set if the object has
+                *ever* been statd */
+               vtype=vType(tvc);
+               afs_PutVCache(tvc, WRITE_LOCK);
+               if (vtype == VDIR)
+                    return DT_DIR;
+               else if (vtype == VREG)
+                    return DT_REG;
+               /* Don't do this until we're sure it can't be a mtpt */
+               /* else if (vtype == VLNK)
+                  type=DT_LNK; */
+               /* what other types does AFS support? */
+          } else
+               afs_PutVCache(tvc, WRITE_LOCK);
+    }
+    return DT_UNKNOWN;
+}
+#endif
+
 #ifdef AFS_AIX41_ENV
 #define AFS_MOVE_LOCK()   AFS_GLOCK()
 #define AFS_MOVE_UNLOCK() AFS_GUNLOCK()
@@ -233,7 +272,6 @@ int afs_rd_stash_i = 0;
 #define AFS_MOVE_LOCK()
 #define AFS_MOVE_UNLOCK()
 #endif
-
 char bufofzeros[64];   /* gotta fill with something */
 afs_readdir_move (de, vc, auio, slen, rlen, off) 
 struct DirEntry *      de;
@@ -348,8 +386,8 @@ int                 off;
 #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV)
     sdirEntry.d_off = off;
 #endif
-#if defined(AFS_DARWIN_ENV)
-    sdirEntry.d_type=DT_UNKNOWN;
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+    sdirEntry.d_type=afs_readdir_type(vc, de);
 #endif
 
 #if defined(AFS_SGI_ENV)
@@ -423,7 +461,7 @@ void afs_bulkstat_send( avc, req )
  * It has to do with 'offset' (seek locations).
 */
 
-#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 afs_readdir(OSI_VC_ARG(avc), auio, acred, eofp)
     int *eofp;
 #else
@@ -481,7 +519,7 @@ afs_readdir(OSI_VC_ARG(avc), auio, acred)
 #endif /* AFS_SGI61_ENV */
 #endif /* defined(AFS_SGI53_ENV) */
 
-#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     /* Not really used by the callee so we ignore it for now */
     if (eofp) *eofp = 0;
 #endif
@@ -608,7 +646,7 @@ tagain:
            } else {
                /* nothin to hand over */
            }
-#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
        if (eofp) *eofp = 1;    /* Set it properly */
 #endif
            if (ode) DRelease(ode, 0);
index 210544d7cb2dbe5c236c95a0c6bfaa17a38e0f56..d3ff50343befb2109c79a0fe6cbd2663bf933c67 100644 (file)
@@ -497,8 +497,12 @@ struct SimpleLocks {
 #ifdef AFS_OSF_ENV
 #define CWired         0x00000800      /* OSF hack only */
 #else
+#ifdef AFS_DARWIN_ENV
+#define CUBCinit        0x00000800
+#else
 #define CWRITE_IGN     0x00000800      /* Next OS hack only */
 #endif
+#endif
 #define CUnique                0x00001000      /* vc's uniquifier - latest unifiquier for fid */
 #define CForeign       0x00002000      /* this is a non-afs vcache */
 #define CHasPages      0x00004000
@@ -598,11 +602,11 @@ struct vcache {
      * Do not try to get the vcache lock when the vlock is held */
     afs_rwlock_t vlock;
 #endif /* defined(AFS_SUN5_ENV) */
-#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_DARWIN_ENV)
 #if    defined(AFS_SUN5_ENV)
     krwlock_t rwlock;
     struct cred *credp;
 #endif
+#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     afs_bozoLock_t pvnLock;    /* see locks.x */
 #endif
 #ifdef AFS_AIX32_ENV
@@ -616,6 +620,9 @@ struct vcache {
 #endif
 #ifdef AFS_DARWIN_ENV
     struct lock__bsd__      rwlock;
+#endif
+#ifdef AFS_FBSD_ENV
+    struct lock      rwlock;
 #endif
     afs_int32 parentVnode;             /* Parent dir, if a file. */
     afs_int32 parentUnique;
@@ -1036,7 +1043,7 @@ extern int afs_DynrootVOPRemove();
 #else
 #ifdef AFS_DARWIN_ENV
 #define afs_VerifyVCache(avc, areq)  \
-  (((avc)->states & CStatd) ? (osi_VM_Setup(avc), 0) : \
+  (((avc)->states & CStatd) ? (osi_VM_Setup(avc, 0), 0) : \
    afs_VerifyVCache2((avc),areq))
 #else
 #define afs_VerifyVCache(avc, areq)  \
index a5e7eb3dc7f19fc82ea4c9b4b88ce78ae3a96a67..81f760104adcc12c7aafaf71f0b641a88d8cad33 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_call.c,v 1.13 2002/08/02 04:57:37 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_call.c,v 1.14 2002/09/26 19:18:06 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -21,7 +21,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_call.c,v 1.13 2002/08/02 04:57:
 #ifdef AFS_SGI62_ENV
 #include "../h/hashing.h"
 #endif
-#if !defined(AFS_HPUX110_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN60_ENV)
 #include "netinet/in_var.h"
 #endif
 #endif /* !defined(UKERNEL) */
@@ -61,9 +61,10 @@ simple_lock_data_t afs_global_lock;
 #elif defined(AFS_DARWIN_ENV)
 struct lock__bsd__ afs_global_lock;
 #elif defined(AFS_FBSD_ENV)
-struct simplelock afs_global_lock;
+struct lock afs_global_lock;
+struct proc *afs_global_owner;
 #endif
-#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
 thread_t afs_global_owner;
 #endif /* AFS_OSF_ENV */
 
@@ -122,6 +123,172 @@ static int afs_InitSetup(int preallocs)
 
     return code;
 }
+#if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS)
+struct afsd_thread_info {
+    unsigned long parm;
+    struct completion *complete;
+};
+
+static int afsd_thread(void *rock) {
+     struct afsd_thread_info  *arg=rock;
+     unsigned long parm=arg->parm;
+#ifdef SYS_SETPRIORITY_EXPORTED
+     int (*sys_setpriority)(int,int,int) = sys_call_table[__NR_setpriority];
+#endif
+     daemonize(); /* doesn't do much, since we were forked from keventd, but
+                     does call mm_release, which wakes up our parent (since it
+                     used CLONE_VFORK) */
+     afs_osi_MaskSignals();
+     switch (parm) {
+     case AFSOP_START_RXCALLBACK:
+          sprintf(current->comm, "afs_cbstart");
+          AFS_GLOCK();
+          complete(arg->complete);
+          afs_CB_Running = 1;     
+          while (afs_RX_Running != 2)
+               afs_osi_Sleep(&afs_RX_Running);
+          sprintf(current->comm, "afs_callback");
+          afs_RXCallBackServer();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     case AFSOP_START_AFS:
+          sprintf(current->comm, "afs_afsstart");
+          AFS_GLOCK();
+          complete(arg->complete);
+          AFS_Running = 1;
+          while (afs_initState < AFSOP_START_AFS) 
+               afs_osi_Sleep(&afs_initState);
+          DInit(AFS_MINBUFFERS);          
+          afs_initState = AFSOP_START_BKG;
+          afs_osi_Wakeup(&afs_initState);
+          sprintf(current->comm, "afsd");
+          afs_Daemon();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     case AFSOP_START_BKG:
+          sprintf(current->comm, "afs_bkgstart");
+          AFS_GLOCK();
+          complete(arg->complete);
+          while (afs_initState < AFSOP_START_BKG) 
+               afs_osi_Sleep(&afs_initState);
+          if (afs_initState < AFSOP_GO) {
+               afs_initState = AFSOP_GO;
+               afs_osi_Wakeup(&afs_initState);
+          }
+          sprintf(current->comm, "afs_background");          
+          afs_BackgroundDaemon();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     case AFSOP_START_TRUNCDAEMON:
+          sprintf(current->comm, "afs_trimstart");
+          AFS_GLOCK();
+          complete(arg->complete);
+          while (afs_initState < AFSOP_GO) 
+               afs_osi_Sleep(&afs_initState);
+          sprintf(current->comm, "afs_cachetrim");
+          afs_CacheTruncateDaemon();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     case AFSOP_START_CS:
+          sprintf(current->comm, "afs_checkserver");
+          AFS_GLOCK();
+          complete(arg->complete);
+          afs_CheckServerDaemon();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     case AFSOP_RXEVENT_DAEMON:
+          sprintf(current->comm, "afs_evtstart");
+#ifdef SYS_SETPRIORITY_EXPORTED
+        sys_setpriority(PRIO_PROCESS,0,-10);
+#else
+#ifdef CURRENT_INCLUDES_NICE
+        current->nice=-10;
+#endif
+#endif
+          AFS_GLOCK();
+          complete(arg->complete);
+          while (afs_initState < AFSOP_START_BKG) 
+               afs_osi_Sleep(&afs_initState);
+          sprintf(current->comm, "afs_rxevent");
+          afs_rxevent_daemon();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     case AFSOP_RXLISTENER_DAEMON:
+          sprintf(current->comm, "afs_lsnstart");
+#ifdef SYS_SETPRIORITY_EXPORTED
+        sys_setpriority(PRIO_PROCESS,0,-10);
+#else
+#ifdef CURRENT_INCLUDES_NICE
+        current->nice=-10;
+#endif
+#endif
+          AFS_GLOCK();
+          complete(arg->complete);
+          afs_initState = AFSOP_START_AFS;
+          afs_osi_Wakeup(&afs_initState);
+          afs_RX_Running = 2;
+          afs_osi_Wakeup(&afs_RX_Running);
+          afs_osi_RxkRegister();
+          sprintf(current->comm, "afs_rxlistener");
+          rxk_Listener();
+          AFS_GUNLOCK();
+          complete_and_exit(0,0);
+          break;
+     default:
+          printf("Unknown op %d in StartDaemon()\n");
+          break;
+     }
+     return 0;
+}
+
+void afsd_launcher(void *rock) {
+     if (!kernel_thread(afsd_thread,rock, CLONE_VFORK|SIGCHLD))
+       printf("kernel_thread failed. afs startup will not complete\n");
+}
+
+void afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5, 
+             long parm6) 
+{
+     int code;
+     DECLARE_COMPLETION(c);
+     struct tq_struct tq;
+     struct afsd_thread_info info;     
+     if (parm == AFSOP_START_RXCALLBACK) {
+          if (afs_CB_Running) return;
+     } else if (parm == AFSOP_RXLISTENER_DAEMON) {
+          if (afs_RX_Running) return;
+          afs_RX_Running=1;
+          code = afs_InitSetup(parm2);
+          if (parm3) {
+               rx_enablePeerRPCStats();
+          }
+          if (parm4) {
+               rx_enableProcessRPCStats();
+          }
+          if (code)
+               return;
+     } else if (parm == AFSOP_START_AFS) {
+          if (AFS_Running) return;
+     } /* other functions don't need setup in the parent */     
+     info.complete=&c;
+     info.parm=parm;
+     tq.sync=0;
+     INIT_LIST_HEAD(&tq.list);
+     tq.routine=afsd_launcher;
+     tq.data=&info;
+     schedule_task(&tq);
+     AFS_GUNLOCK();
+     /* we need to wait cause we passed stack pointers around.... */
+     wait_for_completion(&c);
+     AFS_GLOCK();
+}
+#endif
 
 afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
 long parm, parm2, parm3, parm4, parm5, parm6;
@@ -151,6 +318,12 @@ long parm, parm2, parm3, parm4, parm5, parm6;
 #endif
     }
     AFS_GLOCK();
+#if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS) && !defined(UKERNEL)
+    if (parm < AFSOP_ADDCELL || parm == AFSOP_RXEVENT_DAEMON
+         || parm == AFSOP_RXLISTENER_DAEMON) {
+         afs_DaemonOp(parm,parm2,parm3,parm4,parm5,parm6);
+    }
+#else
     if (parm == AFSOP_START_RXCALLBACK) {
        if (afs_CB_Running) goto out;
        afs_CB_Running = 1;
@@ -278,6 +451,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
 #endif
     }
 #endif 
+#endif
     else if (parm == AFSOP_ADDCELL) {
        /* add a cell.  Parameter 2 is 8 hosts (in net order),  parm 3 is the null-terminated
         name.  Parameter 4 is the length of the name, including the null.  Parm 5 is the
@@ -618,11 +792,19 @@ long parm, parm2, parm3, parm4, parm5, parm6;
       }
 #else /* AFS_USERSPACE_IP_ADDR */
       struct ifnet *tifnp;
+#ifdef AFS_DARWIN60_ENV
+      struct ifaddr *tifadp = (struct ifaddr *) 0;
+#else
       struct in_ifaddr *tifadp = (struct in_ifaddr *) 0;
+#endif
       extern struct ifnet *rxi_FindIfnet();
       tifnp = rxi_FindIfnet(parm2, &tifadp);  /* make iterative */
       if (tifnp && tifadp) {
+#ifdef AFS_DARWIN60_ENV
+        mask = ((struct sockaddr_in *)tifadp->ifa_netmask)->sin_addr.s_addr;
+#else
         mask = tifadp->ia_subnetmask;
+#endif
       } else {
         code = -1;
       }
index 040c30e6ea7a0bf47273d52bd5b73a3e1506446f..0df96f120085b65b84e3a0e76af64be8ec65249b 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_pioctl.c,v 1.14 2002/08/02 04:57:37 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_pioctl.c,v 1.15 2002/09/26 19:18:06 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -430,17 +430,28 @@ afs_xioctl ()
 #endif /* AFS_SUN5_ENV */
 #endif
 #ifndef AFS_LINUX22_ENV
-#if    defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if    defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
       struct file *fd;
 #else
       register struct file *fd;
 #endif
+#endif
+#if defined(AFS_FBSD_ENV)
+      register struct filedesc *fdp;
 #endif
       register struct vcache *tvc;
       register int ioctlDone = 0, code = 0;
       
       AFS_STATCNT(afs_xioctl);
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_FBSD_ENV)
+        fdp=p->p_fd;
+        if ((u_int)uap->fd >= fdp->fd_nfiles ||
+            (fd = fdp->fd_ofiles[uap->fd]) == NULL)
+                return EBADF;
+        if ((fd->f_flag & (FREAD | FWRITE)) == 0)
+                return EBADF;
+#else
+#if defined(AFS_DARWIN_ENV)
         if ((code=fdgetf(p, uap->fd, &fd)))
            return code;
 #else
@@ -480,6 +491,7 @@ afs_xioctl ()
 #endif
 #endif
 #endif
+#endif
 #endif
       
       /* first determine whether this is any sort of vnode */
@@ -589,7 +601,10 @@ afs_xioctl ()
 #endif
           code = ioctl(uap, rvp);
 #else
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_FBSD_ENV)
+        return ioctl(p, uap);
+#else
+#if defined(AFS_DARWIN_ENV) 
         return ioctl(p, uap, retval);
 #else
 #ifdef  AFS_OSF_ENV
@@ -608,6 +623,7 @@ afs_xioctl ()
 #endif
 #endif
 #endif
+#endif
 #endif
       }
 #ifdef AFS_SUN5_ENV
@@ -1072,6 +1088,7 @@ afs_HandlePioctl(avc, acom, ablob, afollow, acred)
     inData = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
     if (inSize > 0) {
       AFS_COPYIN(ablob->in, inData, inSize, code);
+      inData[inSize]='\0';
     }
     else code = 0;
     if (code) {
@@ -1089,8 +1106,10 @@ afs_HandlePioctl(avc, acom, ablob, afollow, acred)
     if (code == 0 && ablob->out_size > 0) {
       if (outSize > ablob->out_size) outSize = ablob->out_size;
       if (outSize >= PIGGYSIZE) code = E2BIG;
-      else if  (outSize) 
+      else if  (outSize) {
+       outData[outSize]='\0';
        AFS_COPYOUT(outData, ablob->out, outSize, code);
+      }
     }
     osi_FreeLargeSpace(outData);
     afs_PutFakeStat(&fakestate);
@@ -1185,11 +1204,12 @@ static PStoreBehind(avc, afun, areq, ain, aout, ainSize, aoutSize, acred)
     else code = EPERM;
   }
 
-  if (avc && (sbr->sb_thisfile != -1))
+  if (avc && (sbr->sb_thisfile != -1)) {
     if (afs_AccessOK(avc, PRSFS_WRITE | PRSFS_ADMINISTER, 
                      areq, DONT_CHECK_MODE_BITS))
       avc->asynchrony = sbr->sb_thisfile;
     else code = EACCES;
+  }
 
   *aoutSize = sizeof(struct sbstruct);
   sbr = (struct sbstruct *)aout;
@@ -1412,6 +1432,7 @@ static PGCPAGs(avc, afun, areq, ain, aout, ainSize, aoutSize, acred)
     ain += sizeof(afs_int32);
     stp        = ain;  /* remember where the ticket is */
     if (i < 0 || i > 2000) return EINVAL;      /* malloc may fail */
+    if (i > MAXKTCTICKETLEN) return EINVAL;
     stLen = i;
     ain        += i;   /* skip over ticket */
     memcpy((char *)&i, ain, sizeof(afs_int32));
@@ -1451,7 +1472,11 @@ static PGCPAGs(avc, afun, areq, ain, aout, ainSize, aoutSize, acred)
     if (set_parent_pag) {
        int pag;
 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_DARWIN_ENV)
         struct proc *p=current_proc(); /* XXX */
+#else
+        struct proc *p=curproc; /* XXX */
+#endif
         uprintf("Process %d (%s) tried to change pags in PSetTokens\n",
                 p->p_pid, p->p_comm);
         if (!setpag(p, acred, -1, &pag, 1)) {
index 3dfd8c9f4be8ede32034f1c9f1654e45a69d7be6..da91e0983d4cb60855d695dc11d4d4ae1500a4a3 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosoprocs.c,v 1.5 2002/05/12 05:50:43 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosoprocs.c,v 1.6 2002/09/26 19:18:07 hartmans Exp $");
 
 #include <afs/stds.h>
 #include <sys/types.h>
@@ -1260,6 +1260,13 @@ int DirAccessOK ()
     for (i=0; i<bozo_nbosEntryStats; i++) {
        struct bozo_bosEntryStats *e = &bozo_bosEntryStats[i];
        if (!StatEachEntry (e)) {
+           bozo_Log("unhappy with %s which is a %s that should "
+                    "have at least rights %o, at most rights %o %s\n",
+                    e->path, 
+                    e->dir ? "dir" : "file", 
+                    e->reqPerm, 
+                    e->proPerm, 
+                    e->rootOwner ? ", owned by root" : "");
            result = 0;
            break;
        }
index 5c14c95c2254c1524bb566e1e3529750bc4e1343..6f2b45165c37ad1a133792329b2f0097479c271d 100644 (file)
@@ -25,9 +25,10 @@ PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
 XCFLAGS= -O2
 MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
 XLDFLAGS=
-SHARE_LDFLAGS = -shared -Xlinker -x
+SHLIB_LDFLAGS = -shared -Xlinker -x
 SHLIB_SUFFIX=so
 SHLIB_CFLAGS=
+SHLIB_LINKER=${MT_CC} -shared
 #
 # libraries
 MTLIBS=-lpthread
index 0063b334bcc4de341d91208741ae811fb7acecf9..4c213802f9bf17b0515acc8ccfd0926c2152b90d 100644 (file)
@@ -17,9 +17,10 @@ PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
 XCFLAGS= -O2
 MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
 XLDFLAGS=
-SHARE_LDFLAGS = -shared -Xlinker -x
+SHLIB_LDFLAGS = -shared -Xlinker -x
 SHLIB_SUFFIX=so
 SHLIB_CFLAGS=
+SHLIB_LINKER=${MT_CC} -shared
 #
 # libraries
 MTLIBS=-lpthread
index 00762dd0e5baffd03e24dec3c66213bf20efefdc..12e1bc6cd090416ce2ffaf6408cd8b8ce77a2613 100644 (file)
@@ -17,9 +17,10 @@ PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
 XCFLAGS= -O2
 MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
 XLDFLAGS=
-SHARE_LDFLAGS = -shared -Xlinker -x
+SHLIB_LDFLAGS = -shared -Xlinker -x
 SHLIB_SUFFIX=so
 SHLIB_CFLAGS=
+SHLIB_LINKER=${MT_CC} -shared
 #
 # libraries
 MTLIBS=-lpthread
index 4ae8096e700d4ce9fc2dfcceed374b05c9f89157..4e9c202a97825e2b4eea3057ed85df914c399772 100644 (file)
@@ -20,7 +20,7 @@
 
 #if !defined(KERNEL) && !defined(_KMEMUSER) && !defined(AFS_PTHREAD_ENV)
 #include <afs/param.h>
-#ifdef HAVE_UCONTEXT_H
+#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
 #include <ucontext.h>
 #else
 #include <setjmp.h>
@@ -195,7 +195,7 @@ typedef struct lwp_pcb {
 #else
 struct lwp_context {   /* saved context for dispatcher */
     char *topstack;    /* ptr to top of process stack */
-#ifdef HAVE_UCONTEXT_H
+#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
     ucontext_t ucontext;
     int state;
 #else /* !HAVE_UCONTEXT_H */
index 09ae15aee25346abb6575cb2f9580b24871734db..f3118c3479b5f23d392a81b73aeb17d38d2f3b3d 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/preempt.c,v 1.9 2001/09/20 06:47:46 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/preempt.c,v 1.10 2002/09/26 19:18:08 hartmans Exp $");
 
 
 #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DJGPP_ENV)
@@ -24,7 +24,9 @@ int PRE_Block = 0;
 #else
 #include <sys/time.h>
 #include <signal.h>
+#ifdef HAVE_UCONTEXT_H
 #include <ucontext.h>
+#endif
 #include "lwp.h"
 #include "preempt.h"
 
@@ -34,15 +36,25 @@ int PRE_Block = 0;          /* used in lwp.c and process.s */
 char PRE_Block = 0;            /* used in lwp.c and process.s */
 #endif
 
+#if HAVE_SIGACTION && defined(SA_SIGINFO)
 static void AlarmHandler(sig, st, scp)
     int sig;
     siginfo_t *st;
     ucontext_t *scp;
+#else
+static void AlarmHandler(sig, code, scp)
+    int sig, code;
+    struct sigcontext *scp;
+#endif
     {
     if (PRE_Block == 0 && lwp_cpptr->level == 0)
        {
        PRE_BeginCritical();
+#if HAVE_SIGACTION && defined(SA_SIGINFO)
        sigprocmask(SIG_SETMASK, &scp->uc_sigmask, NULL);
+#else
+       sigsetmask(scp->sc_mask);
+#endif
        LWP_DispatchProcess();
        PRE_EndCritical();
        }
@@ -53,7 +65,11 @@ int PRE_InitPreempt(slice)
     struct timeval *slice;
     {
     struct itimerval itv;
+#if HAVE_SIGACTION && defined(SA_SIGINFO)
     struct sigaction action;
+#else
+    struct sigvec vec;
+#endif
 
     if (lwp_cpptr == 0) return (LWP_EINIT);
     
@@ -67,6 +83,7 @@ int PRE_InitPreempt(slice)
        itv.it_interval = itv.it_value = *slice;
        }
 
+#if HAVE_SIGACTION && defined(SA_SIGINFO)
     memset((char *)&action, 0, sizeof(action));
     action.sa_sigaction = AlarmHandler;
     action.sa_flags = SA_SIGINFO;
@@ -74,6 +91,15 @@ int PRE_InitPreempt(slice)
     if ((sigaction(SIGALRM, &action, (struct sigaction *)0) == -1) ||
        (setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1))
        return(LWP_ESYSTEM);
+#else
+    memset((char *)&vec, 0, sizeof(vec));
+    vec.sv_handler = AlarmHandler;
+    vec.sv_mask = vec.sv_onstack = 0;
+
+    if ((sigvec(SIGALRM, &vec, (struct sigvec *)0) == -1) ||
+       (setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1))
+       return(LWP_ESYSTEM);
+#endif
 
     return(LWP_SUCCESS);
     }
@@ -81,18 +107,32 @@ int PRE_InitPreempt(slice)
 int PRE_EndPreempt()
     {
     struct itimerval itv;
+#if HAVE_SIGACTION && defined(SA_SIGINFO)
     struct sigaction action;
+#else
+    struct sigvec vec;
+#endif
 
     if (lwp_cpptr == 0) return (LWP_EINIT);
     
     itv.it_value.tv_sec = itv.it_value.tv_usec = 0;
 
+#if HAVE_SIGACTION && defined(SA_SIGINFO)
     memset((char *)&action, 0, sizeof(action));
     action.sa_handler = SIG_DFL;
 
     if ((setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1) ||
        (sigaction(SIGALRM, &action, (struct sigaction *)0) == -1))
        return(LWP_ESYSTEM);
+#else
+    memset((char *)&vec, 0, sizeof(vec));
+    vec.sv_handler = SIG_DFL;
+    vec.sv_mask = vec.sv_onstack = 0;
+
+    if ((setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1) ||
+       (sigvec(SIGALRM, &vec, (struct sigvec *)0) == -1))
+       return(LWP_ESYSTEM);
+#endif
 
     return(LWP_SUCCESS);
     }
index 1385de8b3274b5ed9457cbeed8272fb2ecf52dbc..3f24271b9a08f3daaaa6c4eb325d9f93d174a8ca 100644 (file)
@@ -12,7 +12,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/process.c,v 1.9 2002/02/25 19:53:25 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/process.c,v 1.10 2002/09/26 19:18:08 hartmans Exp $");
 
 #include <stdio.h>
 #include <assert.h>
@@ -27,7 +27,7 @@ extern int PRE_Block;              /* used in lwp.c and process.s */
 extern char PRE_Block;             /* used in lwp.c and process.s */
 #endif
 
-#ifdef HAVE_UCONTEXT_H
+#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
 
 afs_int32
 savecontext(ep, savearea, newsp)
index 90b73b0bd5f1c335b97f99142a9b8f1243ead34b..cbb45e6932edb29cde277262663272ee0f8401ae 100644 (file)
@@ -16,7 +16,7 @@
 #include <afs/param.h>
 #endif
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx.c,v 1.11 2002/01/30 16:54:11 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx.c,v 1.12 2002/09/26 19:18:08 hartmans Exp $");
 
 #ifdef KERNEL
 #include "../afs/sysincludes.h"
@@ -263,23 +263,31 @@ void rxi_StartUnlocked();
 struct rx_connection *rxLastConn = 0; 
 
 #ifdef RX_ENABLE_LOCKS
-/* The locking hierarchy for rx fine grain locking is composed of five
+/* The locking hierarchy for rx fine grain locking is composed of these
  * tiers:
+ *
+ * rx_connHashTable_lock - synchronizes conn creation, rx_connHashTable access
  * conn_call_lock - used to synchonize rx_EndCall and rx_NewCall
  * call->lock - locks call data fields.
- * Most any other lock - these are all independent of each other.....
- *     rx_freePktQ_lock
+ * These are independent of each other:
  *     rx_freeCallQueue_lock
- *     freeSQEList_lock
- *     rx_connHashTable_lock
- *     rx_serverPool_lock
  *     rxi_keyCreate_lock
+ * rx_serverPool_lock
+ * freeSQEList_lock
+ *
+ * serverQueueEntry->lock
+ * rx_rpc_stats
  * rx_peerHashTable_lock - locked under rx_connHashTable_lock
-
+ * peer->lock - locks peer data fields.
+ * conn_data_lock - that more than one thread is not updating a conn data
+ *                 field at the same time.
+ * rx_freePktQ_lock
+ *
  * lowest level:
- *     peer_lock - locks peer data fields.
- *     conn_data_lock - that more than one thread is not updating a conn data
- *             field at the same time.
+ *     multi_handle->lock
+ *     rxevent_lock
+ *     rx_stats_mutex
+ *
  * Do we need a lock to protect the peer field in the conn structure?
  *      conn->peer was previously a constant for all intents and so has no
  *      lock protecting this field. The multihomed client delta introduced
@@ -404,9 +412,9 @@ int rx_Init(u_int port)
 #ifdef RX_LOCKS_DB
     rxdb_init();
 #endif /* RX_LOCKS_DB */
-    MUTEX_INIT(&rx_stats_mutex, "rx_stats_mutex",MUTEX_DEFAULT,0);    
-    MUTEX_INIT(&rx_rpc_stats, "rx_rpc_stats",MUTEX_DEFAULT,0);    
-    MUTEX_INIT(&rx_freePktQ_lock, "rx_freePktQ_lock",MUTEX_DEFAULT,0);    
+    MUTEX_INIT(&rx_stats_mutex, "rx_stats_mutex",MUTEX_DEFAULT,0);
+    MUTEX_INIT(&rx_rpc_stats, "rx_rpc_stats",MUTEX_DEFAULT,0);
+    MUTEX_INIT(&rx_freePktQ_lock, "rx_freePktQ_lock",MUTEX_DEFAULT,0);
     MUTEX_INIT(&freeSQEList_lock, "freeSQEList lock",MUTEX_DEFAULT,0);
     MUTEX_INIT(&rx_freeCallQueue_lock, "rx_freeCallQueue_lock",
               MUTEX_DEFAULT,0);
@@ -957,9 +965,10 @@ static void rxi_DestroyConnectionNoLock(conn)
 
     /* Make sure the connection is completely reset before deleting it. */
     /* get rid of pending events that could zap us later */
-    if (conn->challengeEvent) {
+    if (conn->challengeEvent)
        rxevent_Cancel(conn->challengeEvent, (struct rx_call*)0, 0);
-    }
+    if (conn->checkReachEvent)
+       rxevent_Cancel(conn->checkReachEvent, (struct rx_call*)0, 0);
  
     /* Add the connection to the list of destroyed connections that
      * need to be cleaned up. This is necessary to avoid deadlocks
@@ -1247,6 +1256,7 @@ rx_NewService(port, serviceId, serviceName, securityObjects,
            service->idleDeadTime = 60;
            service->connDeadTime = rx_connDeadTime;
            service->executeRequestProc = serviceProc;
+           service->checkReach = 0;
            rx_services[i] = service;   /* not visible until now */
            AFS_RXGUNLOCK();
            USERPRI;
@@ -1423,7 +1433,7 @@ osi_socket *socketp;
     } else {    /* otherwise allocate a new one and return that */
        MUTEX_EXIT(&freeSQEList_lock);
        sq = (struct rx_serverQueueEntry *) rxi_Alloc(sizeof(struct rx_serverQueueEntry));
-       MUTEX_INIT(&sq->lock, "server Queue lock",MUTEX_DEFAULT,0);     
+       MUTEX_INIT(&sq->lock, "server Queue lock",MUTEX_DEFAULT,0);
        CV_INIT(&sq->cv, "server Queue lock", CV_DEFAULT, 0);
     }
 
@@ -1581,7 +1591,7 @@ rx_GetCall(tno, cur_service, socketp)
     } else {    /* otherwise allocate a new one and return that */
        MUTEX_EXIT(&freeSQEList_lock);
        sq = (struct rx_serverQueueEntry *) rxi_Alloc(sizeof(struct rx_serverQueueEntry));
-       MUTEX_INIT(&sq->lock, "server Queue lock",MUTEX_DEFAULT,0);     
+       MUTEX_INIT(&sq->lock, "server Queue lock",MUTEX_DEFAULT,0);
        CV_INIT(&sq->cv, "server Queue lock", CV_DEFAULT, 0);
     }
     MUTEX_ENTER(&sq->lock);
@@ -2408,9 +2418,9 @@ struct rx_packet *rxi_ReceivePacket(np, socket, host, port, tnop, newcallp)
        addr.sin_family = AF_INET;
        addr.sin_port = port;
        addr.sin_addr.s_addr = host;
-#if  defined(AFS_OSF_ENV) && defined(_KERNEL)
+#ifdef STRUCT_SOCKADDR_HAS_SA_LEN 
         addr.sin_len = sizeof(addr);
-#endif  /* AFS_OSF_ENV */
+#endif  /* STRUCT_SOCKADDR_HAS_SA_LEN */
        drop = (*rx_justReceived) (np, &addr);
        /* drop packet if return value is non-zero */
        if (drop) return np;
@@ -2438,7 +2448,7 @@ struct rx_packet *rxi_ReceivePacket(np, socket, host, port, tnop, newcallp)
 
     MUTEX_ENTER(&conn->conn_data_lock);
     if (conn->maxSerial < np->header.serial)
-      conn->maxSerial = np->header.serial;
+       conn->maxSerial = np->header.serial;
     MUTEX_EXIT(&conn->conn_data_lock);
 
     /* If the connection is in an error state, send an abort packet and ignore
@@ -2555,7 +2565,9 @@ struct rx_packet *rxi_ReceivePacket(np, socket, host, port, tnop, newcallp)
            return np;
        }
        if (!call) {
+           MUTEX_ENTER(&conn->conn_call_lock);
            call = rxi_NewCall(conn, channel);
+           MUTEX_EXIT(&conn->conn_call_lock);
            *call->callNumber = np->header.callNumber;
            call->state = RX_STATE_PRECALL;
            clock_GetTime(&call->queueTime);
@@ -2865,20 +2877,110 @@ static TooLow(ap, acall)
 }
 #endif /* KERNEL */
 
+static void rxi_CheckReachEvent(event, conn, acall)
+    struct rxevent *event;
+    struct rx_connection *conn;
+    struct rx_call *acall;
+{
+    struct rx_call *call = acall;
+    struct clock when;
+    int i, waiting;
+
+    MUTEX_ENTER(&conn->conn_data_lock);
+    conn->checkReachEvent = (struct rxevent *) 0;
+    waiting = conn->flags & RX_CONN_ATTACHWAIT;
+    if (event) conn->refCount--;
+    MUTEX_EXIT(&conn->conn_data_lock);
+
+    if (waiting) {
+       if (!call) {
+           MUTEX_ENTER(&conn->conn_call_lock);
+           MUTEX_ENTER(&conn->conn_data_lock);
+           for (i=0; i<RX_MAXCALLS; i++) {
+               struct rx_call *tc = conn->call[i];
+               if (tc && tc->state == RX_STATE_PRECALL) {
+                   call = tc;
+                   break;
+               }
+           }
+           if (!call)
+               /* Indicate that rxi_CheckReachEvent is no longer running by
+                * clearing the flag.  Must be atomic under conn_data_lock to
+                * avoid a new call slipping by: rxi_CheckConnReach holds
+                * conn_data_lock while checking RX_CONN_ATTACHWAIT.
+                */
+               conn->flags &= ~RX_CONN_ATTACHWAIT;
+           MUTEX_EXIT(&conn->conn_data_lock);
+           MUTEX_EXIT(&conn->conn_call_lock);
+       }
+
+       if (call) {
+           if (call != acall) MUTEX_ENTER(&call->lock);
+           rxi_SendAck(call, NULL, 0, 0, 0, RX_ACK_PING, 0);
+           if (call != acall) MUTEX_EXIT(&call->lock);
+
+           clock_GetTime(&when);
+           when.sec += RX_CHECKREACH_TIMEOUT;
+           MUTEX_ENTER(&conn->conn_data_lock);
+           if (!conn->checkReachEvent) {
+               conn->refCount++;
+               conn->checkReachEvent =
+                   rxevent_Post(&when, rxi_CheckReachEvent, conn, NULL);
+           }
+           MUTEX_EXIT(&conn->conn_data_lock);
+       }
+    }
+}
+
+static int rxi_CheckConnReach(conn, call)
+    struct rx_connection *conn;
+    struct rx_call *call;
+{
+    struct rx_service *service = conn->service;
+    struct rx_peer *peer = conn->peer;
+    afs_uint32 now, lastReach;
+
+    if (service->checkReach == 0)
+       return 0;
+
+    now = clock_Sec();
+    MUTEX_ENTER(&peer->peer_lock);
+    lastReach = peer->lastReachTime;
+    MUTEX_EXIT(&peer->peer_lock);
+    if (now - lastReach < RX_CHECKREACH_TTL)
+       return 0;
+
+    MUTEX_ENTER(&conn->conn_data_lock);
+    if (conn->flags & RX_CONN_ATTACHWAIT) {
+       MUTEX_EXIT(&conn->conn_data_lock);
+       return 1;
+    }
+    conn->flags |= RX_CONN_ATTACHWAIT;
+    MUTEX_EXIT(&conn->conn_data_lock);
+    if (!conn->checkReachEvent)
+       rxi_CheckReachEvent((struct rxevent *)0, conn, call);
+
+    return 1;
+}
+
 /* try to attach call, if authentication is complete */
-static void TryAttach(acall, socket, tnop, newcallp)
-register struct rx_call *acall;
-register osi_socket socket;
-register int *tnop;
-register struct rx_call **newcallp; {
-    register struct rx_connection *conn;
-    conn = acall->conn;
-    if ((conn->type==RX_SERVER_CONNECTION) && (acall->state == RX_STATE_PRECALL)) {
+static void TryAttach(acall, socket, tnop, newcallp, reachOverride)
+    register struct rx_call *acall;
+    register osi_socket socket;
+    register int *tnop;
+    register struct rx_call **newcallp;
+    int reachOverride;
+{
+    struct rx_connection *conn = acall->conn;
+
+    if (conn->type==RX_SERVER_CONNECTION && acall->state==RX_STATE_PRECALL) {
        /* Don't attach until we have any req'd. authentication. */
        if (RXS_CheckAuthentication(conn->securityObject, conn) == 0) {
-           rxi_AttachServerProc(acall, socket, tnop, newcallp);
-           /* Note:  this does not necessarily succeed; there
-              may not any proc available */
+           if (reachOverride || rxi_CheckConnReach(conn, acall) == 0)
+               rxi_AttachServerProc(acall, socket, tnop, newcallp);
+               /* Note:  this does not necessarily succeed; there
+                * may not any proc available
+                */
        }
        else {
            rxi_ChallengeOn(acall->conn);
@@ -3053,7 +3155,7 @@ struct rx_packet *rxi_ReceiveDataPacket(call, np, istack, socket, host,
             * server thread is available, this thread becomes a server
             * thread and the server thread becomes a listener thread. */
            if (isFirst) {
-               TryAttach(call, socket, tnop, newcallp);
+               TryAttach(call, socket, tnop, newcallp, 0);
            }
        }       
        /* This is not the expected next packet. */
@@ -3241,6 +3343,35 @@ nextloop:;
 static void rxi_ComputeRate();
 #endif
 
+static void rxi_UpdatePeerReach(conn, acall)
+    struct rx_connection *conn;
+    struct rx_call *acall;
+{
+    struct rx_peer *peer = conn->peer;
+
+    MUTEX_ENTER(&peer->peer_lock);
+    peer->lastReachTime = clock_Sec();
+    MUTEX_EXIT(&peer->peer_lock);
+
+    MUTEX_ENTER(&conn->conn_data_lock);
+    if (conn->flags & RX_CONN_ATTACHWAIT) {
+       int i;
+
+       conn->flags &= ~RX_CONN_ATTACHWAIT;
+       MUTEX_EXIT(&conn->conn_data_lock);
+
+       for (i=0; i<RX_MAXCALLS; i++) {
+           struct rx_call *call = conn->call[i];
+           if (call) {
+               if (call != acall) MUTEX_ENTER(&call->lock);
+               TryAttach(call, -1, NULL, NULL, 1);
+               if (call != acall) MUTEX_EXIT(&call->lock);
+           }
+       }
+    } else
+       MUTEX_EXIT(&conn->conn_data_lock);
+}
+
 /* The real smarts of the whole thing.  */
 struct rx_packet *rxi_ReceiveAckPacket(call, np, istack)
     register struct rx_call *call;
@@ -3288,6 +3419,9 @@ struct rx_packet *rxi_ReceiveAckPacket(call, np, istack)
     if (np->header.flags & RX_SLOW_START_OK) {
        call->flags |= RX_CALL_SLOW_START_OK;
     }
+
+    if (ap->reason == RX_ACK_PING_RESPONSE)
+       rxi_UpdatePeerReach(conn, call);
     
 #ifdef RXDEBUG
     if (rx_Log) {
@@ -3743,8 +3877,9 @@ struct rx_packet *rxi_ReceiveResponsePacket(conn, np, istack)
     }
     else {
        /* If the response is valid, any calls waiting to attach
-         * servers can now do so */
+        * servers can now do so */
        int i;
+
        for (i=0; i<RX_MAXCALLS; i++) {
            struct rx_call *call = conn->call[i];
            if (call) {
@@ -3754,6 +3889,12 @@ struct rx_packet *rxi_ReceiveResponsePacket(conn, np, istack)
                MUTEX_EXIT(&call->lock);
            }
        }
+
+       /* Update the peer reachability information, just in case
+        * some calls went into attach-wait while we were waiting
+        * for authentication..
+        */
+       rxi_UpdatePeerReach(conn, NULL);
     }
     return np;
 }
@@ -3804,10 +3945,10 @@ rxi_ReceiveChallengePacket(conn, np, istack)
  * call so it eventually gets one */
 void 
 rxi_AttachServerProc(call, socket, tnop, newcallp)
-register struct rx_call *call;
-register osi_socket socket;
-register int *tnop;
-register struct rx_call **newcallp;
+    register struct rx_call *call;
+    register osi_socket socket;
+    register int *tnop;
+    register struct rx_call **newcallp;
 {
     register struct rx_serverQueueEntry *sq;
     register struct rx_service *service = call->conn->service;
@@ -4159,8 +4300,16 @@ void rxi_ConnectionError(conn, error)
 {
     if (error) {
        register int i;
+       MUTEX_ENTER(&conn->conn_data_lock);
        if (conn->challengeEvent)
            rxevent_Cancel(conn->challengeEvent, (struct rx_call*)0, 0);
+       if (conn->checkReachEvent) {
+           rxevent_Cancel(conn->checkReachEvent, (struct rx_call*)0, 0);
+           conn->checkReachEvent = 0;
+           conn->flags &= ~RX_CONN_ATTACHWAIT;
+           conn->refCount--;
+       }
+       MUTEX_EXIT(&conn->conn_data_lock);
        for (i=0; i<RX_MAXCALLS; i++) {
            struct rx_call *call = conn->call[i];
            if (call) {
@@ -6032,6 +6181,9 @@ static int MakeDebugCall(
     taddr.sin_family = AF_INET;
     taddr.sin_port = remotePort;
     taddr.sin_addr.s_addr = remoteAddr;
+#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
+    taddr.sin_len = sizeof(struct sockaddr_in);
+#endif
     while(1) {
        memset(&theader, 0, sizeof(theader));
        theader.epoch = htonl(999);
index 0bcc8349e94adee48bac9c18ab8d5e470dcb4c5a..8c98956ca4b300a0eb11058e7df5e7b84b5b27f7 100644 (file)
@@ -14,7 +14,7 @@
 #include <afs/param.h>
 #endif
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_packet.c,v 1.6 2001/10/14 18:43:30 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_packet.c,v 1.7 2002/09/26 19:18:09 hartmans Exp $");
 
 #ifdef KERNEL
 #if defined(UKERNEL)
@@ -33,6 +33,12 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_packet.c,v 1.6 2001/10/14 18:43:3
 #include "../afs/sysincludes.h"
 #endif
 #include "../h/socket.h"
+#if !defined(AFS_SUN5_ENV) &&  !defined(AFS_LINUX20_ENV)
+#if    !defined(AFS_OSF_ENV) && !defined(AFS_AIX41_ENV)
+#include "../sys/mount.h"   /* it gets pulled in by something later anyway */
+#endif
+#include "../h/mbuf.h"
+#endif
 #include "../netinet/in.h"
 #include "../afs/afs_osi.h"
 #include "../rx/rx_kmutex.h"
@@ -42,12 +48,6 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_packet.c,v 1.6 2001/10/14 18:43:3
 #include <sys/sysmacros.h>
 #endif
 #include "../rx/rx_packet.h"
-#if !defined(AFS_SUN5_ENV) &&  !defined(AFS_LINUX20_ENV)
-#if    !defined(AFS_OSF_ENV) && !defined(AFS_AIX41_ENV)
-#include "../sys/mount.h"   /* it gets pulled in by something later anyway */
-#endif
-#include "../h/mbuf.h"
-#endif
 #endif /* defined(UKERNEL) */
 #include "../rx/rx_globals.h"
 #else /* KERNEL */
@@ -1437,7 +1437,9 @@ static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket,
     taddr.sin_family = AF_INET;
     taddr.sin_port = aport;
     taddr.sin_addr.s_addr = ahost;
-
+#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
+    taddr.sin_len = sizeof(struct sockaddr_in);
+#endif
 
     /* We need to trim the niovecs. */
     nbytes = apacket->length;
index 78dc7cedde9b70cb3dfaac3d1008c81ff344cc85..e2f3fbdc9e187f5bf3b3edb6538beb36b45d6458 100644 (file)
@@ -28,7 +28,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/viced/afsfileprocs.c,v 1.9 2002/06/10 12:02:03 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/viced/afsfileprocs.c,v 1.10 2002/09/26 19:18:09 hartmans Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -5530,8 +5530,14 @@ Check_PermissionRights(targetptr, client, rights, CallingRoutine, InStatus)
            }
            else {      /* store data or status */
              /* watch for chowns and chgrps */
-             if (CHOWN(InStatus, targetptr) || CHGRP(InStatus, targetptr))
-               return(EPERM);      /* Was EACCES */
+             if (CHOWN(InStatus, targetptr) || CHGRP(InStatus, targetptr)) {
+               if (VanillaUser (client)) 
+                 return(EPERM);        /* Was EACCES */
+               else
+                 osi_audit(PrivilegeEvent, 0,
+                           AUD_INT, (client ? client->ViceId : 0), 
+                           AUD_INT, CallingRoutine, AUD_END);
+             }
              /* must be sysadmin to set suid/sgid bits */
              if ((InStatus->Mask & AFS_SETMODE) &&
 #ifdef AFS_NT40_ENV
index 24ea226ce2295287abd87d76a9a53db7d5ebd550..e35324a8238b2236f4987b4126874a097de65bd5 100644 (file)
@@ -18,7 +18,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/partition.c,v 1.11 2002/08/02 04:57:39 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/partition.c,v 1.12 2002/09/26 19:18:09 hartmans Exp $");
 
 #include <ctype.h>
 #ifdef AFS_NT40_ENV
@@ -75,6 +75,9 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/vol/partition.c,v 1.11 2002/08/02 04:57
 #else
 #if    defined(AFS_SUN_ENV)
 #include <sys/vfs.h>
+#ifndef AFS_SUN5_ENV
+#include <mntent.h>
+#endif
 #endif
 #ifdef AFS_SUN5_ENV
 #include <unistd.h>
@@ -503,6 +506,7 @@ int VAttachPartitions(void)
            continue; /* Ignore any "special" partitions */
 
 #ifdef AFS_AIX42_ENV
+#ifndef AFS_NAMEI_ENV
        {
            struct superblock fs;
            /* The Log statements are non-sequiters in the SalvageLog and don't
@@ -519,6 +523,7 @@ int VAttachPartitions(void)
                continue;
            }
        }
+#endif
 #endif
 
        /* If we're going to always attach this partition, do it later. */