site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Hi Terry, Is that right? The command value appears to be 32 bit regardless of architecture. We use an ioctl in our code and don't use different command values and it appears to work. (We obviously take care of the parameters.) Or am I misunderstanding what you're saying? You're misunderstanding. Here is how commands are assembled: -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On Jun 16, 2010, at 4:34 PM, Chris Suter wrote: On Thu, Jun 17, 2010 at 8:15 AM, Terry Lambert <tlambert@apple.com> wrote: For example, if you needed to pass a pointer, you would declare the field as a uint64_t (unsigned long long), cat the pointer to a uintptr_t, and then Or user_addr_t and CAST_USER_ADDR_T perhaps? That's not a user space visible type or cast macro. You'd treat it like that in the kernel, however. PS: This goes for things like ioctl(2) parameters, as well; if they are size variant, you will find yourself implementing separate 32 and 64 bit versions of the ioctl(2) command value in the kernel so that you can deal with both 32 and 64 bit clients; otherwise, the ioctl(2) case statement number will not match, and it will look like it's an unrecognized ioctl(2) when you call it from a binary of the "wrong" bitness. #define IOCPARM_MAX (IOCPARM_MASK + 1) /* max size of ioctl args */ ... #define IOC_OUT (unsigned long)0x40000000 ... #define _IOC(inout,group,num,len) \ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) ... #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) ... #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ So the size of the structure is a component of the manifest constant used to make the ioctl. If the structure size is variant because an element in the structure is variant, then the command code is variant. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert