syscalls/getdents: Add parameter to test getdents64 syscall
PATCH v2 1/1 syscalls/getdents: Add parameter to test getdents64 syscall
From: Markos Chandras <[email protected]>
Add new "-l" parameter to test the getdents64 syscall along with the getdents one. Use ltp_syscall() to call the system call to get proper return values when an architecture does not support any of the getdents{,64} syscalls. Modify runtest/syscalls to call getdentsXX tests with and without the "-l" parameter
--- runtest/syscalls | 9 ++++ testcases/kernel/syscalls/getdents/Makefile | 2 + testcases/kernel/syscalls/getdents/getdents.h | 48 ++++++++++++++++++++- testcases/kernel/syscalls/getdents/getdents01.c | 54 +++++++++++++++++------ testcases/kernel/syscalls/getdents/getdents02.c | 43 +++++++++++++++--- testcases/kernel/syscalls/getdents/getdents03.c | 40 ++++++++++++++--- testcases/kernel/syscalls/getdents/getdents04.c | 46 +++++++++++++++---- 7 files changed, 202 insertions(+), 40 deletions(-)
runtest/syscalls +9 -0
@@ -331,6 +331,15 @@ getdents03_64 getdents03_64 getdents04 getdents04 getdents04_64 getdents04_64 +getdents01_long getdents01 -l +getdents01_64_long getdents01_64 -l +getdents02_long getdents02 -l +getdents02_64_long getdents02_64 -l +getdents03_long getdents03 -l +getdents03_64_long getdents03_64 -l +getdents04_long getdents04 -l +getdents04_64_long getdents04_64 -l + getdomainname01 getdomainname01 getdtablesize01 getdtablesize01
testcases/kernel/syscalls/getdents/Makefile +2 -0
@@ -21,6 +21,8 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../utils/newer_64.mk +CFLAGS += -D_LARGEFILE64_SOURCE + %_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=__off64_t include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/getdents/getdents.h +47 -1
70 lines not on this page · raw message
testcases/kernel/syscalls/getdents/getdents01.c +40 -14
101 lines not on this page · raw message
testcases/kernel/syscalls/getdents/getdents02.c +35 -8
89 lines not on this page · raw message
testcases/kernel/syscalls/getdents/getdents03.c +33 -7
@@ -43,10 +43,12 @@* -e : Turn on errno logging. * -i n : Execute test n times. * -I x : Execute test for x seconds. +* -l : Test the getdents64 system call. * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * HISTORY +* 03/2013 - Added -l option by Markos Chandras * 03/2001 - Written by Wayne Boyer * * RESTRICTIONS
@@ -72,6 +74,18 @@ int TST_TOTAL = 1;int exp_enos[] = {EINVAL ,0 };/* 0 terminated list of expected errnos */ +static int longsyscall; + +option_t Options[] = { + {"l" , &longsyscall,NULL },/* -l long option. Tests getdents64 */ + {NULL ,NULL ,NULL } +}; + +void help (void ) +{ +printf (" -l Test the getdents64 system call\n" ); +} +int main (int ac,char **av) {int lc;
@@ -80,13 +94,22 @@ int main(int ac, char **av)int count;size_t size =0 ;char *dir_name =NULL ; +struct dirent64 *dirp64;struct dirent *dirp; -if ((msg =parse_opts (ac, av,NULL ,NULL )) !=NULL ) +if ((msg =parse_opts (ac, av, Options, &help)) !=NULL )tst_brkm (TBROK ,NULL ,"OPTION PARSING ERROR - %s" , msg);setup (); +if (longsyscall) { +if ((dirp64 =malloc (sizeof (struct dirent64 ))) ==NULL ) +tst_brkm (TBROK , cleanup,"malloc failed" ); + }else { +if ((dirp =malloc (sizeof (struct dirent ))) ==NULL ) +tst_brkm (TBROK , cleanup,"malloc failed" ); + } +for (lc =0 ;TEST_LOOPING (lc); lc++) { tst_count =0 ;
@@ -94,9 +117,6 @@ int main(int ac, char **av)tst_brkm (TBROK , cleanup,"Can not get current " "directory name" ); -if ((dirp =malloc (sizeof (struct dirent ))) ==NULL ) -tst_brkm (TBROK , cleanup,"malloc failed" ); -/* Set count to be very small. The result should be EINVAL */ count =1 ;
@@ -104,7 +124,10 @@ int main(int ac, char **av)if ((fd =open (dir_name,O_RDONLY )) ==-1 )tst_brkm (TBROK , cleanup,"open of directory failed" ); - rval =getdents (fd, dirp, count); +if (longsyscall) + rval =getdents64 (fd, dirp64, count); +else + rval =getdents (fd, dirp, count);/* * Hopefully we get an error due to the small buffer.
@@ -129,12 +152,15 @@ int main(int ac, char **av)free (dir_name); dir_name =NULL ; -free (dirp); -if ((rval =close (fd)) ==-1 )tst_brkm (TBROK , cleanup,"fd close failed" ); } +if (longsyscall) +free (dirp64); +else +free (dirp); +cleanup ();tst_exit ();
testcases/kernel/syscalls/getdents/getdents04.c +36 -10
99 lines not on this page · raw message
Signature · 13 lines
1.7.1 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 5 lines · On Friday 15 March 2013 09:49:30 Markos Chandras wrote:
Add new "-l" parameter to test the getdents64 syscall along with the getdents one. Use
ltp_syscall()to call the system call to get proper return values when an architecture does not support any of the getdents{,64} syscalls. Modify runtest/syscalls to call getdentsXX tests with and without the "-l" parameter
your patch introduces a lot of warnings. please verify it on a few arches first (like x86_64).
testcases/kernel/syscalls/getdents/Makefile top_srcdir ?= ../../../.. · line 24
Quoted 4 lines
testcases/kernel/syscalls/getdents/Makefile +1
-0+CFLAGS += -D_LARGEFILE64_SOURCE
these are CPPFLAGS, not CFLAGS
-mike
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 9 lines · Mike Frysinger
Quoted 5 lines · On Friday 15 March 2013 09:49:30 Markos Chandras wrote:
Add new "-l" parameter to test the getdents64 syscall along with the getdents one. Use
ltp_syscall()to call the system call to get proper return values when an architecture does not support any of the getdents{,64} syscalls. Modify runtest/syscalls to call getdentsXX tests with and without the "-l" parameteryour patch introduces a lot of warnings. please verify it on a few arches first (like
x86_64).
Yes I see what you mean. I will prepare a new one.
Quoted 8 lines
testcases/kernel/syscalls/getdents/Makefile top_srcdir ?= ../../../.. · line 24
Quoted 5 lines
testcases/kernel/syscalls/getdents/Makefile +1
-0+CFLAGS += -D_LARGEFILE64_SOURCEthese are CPPFLAGS, not CFLAGS
-mike
Indeed. I will fix it too.
Signature · 12 lines
Regards, Markos Chandras ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list