public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] syscalls/getdents: Use getdents64 if SYS_getdents is not defined
@ 2013-03-13 14:01 Markos Chandras
  2013-03-13 17:20 ` Mike Frysinger
  2013-03-13 17:58 ` Jan Stancek
  0 siblings, 2 replies; 7+ messages in thread
From: Markos Chandras @ 2013-03-13 14:01 UTC (permalink / raw)
  To: ltp-list

From: Markos Chandras <markos.chandras@imgtec.com>

New Linux Kernel architectures do not define NR_getdents so we
try to use the getdents64 syscall instead

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 testcases/kernel/syscalls/getdents/getdents.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/getdents/getdents.h b/testcases/kernel/syscalls/getdents/getdents.h
index 1d5e584..12d2be4 100644
--- a/testcases/kernel/syscalls/getdents/getdents.h
+++ b/testcases/kernel/syscalls/getdents/getdents.h
@@ -38,12 +38,23 @@
  * declare our own here.  Wheeeeee.
  */
 
+#ifdef SYS_getdents
 struct linux_dirent {
 	unsigned long   d_ino;
 	unsigned long   d_off;
 	unsigned short  d_reclen;
 	char            d_name[];
 };
+#else
+/* Use the 64-bit definition */
+struct linux_dirent {
+	unsigned long long	d_ino;
+	long long		d_off;
+	unsigned short		d_reclen;
+	unsigned char		d_type;
+	char			d_name[0];
+};
+#endif
 
 static inline int
 getdents(unsigned int fd, struct dirent *dirp, unsigned int count)
@@ -57,7 +68,11 @@ getdents(unsigned int fd, struct dirent *dirp, unsigned int count)
 	unsigned int i;
 
 	ptrs.buf = buf;
+#ifdef SYS_getdents
 	ret = syscall(SYS_getdents, fd, buf, count);
+#else
+	ret = syscall(SYS_getdents64, fd, buf, count);
+#endif
 	if (ret < 0)
 		return ret;
 
-- 
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-03-14 16:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 14:01 [LTP] [PATCH 1/2] syscalls/getdents: Use getdents64 if SYS_getdents is not defined Markos Chandras
2013-03-13 17:20 ` Mike Frysinger
2013-03-13 17:21   ` Markos Chandras
2013-03-13 17:58 ` Jan Stancek
2013-03-13 18:03   ` Markos Chandras
2013-03-13 18:23     ` chrubis
     [not found]       ` <CAG2jQ8hbT_8h8KR0V2=7qzwdSy8cqzOWb_oHt4JJ5Y22yFEeDg@mail.gmail.com>
     [not found]         ` <CAG2jQ8j23+74_JZbrkM55aKg4YG+V-g4G1+NsS4fLGy=efRDjQ@mail.gmail.com>
2013-03-14 16:29           ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox