MacOS 10.6 support update
authorDerrick Brashear <shadow@dementia.org>
Wed, 15 Jul 2009 18:57:56 +0000 (14:57 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 16 Jul 2009 14:59:53 +0000 (08:59 -0600)
Make things build on MacOS 10.6 again. Don't break 10.5 build.
Fix an error in the MacOS port which was left from previous head.

Reviewed-on: http://gerrit.openafs.org/96
Verified-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

19 files changed:
acinclude.m4
src/afsd/afsd.c
src/cf/osconf.m4
src/config/afs_sysnames.h
src/config/param.x86_darwin_100.h
src/des/conf-darwin.h
src/des/make_p.c
src/des/misc.c
src/gtx/curseswindows.c
src/libafs/MakefileProto.DARWIN.in
src/lwp/Makefile.in
src/lwp/process.amd64.s
src/pam/afs_auth.c
src/pam/afs_password.c
src/pam/afs_setcred.c
src/ptserver/Makefile.in
src/rx/DARWIN/rx_kmutex.h
src/usd/usd_file.c
src/util/pthread_glock.c

index 21e626a..0c2d8ee 100644 (file)
@@ -668,6 +668,9 @@ else
                i386-apple-darwin9.*)
                        AFS_SYSNAME="x86_darwin_90"
                        ;;
+               i?86-apple-darwin10.*)
+                       AFS_SYSNAME="x86_darwin_100"
+                       ;;
                sparc-sun-solaris2.5*)
                        AFS_SYSNAME="sun4x_55"
                        enable_login="yes"
index 0809837..40afb63 100644 (file)
@@ -161,12 +161,13 @@ void set_staticaddrs(void);
 #include <sys/ioctl.h>
 #endif
 #include <mach/mach.h>
+#ifndef AFS_DARWIN100_ENV
 /* Symbols from the DiskArbitration framework */
 kern_return_t DiskArbStart(mach_port_t *);
 kern_return_t DiskArbDiskAppearedWithMountpointPing_auto(char *, unsigned int,
                                                         char *);
 #define DISK_ARB_NETWORK_DISK_FLAG 8
-
+#endif
 #include <mach/mach_port.h>
 #include <mach/mach_interface.h>
 #include <mach/mach_init.h>
@@ -2594,6 +2595,7 @@ HandleMTab(void)
 #endif /* AFS_SUN5_ENV */
 #endif /* unreasonable systems */
 #ifdef AFS_DARWIN_ENV
+#ifndef AFS_DARWIN100_ENV
     mach_port_t diskarb_port;
     kern_return_t status;
 
@@ -2606,6 +2608,7 @@ HandleMTab(void)
     }
 
     return status;
+#endif
 #endif /* AFS_DARWIN_ENV */
     return 0;
 }
index 1b45bd8..a5fbbbe 100644 (file)
@@ -566,6 +566,24 @@ case $AFS_SYSNAME in
                RANLIB="ranlib -c"
                ;;
 
+       *_darwin_100)
+               AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
+               LEX="lex -l"
+               MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}'
+               KROOT=
+               KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
+               LD="cc"
+               KERN_OPTMZ="-Os"
+               LWP_OPTMZ="-Os"
+               OPTMZ="-Os"
+               REGEX_OBJ="regex.o"
+               TXLIBS="-lncurses"
+               EXTRA_VLIBOBJS="fstab.o"
+               SHLIB_LINKER="${MT_CC} -dynamiclib"
+               SHLIB_SUFFIX="dylib"
+               RANLIB="ranlib -c"
+               ;;
+
        ppc_linux*)
                KERN_OPTMZ=-O2
                LEX="flex -l"
index 9b6cc6c..3f7824e 100644 (file)
 #define SYS_NAME_ID_x86_darwin_80        509
 #define SYS_NAME_ID_ppc_darwin_90        510
 #define SYS_NAME_ID_x86_darwin_90        511
+#define SYS_NAME_ID_ppc_darwin_100       512
+#define SYS_NAME_ID_ppc64_darwin_100     513
+#define SYS_NAME_ID_x86_darwin_100       514
+#define SYS_NAME_ID_amd64_darwin_100     515
 
 #define SYS_NAME_ID_next_mach20                 601
 #define SYS_NAME_ID_next_mach30                 602
index 49cdd44..de93901 100644 (file)
@@ -10,7 +10,7 @@
 #define AFS_64BIT_IOPS_ENV     1
 #if defined(__ppc__)
 #define AFS_PPC_ENV            1
-#elif defined(__i386__)
+#elif defined(__i386__) || defined(__amd64__)
 #define AFS_X86_ENV            1
 #else
 #error Unsupported architecture
 #define SYS_NAME               "ppc_darwin_100"
 #define SYS_NAME_ID            SYS_NAME_ID_ppc_darwin_100
 #define AFSBIG_ENDIAN          1
-#elif defined(__i386__)
+#elif defined(__ppc64__)
+#define sys_ppc_darwin_12      1
+#define sys_ppc_darwin_13      1
+#define sys_ppc_darwin_14      1
+#define sys_ppc_darwin_60      1
+#define sys_ppc_darwin_70      1
+#define sys_ppc_darwin_80      1
+#define sys_ppc_darwin_90      1
+#define sys_ppc_darwin_100     1
+#define sys_ppc64_darwin_100   1
+#define SYS_NAME               "ppc64_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_ppc64_darwin_100
+#define AFSBIG_ENDIAN          1
+#elif defined(__i386__) 
 #define sys_x86_darwin_12      1
 #define sys_x86_darwin_13      1
 #define sys_x86_darwin_14      1
 #define SYS_NAME               "x86_darwin_100"
 #define SYS_NAME_ID            SYS_NAME_ID_x86_darwin_100
 #define AFSLITTLE_ENDIAN       1
+#elif defined(__amd64__) 
+#define sys_x86_darwin_12      1
+#define sys_x86_darwin_13      1
+#define sys_x86_darwin_14      1
+#define sys_x86_darwin_60      1
+#define sys_x86_darwin_70      1
+#define sys_x86_darwin_80      1
+#define sys_x86_darwin_90      1
+#define sys_x86_darwin_100     1
+#define sys_amd64_darwin_100   1
+#define SYS_NAME               "amd64_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_amd64_darwin_100
+#define AFSLITTLE_ENDIAN       1
 #else
 #error Unsupported architecture
 #endif
 #define AFS_64BIT_ENV           1      /* Defines afs_int32 as int, not long. */
 #if defined(__ppc__)
 #define AFS_PPC_ENV            1
-#elif defined(__i386__)
+#elif defined(__i386__) || defined(__amd64__)
 #define AFS_X86_ENV            1
 #else
 #error Unsupported architecture
 #define SYS_NAME               "x86_darwin_100"
 #define SYS_NAME_ID            SYS_NAME_ID_x86_darwin_100
 #define AFSLITTLE_ENDIAN       1
+#elif defined(__amd64__)
+#define sys_x86_darwin_12      1
+#define sys_x86_darwin_13      1
+#define sys_x86_darwin_14      1
+#define sys_x86_darwin_60      1
+#define sys_x86_darwin_70      1
+#define sys_x86_darwin_80      1
+#define sys_x86_darwin_100     1
+#define sys_amd64_darwin_100   1
+#define SYS_NAME               "amd64_darwin_100"
+#define SYS_NAME_ID            SYS_NAME_ID_amd64_darwin_100
+#define AFSLITTLE_ENDIAN       1
 #else
 #error Unsupported architecture
 #endif
index 2bf8e1f..f686e46 100644 (file)
@@ -1,9 +1,9 @@
 #define BITS32
 #define BIG
 #undef BSDUNIX
-#if defined(__ppc__)
+#if defined(__ppc__) || defined(__ppc64__)
 #define MSBFIRST
-#elif defined(__i386__)
+#elif defined(__i386__) || defined(__amd64__)
 #define LSBFIRST
 #else
 #error "MSBFIRST or LSBFIRST undefined"
index c4dd119..1e61e48 100644 (file)
@@ -38,12 +38,12 @@ gen(FILE * stream)
     fprintf(stream, "    P_temp_p = (unsigned char *) &P_temp;\n");
 
 #ifdef AFS_DARWIN80_ENV
-    fprintf(stream, "#if defined(__i386__)\n");
+    fprintf(stream, "#if defined(__i386__) || defined(__amd64__)\n");
     fprintf(stream, "    R2 = P_prime[0][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[1][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[2][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[3][*P_temp_p];\n");
-    fprintf(stream, "#elif defined(__ppc__)\n");
+    fprintf(stream, "#elif defined(__ppc__) || defined(__ppc64__)\n");
     fprintf(stream, "    R2 = P_prime[3][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[2][*P_temp_p++];\n");
     fprintf(stream, "    R2 |= P_prime[1][*P_temp_p++];\n");
index 6a16de3..7d0e129 100644 (file)
@@ -270,8 +270,8 @@ swap_long_bytes_bit_number(afs_uint32 x)
 
 #if !defined(KERNEL) && defined(AFS_DARWIN80_ENV)
 char *_darwin_whichstr[] = {
-    "#if defined(__ppc__)\n",
-    "#elif defined(__i386__)\n",
+    "#if defined(__ppc__) || defined(__ppc64__)\n",
+    "#elif defined(__i386__) || defined(__amd64__)\n",
     "#else\n#error architecture unsupported\n#endif\n"
 };
 int _darwin_which = 1;
index 0401935..7dc59b8 100644 (file)
@@ -772,7 +772,7 @@ gator_cursesgwin_getdimensions(struct gwin *gwp, struct gwin_sizeparams *aparms)
 #if defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN60_ENV)
     aparms->maxx = cwp->wp->maxx;
     aparms->maxy = cwp->wp->maxy;
-#elif defined(AFS_NBSD_ENV)
+#elif defined(AFS_NBSD_ENV) || defined(AFS_DARWIN100_ENV)
     aparms->maxx = getmaxx(cwp->wp);
     aparms->maxy = getmaxy(cwp->wp);
 #else
index 3e926ff..84e74f8 100644 (file)
@@ -37,49 +37,29 @@ AFS_OS_NONFSOBJS = osi_vfsops.o
 KDEFS=
 DBUG = 
 DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL
+KINCLUDES=-I${KROOT}/System/Library/Frameworks/Kernel.framework/Headers
+
 <ppc_darwin_80 x86_darwin_80>
 KOPTS_DBUG=-g
-<ppc_darwin_90 x86_darwin_90>
+<ppc_darwin_90 x86_darwin_90 x86_darwin_100>
 KOPTS_DBUG=-ggdb
-<ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90>
+<ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90 x86_darwin_100>
 KOPTS_ppc=-static -nostdinc -nostdlib -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED -mcpu=750 -mmultiple -fschedule-insns -force_cpusubtype_ALL
 KOPTS_x86=-static -nostdinc -nostdlib -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch i386 -Di386 -DI386 -D__I386__ -DPAGE_SIZE_FIXED -march=i686 -mpreferred-stack-boundary=2 -falign-functions=4
-ARCH_ppc=$(shell echo "${ARCHFLAGS}" | grep -q -w ppc && echo yes)
-ARCH_x86=$(shell echo "${ARCHFLAGS}" | grep -q -w i386 && echo yes)
-ifeq ($(ARCH_ppc),yes)
-ifeq ($(ARCH_x86),yes)
-MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib -arch ppc -arch i386
+KOPTS_amd64=-static -nostdinc -nostdlib -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch x86_64 -Damd64 -DAMD64 -D__AMD64__ -DPAGE_SIZE_FIXED -march=x86-64 -mpreferred-stack-boundary=4 -falign-functions=4
+ARCH_ppc=$(shell echo "${ARCHFLAGS}" | grep -q -w ppc && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64' && arch | grep -q -w ppc && echo yes)
+ARCH_x86=$(shell echo "${ARCHFLAGS}" | grep -q -w i386 && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64' && arch | grep -q -w i386 && echo yes)
+ARCH_amd64=$(shell echo "${ARCHFLAGS}" | grep -q -w x86_64 && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64' && arch | grep -q -w x86_64 && echo yes)
+OBJ_ppc=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "$@.ppc")
+OBJ_x86=$(shell echo "${ARCH_x86}" | grep -q -w yes && echo "$@.x86")
+OBJ_amd64=$(shell echo "${ARCH_amd64}" | grep -q -w yes && echo "$@.amd64")
+MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib $(ARCHFLAGS)
+
 CFLAGS_ppc=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_ppc) $(KOPTS_DBUG)
 CFLAGS_x86=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_x86) $(KOPTS_DBUG)
-else
-MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib -arch ppc
-KOPTS=$(KOPTS_ppc)
-CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
-endif
-else
-ifeq ($(ARCH_x86),yes)
-MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib -arch i386
-KOPTS=$(KOPTS_x86)
-else
-_ARCH=$(shell arch)
-MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib -arch $(_ARCH)
-KOPTS=$(KOPTS_$(shell echo $(_ARCH) | sed 's/i386/x86/'))
-endif
-CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
-endif
-<all -ppc_darwin_80 -x86_darwin_80 -ppc_darwin_90 -x86_darwin_90>
-MODLD=$(LD)
-CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
-<ppc_darwin_70>
-KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
-<ppc_darwin_60>
-KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
-<ppc_darwin_14 ppc_darwin_13 ppc_darwin_12>
-KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
-<all>
-KINCLUDES=-I${KROOT}/System/Library/Frameworks/Kernel.framework/Headers
-
+CFLAGS_amd64=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_amd64) $(KOPTS_DBUG)
 
+<all>
 # Name of directory to hold object files and libraries.
 KOBJ = MODLOAD
 
@@ -90,26 +70,41 @@ DESTDIRS = single_destdir
 
 include Makefile.common
 
-<ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90>
-ifeq ($(ARCH_ppc),yes)
-ifeq ($(ARCH_x86),yes)
+<ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90 x86_darwin_100>
 # override suffix rule; unfortunately, this causes a warning message
 .c.o:
-       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.ppc.o,$@) -c $<
-       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.x86.o,$@) -c $<
-       lipo -create $(patsubst %.o,%.ppc.o,$@) $(patsubst %.o,%.x86.o,$@) -output $@
-CRULE_NOOPT= \
-       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.ppc.o,$@) -c $? && \
-       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.x86.o,$@) -c $? && \
-       lipo -create $(patsubst %.o,%.ppc.o,$@) $(patsubst %.o,%.x86.o,$@) -output $@
-CRULE_OPT= \
-       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.ppc.o,$@) -c $? && \
-       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.x86.o,$@) -c $? && \
-       lipo -create $(patsubst %.o,%.ppc.o,$@) $(patsubst %.o,%.x86.o,$@) -output $@
+ifeq ($(ARCH_ppc),yes)
+       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $<
 endif
+ifeq ($(ARCH_x86),yes)
+       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $<
 endif
-<all>
+ifeq ($(ARCH_amd64),yes)
+       $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $<
+endif
+       lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} -output $@;
+
+CRULE_NOOPT_ppc=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $?
+CRULE_NOOPT_x86=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $?
+CRULE_NOOPT_amd64=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $?
+CRULE_NOOPT=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "${CRULE_NOOPT_ppc};"; echo "${ARCH_x86}" | grep -q -w yes && echo "${CRULE_NOOPT_x86};"; echo "${ARCH_amd64}" | grep -q -w x86_64 && echo "${CRULE_NOOPT_amd64};"; echo "lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64}-output $@")
+
+CRULE_OPT_ppc=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $? 
+CRULE_OPT_x86=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $? 
+CRULE_OPT_amd64=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $? 
+CRULE_OPT=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "${CRULE_OPT_ppc};"; echo "${ARCH_x86}" | grep -q -w yes && echo "${CRULE_OPT_x86};"; echo "${ARCH_amd64}" | grep -q -w x86_64 && echo "${CRULE_OPT_amd64};"; echo "lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64}-output $@")
 
+<all -ppc_darwin_80 -x86_darwin_80 -ppc_darwin_90 -x86_darwin_90 -x86_darwin_100>
+MODLD=$(LD)
+CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
+<ppc_darwin_70>
+KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
+<ppc_darwin_60>
+KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
+<ppc_darwin_14 ppc_darwin_13 ppc_darwin_12>
+KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
+
+<all>
 setup:
        -mkdir $(KOBJ)
        -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config
@@ -149,12 +144,12 @@ dest_libafs: $(LIBAFSNONFS) ;
 
 ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
        $(MODLD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext
-<ppc_darwin_90 x86_darwin_90>
+<ppc_darwin_90 x86_darwin_90 x86_darwin_100>
        dsymutil -o ${LIBAFS}.dSYM ${LIBAFS}
 <all>
 
 ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
        $(MODLD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext
-<ppc_darwin_90 x86_darwin_90>
+<ppc_darwin_90 x86_darwin_90 x86_darwin_100>
        dsymutil -o ${LIBAFSNONFS}.dSYM ${LIBAFSNONFS}
 <all>
index e733d12..64769d5 100644 (file)
@@ -70,9 +70,11 @@ process.o    : process.s process.i386.s process.c
                ${AS} -ahlns process.ss -o process.o >process.lst; \
                $(RM) process.ss ;; \
        *_darwin* ) \
-               ppc=`echo "${ARCHFLAGS}" | grep -q -w ppc && echo yes` ; \
-               i386=`echo "${ARCHFLAGS}" | grep -q -w i386 && echo yes` ; \
-               if [ -z "$${ppc}" -a -z "$${i386}" ] ; then \
+               $(RM) -f process.o ; \
+               ppc=`echo "${ARCHFLAGS}" | grep -q -w ppc && echo process.ppc.o` ; \
+               i386=`echo "${ARCHFLAGS}" | grep -q -w i386 && echo process.i386.o` ; \
+               amd64=`echo "${ARCHFLAGS}" | grep -q -w x86_64 && echo process.amd64.o` ; \
+               if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" ] ; then \
                        if [ `arch` = ppc ] ; then \
                                ppc=yes ; \
                        else \
@@ -80,19 +82,25 @@ process.o   : process.s process.i386.s process.c
                        fi ; \
                fi ; \
                if [ -n "$${ppc}" ] ; then \
-                       $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch ppc -I${TOP_INCDIR} ${srcdir}/process.s -o process.ppc.o ; \
-                       if [ -z "$${i386}" ] ; then \
-                               ${MV} process.ppc.o process.o ; \
+                       $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch ppc -I${TOP_INCDIR} ${srcdir}/process.s -o "$${ppc}" ; \
+                       if [ -z "$${i386}" -a -z "$${amd64}" ] ; then \
+                               ${MV} "$${ppc}" process.o ; \
                        fi ; \
                fi ; \
                if [ -n "$${i386}" ] ; then \
-                       $(CC) -x assembler-with-cpp -c -arch i386 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s -o process.i386.o ; \
-                       if [ -z "$${ppc}" ] ; then \
-                               ${MV} process.i386.o process.o ; \
+                       $(CC) -x assembler-with-cpp -c -arch i386 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s -o "$${i386}" ; \
+                       if [ -z "$${ppc}" -a -z "$${amd64}" ] ; then \
+                               ${MV} "$${i386}" process.o ; \
                        fi ; \
                fi ; \
-               if [ -n "$${ppc}" -a -n "$${i386}" ] ; then \
-                       lipo -create process.ppc.o process.i386.o -output process.o ;\
+               if [ -n "$${amd64}" ] ; then \
+                       $(CC) -x assembler-with-cpp -c -arch x86_64 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.amd64.s -o "$${amd64}" ; \
+                       if [ -z "$${ppc}" -a -z "$${i386}" ] ; then \
+                               ${MV} "$${amd64}" process.o ; \
+                       fi ; \
+               fi ; \
+               if [ ! -f process.o ] ; then \
+                       lipo -create $${amd64} $${i386} $${ppc} -output process.o ;\
                fi ;; \
        i386_*bsd*) \
                cp ${srcdir}/process.i386.s process.S ; \
index 48dd25f..4b1ef96 100644 (file)
@@ -83,7 +83,7 @@ ENTRY(savecontext)
        movq    %rsi, area1(%rbp)       /* i multiples of 24, so 32 it is) */
        movq    %rdx, newsp(%rbp)       /* and copy them there. */
 
-       movq    PRE_Block@GOTPCREL(%rip), %rax
+       movq    _C_LABEL(PRE_Block)@GOTPCREL(%rip), %rax
        movl    $1,(%rax)               /* Do not allow any interrupts */
 
        pushq   %rsp                    /* Push all registers onto the stack */
@@ -149,7 +149,7 @@ ENTRY(returnto)
        popq    %rax
        popq    %rsp                    /* See savecontext */
 
-       movq    PRE_Block@GOTPCREL(%rip), %rax
+       movq    _C_LABEL(PRE_Block)@GOTPCREL(%rip), %rax
        movl    $0,(%rax)       
        addq    $32, %rsp               /* We did rsp-32 above, correct that */
        popq    %rbp
index 7725bc6..8b9d6ae 100644 (file)
@@ -175,8 +175,8 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,
     /* enhanced: use "ignore_uid <number>" to specify the largest uid
      * which should be ignored by this module
      */
-#if    defined(AFS_HPUX_ENV)
-#if     defined(AFS_HPUX110_ENV)
+#if    defined(AFS_HPUX_ENV) || defined(AFS_DARWIN100_ENV)
+#if     defined(AFS_HPUX110_ENV) || defined(AFS_DARWIN100_ENV)
     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
 #else /* AFS_HPUX110_ENV */
     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
index 81e59d9..a6a67da 100644 (file)
@@ -119,8 +119,8 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv)
      * and its uid==0, and "ignore_root" was given in pam.conf,
      * ignore the user.
      */
-#if    defined(AFS_HPUX_ENV)
-#if     defined(AFS_HPUX110_ENV)
+#if    defined(AFS_HPUX_ENV) || defined(AFS_DARWIN100_ENV)
+#if     defined(AFS_HPUX110_ENV) || defined(AFS_DARWIN100_ENV)
     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
 #else /* AFS_HPUX110_ENV */
     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
index 3a2f39f..52e0310 100644 (file)
@@ -155,8 +155,8 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
     /* enhanced: use "ignore_uid <number>" to specify the largest uid
      * which should be ignored by this module
      */
-#if    defined(AFS_HPUX_ENV)
-#if     defined(AFS_HPUX110_ENV)
+#if    defined(AFS_HPUX_ENV) || defined(AFS_DARWIN100_ENV)
+#if     defined(AFS_HPUX110_ENV) || defined(AFS_DARWIN100_ENV)
     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
 #else /* AFS_HPUX110_ENV */
     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
index 10c71c1..a55177a 100644 (file)
@@ -38,7 +38,6 @@ LIBS=${TOP_LIBDIR}/libubik.a \
        ${TOP_LIBDIR}/libdes.a \
        ${TOP_LIBDIR}/libcmd.a \
        ${TOP_LIBDIR}/libcom_err.a \
-       ${TOP_LIBDIR}/util.a \
        ${TOP_LIBDIR}/libsys.a \
        ${TOP_LIBDIR}/libafsutil.a
 
index e297303..6fc153e 100644 (file)
@@ -55,7 +55,9 @@ extern boolean_t lck_rw_try_lock(lck_rw_t *lck, lck_rw_type_t lck_rw_type);
                                if (isGlockOwner) AFS_GUNLOCK();  \
                                osi_Assert((lck)->owner == current_thread()); \
                                (lck)->owner = (thread_t)0; \
-                               OSAtomicDecrement32Barrier((lck)->waiters); \
+                               lck_mtx_lock((lck)->meta);  \
+                                (lck)->waiters--; \
+                                lck_mtx_unlock((lck)->meta); \
                                 msleep(cv, (lck)->lock, PDROP|PVFS, "afs_CV_WAIT", NULL); \
                                if (isGlockOwner) AFS_GLOCK();  \
                                MUTEX_ENTER(lck); \
@@ -69,7 +71,9 @@ extern boolean_t lck_rw_try_lock(lck_rw_t *lck, lck_rw_type_t lck_rw_type);
                                if (isGlockOwner) AFS_GUNLOCK();  \
                                osi_Assert((lck)->owner == current_thread()); \
                                (lck)->owner = (thread_t)0; \
-                               OSAtomicDecrement32Barrier((lck)->waiters); \
+                               lck_mtx_lock((lck)->meta); \
+                                (lck)->waiters--; \
+                                lck_mtx_unlock((lck)->meta); \
                                 msleep(cv, (lck)->lock, PDROP|PVFS, "afs_CV_TIMEDWAIT", &ts); \
                                if (isGlockOwner) AFS_GLOCK();  \
                                MUTEX_ENTER(lck);       \
@@ -123,88 +127,14 @@ extern boolean_t lck_rw_try_lock(lck_rw_t *lck, lck_rw_type_t lck_rw_type);
 
 #ifdef AFS_DARWIN80_ENV
 typedef struct {
+    lck_mtx_t *meta;
     int waiters; /* also includes anyone holding the lock */
     lck_mtx_t *lock;
     thread_t owner;
 } afs_kmutex_t;
 typedef int afs_kcondvar_t;
 
-typedef struct {
-    int readers;
-    lck_mtx_t *lock;
-    thread_t owner;
-} afs_krwlock_t;
-
 extern lck_grp_t * openafs_lck_grp;
-extern lck_grp_t * openafs_rw_grp;
-
-#define RWLOCK_UPLOCK(a) \
-    do { \
-       osi_Assert((a)->owner != current_thread());     \
-       lck_rw_lock_shared_to_exclusive((a)->lock); \
-       osi_Assert((a)->owner == (thread_t)0); \
-       (a)->owner = current_thread(); \
-       OSAtomicDecrement32Barrier((a)->readers);               \
-    } while(0)
-
-#define RWLOCK_INIT(a,b,c,d) \
-    do {                                                     \
-        lck_attr_t *openafs_lck_attr = lck_attr_alloc_init();          \
-        (a)->lock = lck_rw_alloc_init(openafs_rw_grp, openafs_lck_attr); \
-        lck_attr_free(openafs_lck_attr);                               \
-       (a)->readers = 0;                                               \
-       (a)->owner = (thread_t)0;                                       \
-    } while(0)
-#define RWLOCK_DESTROY(a) \
-    do {                                          \
-        lck_rw_destroy((a)->lock, openafs_rw_grp); \
-       (a)->owner = (thread_t)-1;                 \
-    } while(0)
-#define RWLOCK_RDLOCK(a)                               \
-    do {                                               \
-        OSAtomicIncrement32Barrier((a)->readers);      \
-       lck_rw_lock_shared((a)->lock);                  \
-    } while(0)
-#define RWLOCK_WRLOCK(a) \
-    do {                                               \
-       osi_Assert((a)->owner != current_thread());     \
-       lck_rw_lock_exclusive((a)->lock);               \
-       osi_Assert((a)->owner == (thread_t)0);          \
-       (a)->owner = current_thread();                  \
-    } while(0)
-
-/* acquire main lock before releasing meta lock, so we don't race */
-#define RWLOCK_TRYRDLOCK(a) ({ \
-           int _ret;                                                   \
-           _ret = lck_rw_try_lock((a)->lock, LCK_RW_TYPE_SHARED);      \
-           if (_ret) {                                                 \
-               OSAtomicIncrement32Barrier((a)->readers);               \
-           }                                                           \
-           _ret;                                                       \
-       })
-
-/* acquire main lock before releasing meta lock, so we don't race */
-#define RWLOCK_TRYWRLOCK(a) ({ \
-           int _ret;                           \
-           osi_Assert((a)->owner != current_thread());                 \
-           _ret = lck_rw_try_lock((a)->lock, LCK_RW_TYPE_EXCLUSIVE);           \
-           if (_ret) {                                 \
-               osi_Assert((a)->owner == (thread_t)0);  \
-               (a)->owner = current_thread();                  \
-           }                                                   \
-           _ret;                                               \
-       })
-
-#define RWLOCK_UNLOCK(a) \
-    do {                                           \
-       if ((a)->owner == current_thread()) {       \
-           (a)->owner = (thread_t)0;                   \
-           lck_rw_unlock_exclusive((a)->lock);         \
-       } else {                                        \
-           lck_rw_unlock_shared((a)->lock);            \
-           OSAtomicDecrement32Barrier((a)->readers);   \
-       }                                               \
-    } while(0)
 
 #define MUTEX_SETUP() rx_kmutex_setup()
 #define MUTEX_FINISH() rx_kmutex_finish()
@@ -217,6 +147,7 @@ extern lck_grp_t * openafs_rw_grp;
 #define MUTEX_INIT(a,b,c,d) \
     do {                                                               \
         lck_attr_t *openafs_lck_attr = lck_attr_alloc_init();          \
+       (a)->meta = lck_mtx_alloc_init(openafs_lck_grp, openafs_lck_attr); \
         (a)->lock = lck_mtx_alloc_init(openafs_lck_grp, openafs_lck_attr); \
         lck_attr_free(openafs_lck_attr);                               \
        (a)->waiters = 0;                                               \
@@ -224,35 +155,46 @@ extern lck_grp_t * openafs_rw_grp;
     } while(0)
 #define MUTEX_DESTROY(a) \
     do { \
-        lck_mtx_destroy((a)->lock, openafs_lck_grp);   \
-       (a)->owner = (thread_t)-1;                      \
+        lck_mtx_destroy((a)->lock, openafs_lck_grp); \
+       lck_mtx_destroy((a)->meta, openafs_lck_grp); \
+       (a)->owner = (thread_t)-1; \
     } while(0)
-#define MUTEX_ENTER(a)                         \
-    do {                                               \
-       OSAtomicIncrement32Barrier((a)->waiters);       \
-       lck_mtx_lock((a)->lock);                        \
-       osi_Assert((a)->owner == (thread_t)0);          \
-       (a)->owner = current_thread();                  \
+#define MUTEX_ENTER(a) \
+    do { \
+       lck_mtx_lock((a)->meta); \
+        (a)->waiters++; \
+        lck_mtx_unlock((a)->meta); \
+       lck_mtx_lock((a)->lock); \
+       osi_Assert((a)->owner == (thread_t)0); \
+       (a)->owner = current_thread(); \
     } while(0)
 
 /* acquire main lock before releasing meta lock, so we don't race */
 #define MUTEX_TRYENTER(a) ({                   \
            int _ret;                           \
-           _ret = lck_mtx_try_lock((a)->lock); \
-           if (_ret) {                                 \
-               OSAtomicIncrement32Barrier((a)->waiters);       \
-               osi_Assert((a)->owner == (thread_t)0);          \
-               (a)->owner = current_thread();                  \
-           }                                                   \
-           _ret;                                               \
+           lck_mtx_lock((a)->meta); \
+           if ((a)->waiters) { \
+               lck_mtx_unlock((a)->meta); \
+               _ret = 0; \
+           } else { \
+               (a)->waiters++; \
+               lck_mtx_lock((a)->lock); \
+               lck_mtx_unlock((a)->meta); \
+               osi_Assert((a)->owner == (thread_t)0); \
+               (a)->owner = current_thread(); \
+               _ret = 1; \
+           } \
+           _ret; \
        })
 
-#define MUTEX_EXIT(a)                          \
-    do {                                           \
+#define MUTEX_EXIT(a) \
+    do { \
        osi_Assert((a)->owner == current_thread()); \
-       (a)->owner = (thread_t)0;                   \
-       lck_mtx_unlock((a)->lock);                  \
-       OSAtomicDecrement32Barrier((a)->waiters);   \
+       (a)->owner = (thread_t)0; \
+       lck_mtx_unlock((a)->lock); \
+       lck_mtx_lock((a)->meta); \
+        (a)->waiters--; \
+        lck_mtx_unlock((a)->meta); \
     } while(0)
 
 #undef MUTEX_ISMINE
index a138818..bfb01b5 100644 (file)
@@ -26,7 +26,9 @@
 #if defined(AFS_DUX40_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV)
 #include <sys/ioctl.h>
 #endif
+#ifndef AFS_DARWIN100_ENV
 #include <sys/mtio.h>
+#endif
 #endif /* AFS_AIX_ENV */
 
 #include <string.h>
@@ -209,6 +211,9 @@ usd_FileIoctl(usd_handle_t usd, int req, void *arg)
 
     case USD_IOCTL_TAPEOPERATION:
        {
+#ifdef AFS_DARWIN100_ENV
+           code = EOPNOTSUPP;
+#else
            usd_tapeop_t *tapeOpp = (usd_tapeop_t *) arg;
 #if defined(AFS_AIX_ENV)
            struct stop os_tapeop;
@@ -255,7 +260,7 @@ usd_FileIoctl(usd_handle_t usd, int req, void *arg)
 
            code = ioctl(fd, MTIOCTOP, &os_tapeop);
 #endif /* AFS_AIX_ENV */
-
+#endif
            if (code == -1) {
                code = errno;
            } else {
index e41b3bf..3ab164c 100644 (file)
@@ -14,6 +14,7 @@
 #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
 #define AFS_GRMUTEX_DECLSPEC __declspec(dllexport)
 #endif
+#ifdef AFS_PTHREAD_ENV
 #include <afs/pthread_glock.h>
 #include <string.h>
 
@@ -83,3 +84,4 @@ pthread_recursive_mutex_unlock(pthread_recursive_mutex_t * mut)
     }
     return rc;
 }
+#endif