From addf1509244f28f1a9f90fbff3e99b9d0e544982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 2 Oct 2005 03:17:06 +0000 Subject: [PATCH] Mac OS X 10.4 needs a runtime check if we are going to use the syscall, there is no cpp define to use to check the version. Every after 10.0 (darwin 8.0) uses the /dev/ version of the pioctl. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16117 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/kafs/afssys.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/kafs/afssys.c b/lib/kafs/afssys.c index 151d4eabf..9b1e85a98 100644 --- a/lib/kafs/afssys.c +++ b/lib/kafs/afssys.c @@ -410,6 +410,38 @@ k_hasafs(void) goto done; } +#ifdef __APPLE__ + /* + * Darwin needs runtime check if we want to use the syscall + */ + do { + int version; + int mib[2]; + size_t len; + char *kernelVersion; + + mib[0] = CTL_KERN; + mib[1] = KERN_OSRELEASE; + + if (sysctl(mib, 2, NULL, &len, NULL, 0)) + break; + kernelVersion = malloc(len); + if (kernelVersion == NULL) + break; + if (sysctl(mib, 2, kernelVersion, &len, NULL, 0)) { + free(kernelVersion); + break; + } + + version = atoi(kernelVersion); + free(kernelVersion); + if (version >= 8) + goto skip_syscall; + + } while(0); +#endif + + #if defined(AFS_SYSCALL) || defined(AFS_SYSCALL2) || defined(AFS_SYSCALL3) { int tmp; @@ -491,6 +523,10 @@ k_hasafs(void) goto done; #endif +#ifdef __APPLE__ + skip_syscall: +#endif + if (try_ioctlpath("/proc/fs/openafs/afs_ioctl", LINUX_PROC_POINT) == 0) goto done; if (try_ioctlpath("/proc/fs/nnpfs/afs_ioctl", LINUX_PROC_POINT) == 0)