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
This commit is contained in:
Love Hörnquist Åstrand
2005-10-02 03:17:06 +00:00
parent 9cfdb7f017
commit addf150924

View File

@@ -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)