All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/getrandom: remove reference to '<linux/random.h>'
@ 2015-07-09  1:59 Xiaoguang Wang
  2015-07-13 10:07 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaoguang Wang @ 2015-07-09  1:59 UTC (permalink / raw)
  To: ltp-list

Given that we use ltp_syscall() to call getrandom(2) and already
have "GRND_RANDOM, GRND_NONBLOCK" defined in lapi/getrandom.h, indeed
we don't need to include '<linux/random.h>'. Also including
'<linux/random.h>'' will result in some compilation errors in older
linux distribution, for example, in RHEL5.11GA, there will be such
errors:
  In file included from getrandom01.c:29:
  /usr/include/linux/random.h:38: error: expected specifier-qualifier-list before ‘__u32’
  /usr/include/linux/random.h:42: error: expected specifier-qualifier-list before ‘__u32’
This patch will also fix these compilation errors.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 testcases/kernel/syscalls/getrandom/getrandom01.c | 1 -
 testcases/kernel/syscalls/getrandom/getrandom02.c | 1 -
 testcases/kernel/syscalls/getrandom/getrandom03.c | 1 -
 testcases/kernel/syscalls/getrandom/getrandom04.c | 1 -
 4 files changed, 4 deletions(-)

diff --git a/testcases/kernel/syscalls/getrandom/getrandom01.c b/testcases/kernel/syscalls/getrandom/getrandom01.c
index 818372e..103748a 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom01.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom01.c
@@ -26,7 +26,6 @@
  *
  */
 
-#include <linux/random.h>
 #include "lapi/getrandom.h"
 #include "linux_syscall_numbers.h"
 #include "test.h"
diff --git a/testcases/kernel/syscalls/getrandom/getrandom02.c b/testcases/kernel/syscalls/getrandom/getrandom02.c
index 905917b..0ac8bd2 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom02.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom02.c
@@ -27,7 +27,6 @@
  *
  */
 
-#include <linux/random.h>
 #include "lapi/getrandom.h"
 #include "linux_syscall_numbers.h"
 #include "test.h"
diff --git a/testcases/kernel/syscalls/getrandom/getrandom03.c b/testcases/kernel/syscalls/getrandom/getrandom03.c
index 9c13d09..03950e0 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom03.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom03.c
@@ -30,7 +30,6 @@
  *  number of bytes required and expects success.
  */
 
-#include <linux/random.h>
 #include "lapi/getrandom.h"
 #include "linux_syscall_numbers.h"
 #include "test.h"
diff --git a/testcases/kernel/syscalls/getrandom/getrandom04.c b/testcases/kernel/syscalls/getrandom/getrandom04.c
index 4e099e1..10ab44b 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom04.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom04.c
@@ -30,7 +30,6 @@
  *  descriptors to 3 and expects success.
  */
 
-#include <linux/random.h>
 #include <sys/resource.h>
 #include "lapi/getrandom.h"
 #include "linux_syscall_numbers.h"
-- 
1.8.2.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] syscalls/getrandom: remove reference to '<linux/random.h>'
  2015-07-09  1:59 [LTP] [PATCH] syscalls/getrandom: remove reference to '<linux/random.h>' Xiaoguang Wang
@ 2015-07-13 10:07 ` Cyril Hrubis
       [not found]   ` <1721921160.16296939.1436785318844.JavaMail.zimbra@redhat.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2015-07-13 10:07 UTC (permalink / raw)
  To: Xiaoguang Wang; +Cc: ltp-list

Hi!
> Given that we use ltp_syscall() to call getrandom(2) and already
> have "GRND_RANDOM, GRND_NONBLOCK" defined in lapi/getrandom.h, indeed
> we don't need to include '<linux/random.h>'. Also including
> '<linux/random.h>'' will result in some compilation errors in older
> linux distribution, for example, in RHEL5.11GA, there will be such
> errors:
>   In file included from getrandom01.c:29:
>   /usr/include/linux/random.h:38: error: expected specifier-qualifier-list before ???__u32???
>   /usr/include/linux/random.h:42: error: expected specifier-qualifier-list before ???__u32???
> This patch will also fix these compilation errors.

This is not correct.

The lapi/getrandom.h defines these as fallback definitions only if they
are not defined allready. And we really want to use the defines from the
system if they are available to ensure that they are correct.

The system header on older distros likely misses to include
linux/types.h to get the kernel types defined.

What about moving the #include <linux/random.h> to start of
lapi/getrandom.h and including <linux/types.h> there as well if needed
(would require configure check).

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] syscalls/getrandom: remove reference to '<linux/random.h>'
       [not found]   ` <1721921160.16296939.1436785318844.JavaMail.zimbra@redhat.com>
@ 2015-07-13 11:12     ` Cyril Hrubis
  0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2015-07-13 11:12 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> > What about moving the #include <linux/random.h> to start of
> > lapi/getrandom.h and including <linux/types.h> there as well if needed
> > (would require configure check).
> 
> Current man page for getrandom suggests including just <linux/random.h>,
> I'd stick with that, but verify it compiles with configure check.

Sounds good to me.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2015-07-13 11:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09  1:59 [LTP] [PATCH] syscalls/getrandom: remove reference to '<linux/random.h>' Xiaoguang Wang
2015-07-13 10:07 ` Cyril Hrubis
     [not found]   ` <1721921160.16296939.1436785318844.JavaMail.zimbra@redhat.com>
2015-07-13 11:12     ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.