Why 'linux/fs.h' cannot be included? I *can*...
Hi Jeff :)
Quoted 6 lines
Quoted 5 lines
Given the number of user-space apps that needs ioctl definitions
and things like those (that are supposed not to change easily), those definitions should go in user-includable headers... IMHO.Fortunately, we have some of them in libc headers now.
The policy is, never ever include kernel headers from userspace.
I know, but sometimes it is just impossible (when they aren't
appropriate glibc headers, for example). In fact, all this question arose because I'm coding an 'ioctl' command line interface, so you can send any 'documented' ioctl to any device. And, since I'm going to start with block devices, I need linux/fs.h.
The problem is that I don't want to copy the definitions I need
from linux/fs.h, because this will lead to problems if those definitions change. Anyway this is not an issue, because by changing the running kernel those definitions in fact may not be valid...
Resuming: I don't know how properly address this problem.
Quoted 2 lines
Your libc should provide a "sanitized" version of the kernel headers, which is completely separate from any kernel sources.
I suppose that those headers will contain definitions not subject
to change, won't they? But I don't know if I can consider the ioctl constants as not subject to change (they should be permanent, though).
Quoted 1 line
So, any problems should be reported to your libc maintainer :)
Well, I try... I can even try to make the sanitized header myself
and pray for it to be included in next glibc revision :)
Thanks :)
Ra�l
Quoted 15 lines · DervishD
Hi Jeff :)
Quoted 6 lines
Quoted 5 lines
Given the number of user-space apps that needs ioctl definitions
and things like those (that are supposed not to change easily), those definitions should go in user-includable headers... IMHO.Fortunately, we have some of them in libc headers now.
The policy is, never ever include kernel headers from userspace.
I know, but sometimes it is just impossible (when they aren't
appropriate glibc headers, for example). In fact, all this question arose because I'm coding an 'ioctl' command line interface, so you can send any 'documented' ioctl to any device. And, since I'm going to start with block devices, I needlinux/fs.h.
Quoted 6 lines
The problem is that I don't want to copy the definitions I need
fromlinux/fs.h, because this will lead to problems if those definitions change. Anyway this is not an issue, because by changing the running kernel those definitions in fact may not be valid...Resuming: I don't know how properly address this problem.
In general you are running into the ioctls are messy problem, and probably need to be cleaned up. Beyond that though ioctls should be static they are part of the kernel ABI. Though they aren't managed tight enough that you can count on them being 100% static.
Quoted 7 lines
Quoted 2 lines
Your libc should provide a "sanitized" version of the kernel headers, which is completely separate from any kernel sources.
I suppose that those headers will contain definitions not subject
to change, won't they? But I don't know if I can consider the ioctl constants as not subject to change (they should be permanent, though).
In general ioctls are not be subject to change.
Quoted 4 lines
Quoted 1 line
So, any problems should be reported to your libc maintainer :)
Well, I try... I can even try to make the sanitized header myself
and pray for it to be included in next glibc revision :)
Not that would be progress..
Eric
Quoted 6 lines · DervishD
The problem is that I don't want to copy the definitions I need
fromlinux/fs.h, because this will lead to problems if those definitions change. Anyway this is not an issue, because by changing the running kernel those definitions in fact may not be valid...Resuming: I don't know how properly address this problem.
Go ahead and copy. If ioctl interfaces change, then binary compatibility just changed too. By nature that will be changed infrequently, if at all.
Jeff