ltp getdents syscalls testcases and 2.6.27-rcX
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1222260480.5395.17.camel-NRFfyExJdYpgXGGE5LP+UZlqa2bBAFbm0E9HWUfgJXw@public.gmane.org
Quoted 38 lines · On Wednesday 24 September 2008 14:48:00 Subrata Modak wrote:
Quoted 30 lines · Daniel Gollub
Hi,
with 2.6.27-rc1(?)
linux/dirent.hgot removedKbuildheaders_installtarge and dirent struct got removed:commit
cf6ae8b50e0ee3f764392dadd1970e3f03c40773
Author: Adrian Bunk <[email protected]>
Date: Fri Jul 25 01:46:46 2008 -0700remove the in-kernel struct dirent{,64}
The kernel struct dirent{,64} were different from the ones in userspace.
Even worse, we exported the kernel ones to userspace.
But after the fat usages are fixed we can remove the conflicting kernel versions.This broke the build of some LTP syscalls testcases for "getdents", since the <
linux/dirent.h> include is missing and the "internal" dirent struct get/got used in:
testcases/kernel/syscalls/getdents/getdents01.ctestcases/kernel/syscalls/getdents/getdents03.ctestcases/kernel/syscalls/getdents/getdents02.ctestcases/kernel/syscalls/getdents/getdents04.cQuoted 6 lines
http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/getdents
/Is it safe to use the userspace dirent struct from <
dirent.h> to fix the build of this? Or what should be used for testing the getdents interface instead?
Quoted 7 lines
Yes, it is. There are numerous test cases in LTP which use:
struct dirent,
by including/usr/include/dirent.h. The interesting part is, this guy (/usr/include/dirent.h) in turn includes/usr/include/bits/dirent.h, where the definition of struct resides. Following is the patch which solves this issue along withpage.hheader file removal from 2.6.25 onwards, reported by Garret earlier.
Tried the patch - ltp build with 2.6.27-rc linux headers sucessfully. Thanks for the info and the patch!
Btw. man pages need to get also updated ... there are some pages which still mention <linux/dirent.h>.
Garret, with 2.6.25 <asm/page.h> got removed - right? If so swapon(2) man page needs also get fixed:
dgollub@marvin:~/projects/man-pages> grep -r "asm\/page.h" *
man2/swapon.2:.B #include <asm/page.h> /* to find PAGE_SIZE */
best regards,
Daniel
---
man2/getdents.2 +1 -1
@@ -30,8 +30,8 @@ getdents \- get directory entries .SH SYNOPSIS .nf .B #include <unistd.h> +.B #include <dirent.h> .B #include <linux/types.h> -.B #include <linux/dirent.h> .B #include <linux/unistd.h> .B #include <errno.h>
man2/readdir.2 +1 -1
@@ -30,8 +30,8 @@ readdir \- read directory entry .SH SYNOPSIS .nf +.B #include <dirent.h> .B #include <linux/types.h> -.B #include <linux/dirent.h> .sp .BI "int readdir(unsigned int " fd ", struct dirent *" dirp "," .BI " unsigned int " count );
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 83 lines · Daniel Gollub
Quoted 38 lines · On Wednesday 24 September 2008 14:48:00 Subrata Modak wrote:
Quoted 30 lines · Daniel Gollub
Hi,
with 2.6.27-rc1(?)
linux/dirent.hgot removedKbuildheaders_installtarge and dirent struct got removed:commit
cf6ae8b50e0ee3f764392dadd1970e3f03c40773Author: Adrian Bunk <[email protected]> Date: Fri Jul 25 01:46:46 2008 -0700remove the in-kernel struct dirent{,64}
The kernel struct dirent{,64} were different from the ones in userspace.
Even worse, we exported the kernel ones to userspace.
But after the fat usages are fixed we can remove the conflicting kernel versions.
This broke the build of some LTP syscalls testcases for "getdents", since the <
linux/dirent.h> include is missing and the "internal" dirent struct get/got used in:
testcases/kernel/syscalls/getdents/getdents01.ctestcases/kernel/syscalls/getdents/getdents03.ctestcases/kernel/syscalls/getdents/getdents02.ctestcases/kernel/syscalls/getdents/getdents04.cQuoted 6 lines
http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/getdents
/Is it safe to use the userspace dirent struct from <
dirent.h> to fix the build of this? Or what should be used for testing the getdents interface instead?Quoted 7 lines
Yes, it is. There are numerous test cases in LTP which use:
struct dirent,
by including/usr/include/dirent.h. The interesting part is, this guy (/usr/include/dirent.h) in turn includes/usr/include/bits/dirent.h, where the definition of struct resides. Following is the patch which solves this issue along withpage.hheader file removal from 2.6.25 onwards, reported by Garret earlier.Tried the patch - ltp build with 2.6.27-rc linux headers sucessfully. Thanks for the info and the patch!
Btw. man pages need to get also updated ... there are some pages which still mention <
linux/dirent.h>.Garret, with 2.6.25 <
asm/page.h> got removed - right? If so swapon(2) man page needs also get fixed:dgollub@marvin:~/projects/man-pages> grep -r "asm\/page.h" *
man2/swapon.2:.B #include <asm/page.h> /* to findPAGE_SIZE*/best regards,
Daniel---
man2/getdents.2 +1
-1@@ -30,8 +30,8 @@ getdents \- get directory entries .SH SYNOPSIS .nf .B #include <unistd.h> +.B #include <dirent.h> .B #include <linux/types.h> -.B #include <linux/dirent.h> .B #include <linux/unistd.h> .B #include <errno.h>man2/readdir.2 +0
-0
man2/readdir.2 line 37
Quoted 9 lines
man2/readdir.2 +1
-1@@ -30,8 +30,8 @@ readdir \- read directory entry .SH SYNOPSIS .nf +.B #include <dirent.h> .B #include <linux/types.h> -.B #include <linux/dirent.h> .sp .BI "int readdir(unsigned int " fd ", struct dirent *" dirp "," .BI " unsigned int " count );
I find it interesting because I honestly don't remember mentioning this :D..
Would you perhaps mean linux/signalfd.h vs sys/signalfd.h?
-Garrett
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 364299f40809250108x714a5ba7ob31fb89b0d7c195c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 7 lines · On Thursday 25 September 2008 10:08:28 Garrett Cooper wrote:
Quoted 7 lines
Quoted 7 lines
Yes, it is. There are numerous test cases in LTP which use:
struct dirent,
by including/usr/include/dirent.h. The interesting part is, this guy (/usr/include/dirent.h) in turn includes/usr/include/bits/dirent.h, where the definition of struct resides. Following is the patch which solves this issue along withpage.hheader file removal from 2.6.25 onwards, reported by Garret earlier.
^^^^^^^^^
Quoted 18 lines
Quoted 18 lines
Tried the patch - ltp build with 2.6.27-rc linux headers sucessfully. Thanks for the info and the patch!
Btw. man pages need to get also updated ... there are some pages which still mention <
linux/dirent.h>.Garret, with 2.6.25 <
asm/page.h> got removed - right? If so swapon(2) man page needs also get fixed:dgollub@marvin:~/projects/man-pages> grep -r "asm\/page.h" * man2/swapon.2:.B #include <
asm/page.h> /* to findPAGE_SIZE*/best regards,
Daniel---
[...]
Quoted 4 lines
I find it interesting because I honestly don't remember mentioning this :D..
Would you perhaps mean
linux/signalfd.hvssys/signalfd.h?
I don't know either - i was just refering to Subrata's reply... Anyway, asm/page.h is really gone:
commit ed7b1889da256977574663689b598d88950bbd23
Author: Kirill A. Shutemov <[email protected]> Date: Thu Feb 7 00:15:56 2008 -0800
Unexport asm/page.h
Do not export asm/page.h during make headers_install. This removesPAGE_SIZE
from userspace headers.
Garret, just to refresh your memory ..... ;)
http://article.gmane.org/gmane.linux.ltp/4873
best regards,
Daniel
---
man2/swapon.2 +0 -2
@@ -40,8 +40,6 @@ swapon, swapoff \- start/stop swapping to file/device .SH SYNOPSIS .B #include <unistd.h> .br -.B #include <asm/page.h> /* to find PAGE_SIZE */ -.br .B #include <sys/swap.h> .sp .BI "int swapon(const char *" path ", int " swapflags );
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 66 lines · Daniel Gollub
Quoted 7 lines · On Thursday 25 September 2008 10:08:28 Garrett Cooper wrote:
Quoted 7 lines
Quoted 7 lines
Yes, it is. There are numerous test cases in LTP which use:
struct dirent,
by including/usr/include/dirent.h. The interesting part is, this guy (/usr/include/dirent.h) in turn includes/usr/include/bits/dirent.h, where the definition of struct resides. Following is the patch which solves this issue along withpage.hheader file removal from 2.6.25 onwards, reported by Garret earlier.^^^^^^^^^
Quoted 18 lines
Quoted 18 lines
Tried the patch - ltp build with 2.6.27-rc linux headers sucessfully. Thanks for the info and the patch!
Btw. man pages need to get also updated ... there are some pages which still mention <
linux/dirent.h>.Garret, with 2.6.25 <
asm/page.h> got removed - right? If so swapon(2) man page needs also get fixed:dgollub@marvin:~/projects/man-pages> grep -r "asm\/page.h" *
man2/swapon.2:.B #include <asm/page.h> /* to findPAGE_SIZE*/best regards,
Daniel---
[...]
Quoted 4 lines
I find it interesting because I honestly don't remember mentioning this :D..
Would you perhaps mean
linux/signalfd.hvssys/signalfd.h?I don't know either - i was just refering to Subrata's reply... Anyway,
asm/page.his really gone:commit
ed7b1889da256977574663689b598d88950bbd23Author: Kirill A. Shutemov <[email protected]> Date: Thu Feb 7 00:15:56 2008 -0800Unexport
asm/page.hDo not export
asm/page.hduring makeheaders_install. This removesPAGE_SIZE
from userspace headers.Garret, just to refresh your memory ..... ;)
http://article.gmane.org/gmane.linux.ltp/4873best regards,
Daniel---
man2/swapon.2 +0
-0
man2/swapon.2 swapon, swapoff \- start/stop swapping to file/device · line 45
Quoted 8 lines
man2/swapon.2 +0
-2@@ -40,8 +40,6 @@ swapon, swapoff \- start/stop swapping to file/device .SH SYNOPSIS .B #include <unistd.h> .br -.B #include <asm/page.h> /* to find PAGE_SIZE */ -.br .B #include <sys/swap.h> .sp .BI "int swapon(const char *" path ", int " swapflags );
Ah, yes... it's been a few months and unfortunately I have so much correspondence fly by my email boxes it's hard to keep track of what I've all said... my apologies.
The issue with all of this stuff, is that while we are implementing some decent logic, we're unfortunately duplicating a lot of what's contained within autotools for cross compilation, header finding, etc. That being said though, what's being done is rather lightweight compared to using autotools and I've seen a variety of complaints from various forum/mailing list posts about the lack of cross-compilation support with autotools (Mike Fry... could hint more info about this as he was in a mailing list post I saw a while back -- will look up the URI if needed).
What should be done (IMHO) is more tedious, but if done properly this should only need to be done once:
1. Map out versions where header definitions are pushed from the kernel sources to glibc (because every single time a header moves it appears to go from kernel.org's stuff to gnu.org's stuff).
2. Implement a SINGLE compile-time check to determine what the kernel vs glibc version is from the provided sources, and if they pass some level of muster, then include the appropriate header. The result should be contained within a top-level .mk file and with appropriate CPPFLAGS passed to gcc, one can determine whether or not header A or header B should be used.
I just got the LTP sources from CVS, I'm going to apply my makefile changes again, shift everything, repost my results, and we'll discuss this topic again as it's an important TODO item (IMHO).
-Garrett
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
[ kernel people added to Cc ]
Quoted 30 lines · Daniel Gollub
Hi,
with 2.6.27-rc1(?)
linux/dirent.hgot removedKbuildheaders_installtarge and dirent struct got removed:commit
cf6ae8b50e0ee3f764392dadd1970e3f03c40773Author: Adrian Bunk <[email protected]> Date: Fri Jul 25 01:46:46 2008 -0700remove the in-kernel struct dirent{,64}
The kernel struct dirent{,64} were different from the ones in userspace.
Even worse, we exported the kernel ones to userspace.
But after the fat usages are fixed we can remove the conflicting kernel versions.
This broke the build of some LTP syscalls testcases for "getdents", since the <
linux/dirent.h> include is missing and the "internal" dirent struct get/got used in:
testcases/kernel/syscalls/getdents/getdents01.ctestcases/kernel/syscalls/getdents/getdents03.ctestcases/kernel/syscalls/getdents/getdents02.ctestcases/kernel/syscalls/getdents/getdents04.c
Quoted 4 lines
http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/getdents/
Is it safe to use the userspace dirent struct from <
dirent.h> to fix the build of this? Or what should be used for testing the getdents interface instead?
Thanks for your report.
I missed this since the kernel sys_getdents() did not use the "struct dirent" from the header but an own "struct linux_dirent".
It might be safe since the LTP tests don't seem to care whether getdents() returns nonsense.
But it is not correct since the reason why I removed this struct from the userspace headers was that the kernel and libc structs are *different*.
E.g. when I enable the commented out code in getdents01.c I get the expected result that using <dirent.h> instead of <linux/dirent.h> changes a PASS into a FAIL. [1]
IMHO the solution is something like:
- move "struct linux_dirent" from fs/readdir.c to include/linux/dirent.h
- re-export linux/dirent.h to userspace
- change getdents(2) to consistently use "struct linux_dirent"
Questions to fsdevel:
- Do we need to preserve API compatibility with compatibility #define's for struct dirent{,64} here?
- LTP does malloc(sizeof(struct dirent)).
Is this considered a valid API usage that must continue to work?
Quoted 2 lines
best regards,
Daniel
cu
Adrian
[1] I don't know whether the code is valid and guaranteed to pass, but it's obvious why it fails after the #include change
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 59 lines · Adrian Bunk
[ kernel people added to Cc ]
Quoted 30 lines · Daniel Gollub
Hi,
with 2.6.27-rc1(?)
linux/dirent.hgot removedKbuildheaders_installtarge and dirent struct got removed:commit
cf6ae8b50e0ee3f764392dadd1970e3f03c40773Author: Adrian Bunk <[email protected]> Date: Fri Jul 25 01:46:46 2008 -0700remove the in-kernel struct dirent{,64}
The kernel struct dirent{,64} were different from the ones in userspace.
Even worse, we exported the kernel ones to userspace.
But after the fat usages are fixed we can remove the conflicting kernel versions.
This broke the build of some LTP syscalls testcases for "getdents", since the <
linux/dirent.h> include is missing and the "internal" dirent struct get/got used in:
testcases/kernel/syscalls/getdents/getdents01.ctestcases/kernel/syscalls/getdents/getdents03.ctestcases/kernel/syscalls/getdents/getdents02.ctestcases/kernel/syscalls/getdents/getdents04.cQuoted 4 lines
http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/getdents/
Is it safe to use the userspace dirent struct from <
dirent.h> to fix the build of this? Or what should be used for testing the getdents interface instead?Thanks for your report.
I missed this since the kernel
sys_getdents()did not use the "struct dirent" from the header but an own "structlinux_dirent".It might be safe since the LTP tests don't seem to care whether
getdents()returns nonsense.But it is not correct since the reason why I removed this struct from the userspace headers was that the kernel and libc structs are *different*.
E.g. when I enable the commented out code in
getdents01.cI get the expected result that using <dirent.h> instead of <linux/dirent.h> changes a PASS into a FAIL. [1]IMHO the solution is something like:
- move "structlinux_dirent" fromfs/readdir.ctoinclude/linux/dirent.h
- re-exportlinux/dirent.hto userspace
- change getdents(2) to consistently use "structlinux_dirent"
Quoted 8 lines
Questions to fsdevel:
- Do we need to preserve API compatibility with compatibility #define's for struct dirent{,64} here?
- LTP does malloc(sizeof(struct dirent)).
Is this considered a valid API usage that must continue to work?Quoted 2 lines
best regards,
Daniel
I've made some changes to the readdir(2) and getdents(2) man pages to make it clearer that the "dirent" structures used by these to syscalls are different from one another (old_linux_dirent vs linux_dirent), and also different from that used by glibc's readdir(3). (dirent) The changes are already pushed out to man-pages git.
Cheers,
Michael
Signature · 5 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html