From drurowin at gmail.com Wed Mar 25 18:26:31 2015 From: drurowin at gmail.com (Lucien Pullen) Date: Wed, 25 Mar 2015 12:26:31 -0600 Subject: 64-bit stat and statfs on Mac Message-ID: Greetings list. I'm running into a bit of a conundrum. I'm calling into stat(2) and statfs(2) on Mac operating systems and get back the old 32-bit structure instead of the new 64-bit structure. If I compile a test program in C I get the 64-bit structure with just included. When I use DEFCFUN I get the 32-bit structure. Same for . I'm working around it currently using #+, but I'd like some help understanding what's going on so I can do a proper implementation. I read in the include files and man pages that the *64 functions are temporary things while old code gets updated and that users should never actually call them. In the include file they are different functions (see below for statfs), but there is some preprocessor magic happening. There's a pair of defines _DARWIN_USE_64_BIT_INODE and _DARWIN_NO_64_BIT_INODE that you can set before doing the include to set the default behavior, but CFFI doesn't do grovelling for function definitions. --8<---------------cut here---------------start------------->8--- int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs); #if !__DARWIN_ONLY_64_BIT_INO_T int statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ --8<---------------cut here---------------end--------------->8--- It just caused me a bunch of confusion because I was getting junk out of CONVERT-FROM-FOREIGN with :INODE64 in *FEATURES*, so now that I've gotten it to work I'm curious. From sionescu at cddr.org Wed Mar 25 19:27:57 2015 From: sionescu at cddr.org (Stelian Ionescu) Date: Wed, 25 Mar 2015 19:27:57 +0000 Subject: 64-bit stat and statfs on Mac In-Reply-To: References: Message-ID: <1427311677.398967.245220609.4B19D657@webmail.messagingengine.com> > Greetings list. > > I'm running into a bit of a conundrum. I'm calling into stat(2) and > statfs(2) on Mac operating systems and get back the old 32-bit structure > instead of the new 64-bit structure. > > If I compile a test program in C I get the 64-bit structure with just > included. When I use DEFCFUN I get the 32-bit structure. > Same for . I'm working around it currently using #+, but > I'd like some help understanding what's going on so I can do a proper > implementation. > > I read in the include files and man pages that the *64 functions are > temporary things while old code gets updated and that users should never > actually call them. In the include file they are different functions > (see below for statfs), but there is some preprocessor magic happening. > There's a pair of defines _DARWIN_USE_64_BIT_INODE and > _DARWIN_NO_64_BIT_INODE that you can set before doing the include to set > the default behavior, but CFFI doesn't do grovelling for function > definitions. Hello Lucien, This(and others) is one of then reasons why I wrote libfixposix, so I'd advise you to use IOlib. -- Stelian Ionescu a.k.a. fe[nl]ix Quidquid latine dictum sit, altum videtur. http://common-lisp.net/project/iolib