From: Derrick Brashear Date: Wed, 15 Jul 2009 18:57:56 +0000 (-0400) Subject: MacOS 10.6 support update X-Git-Tag: openafs-devel-1_5_61~99 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1d1ae6195bd03c4348a57914cf892e06b507d855;p=packages%2Fo%2Fopenafs.git MacOS 10.6 support update 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 Reviewed-by: Russ Allbery Reviewed-by: Derrick Brashear --- diff --git a/acinclude.m4 b/acinclude.m4 index 21e626ac0..0c2d8eeeb 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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" diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index 08098373b..40afb630c 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -161,12 +161,13 @@ void set_staticaddrs(void); #include #endif #include +#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 #include #include @@ -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; } diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 1b45bd891..a5fbbbe2b 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -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" diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 9b6cc6c5e..3f7824e56 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -62,6 +62,10 @@ #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 diff --git a/src/config/param.x86_darwin_100.h b/src/config/param.x86_darwin_100.h index 49cdd44ba..de9390139 100644 --- a/src/config/param.x86_darwin_100.h +++ b/src/config/param.x86_darwin_100.h @@ -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 @@ -49,7 +49,20 @@ #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 @@ -61,6 +74,19 @@ #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 @@ -111,7 +137,7 @@ #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 @@ -158,6 +184,18 @@ #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 diff --git a/src/des/conf-darwin.h b/src/des/conf-darwin.h index 2bf8e1f98..f686e4660 100644 --- a/src/des/conf-darwin.h +++ b/src/des/conf-darwin.h @@ -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" diff --git a/src/des/make_p.c b/src/des/make_p.c index c4dd119ef..1e61e483a 100644 --- a/src/des/make_p.c +++ b/src/des/make_p.c @@ -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"); diff --git a/src/des/misc.c b/src/des/misc.c index 6a16de3cd..7d0e129c0 100644 --- a/src/des/misc.c +++ b/src/des/misc.c @@ -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; diff --git a/src/gtx/curseswindows.c b/src/gtx/curseswindows.c index 04019357e..7dc59b8a2 100644 --- a/src/gtx/curseswindows.c +++ b/src/gtx/curseswindows.c @@ -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 diff --git a/src/libafs/MakefileProto.DARWIN.in b/src/libafs/MakefileProto.DARWIN.in index 3e926ffe6..84e74f867 100644 --- a/src/libafs/MakefileProto.DARWIN.in +++ b/src/libafs/MakefileProto.DARWIN.in @@ -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 + KOPTS_DBUG=-g - + KOPTS_DBUG=-ggdb - + 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 - -MODLD=$(LD) -CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS) - -KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch - -KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch - -KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch - -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) + # Name of directory to hold object files and libraries. KOBJ = MODLOAD @@ -90,26 +70,41 @@ DESTDIRS = single_destdir include Makefile.common - -ifeq ($(ARCH_ppc),yes) -ifeq ($(ARCH_x86),yes) + # 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 - +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 $@") + +MODLD=$(LD) +CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS) + +KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch + +KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch + +KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch + + 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 - + dsymutil -o ${LIBAFS}.dSYM ${LIBAFS} ${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS) $(MODLD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext - + dsymutil -o ${LIBAFSNONFS}.dSYM ${LIBAFSNONFS} diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index e733d12ee..64769d58b 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -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 ; \ diff --git a/src/lwp/process.amd64.s b/src/lwp/process.amd64.s index 48dd25fd0..4b1ef9643 100644 --- a/src/lwp/process.amd64.s +++ b/src/lwp/process.amd64.s @@ -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 diff --git a/src/pam/afs_auth.c b/src/pam/afs_auth.c index 7725bc6e9..8b9d6ae46 100644 --- a/src/pam/afs_auth.c +++ b/src/pam/afs_auth.c @@ -175,8 +175,8 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, /* enhanced: use "ignore_uid " 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)); diff --git a/src/pam/afs_password.c b/src/pam/afs_password.c index 81e59d957..a6a67da2f 100644 --- a/src/pam/afs_password.c +++ b/src/pam/afs_password.c @@ -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)); diff --git a/src/pam/afs_setcred.c b/src/pam/afs_setcred.c index 3a2f39fc0..52e031052 100644 --- a/src/pam/afs_setcred.c +++ b/src/pam/afs_setcred.c @@ -155,8 +155,8 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv) /* enhanced: use "ignore_uid " 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)); diff --git a/src/ptserver/Makefile.in b/src/ptserver/Makefile.in index 10c71c1d4..a55177a6e 100644 --- a/src/ptserver/Makefile.in +++ b/src/ptserver/Makefile.in @@ -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 diff --git a/src/rx/DARWIN/rx_kmutex.h b/src/rx/DARWIN/rx_kmutex.h index e29730394..6fc153ed5 100644 --- a/src/rx/DARWIN/rx_kmutex.h +++ b/src/rx/DARWIN/rx_kmutex.h @@ -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 diff --git a/src/usd/usd_file.c b/src/usd/usd_file.c index a13881864..bfb01b599 100644 --- a/src/usd/usd_file.c +++ b/src/usd/usd_file.c @@ -26,7 +26,9 @@ #if defined(AFS_DUX40_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV) #include #endif +#ifndef AFS_DARWIN100_ENV #include +#endif #endif /* AFS_AIX_ENV */ #include @@ -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 { diff --git a/src/util/pthread_glock.c b/src/util/pthread_glock.c index e41b3bfc8..3ab164c6c 100644 --- a/src/util/pthread_glock.c +++ b/src/util/pthread_glock.c @@ -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 #include @@ -83,3 +84,4 @@ pthread_recursive_mutex_unlock(pthread_recursive_mutex_t * mut) } return rc; } +#endif