----- Original Message -----
> From: "Cyril Hrubis" <chru...@suse.cz>
> To: "Xiaoguang Wang" <wangxg.f...@cn.fujitsu.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Monday, 13 July, 2015 12:07:29 PM
> Subject: Re: [LTP] [PATCH] syscalls/getrandom: remove reference to
> '<linux/random.h>'
>
> 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.
AFAIK direct inclusion of linux headers was not guaranteed to work in past
and this distro has quite old kernel.
>
> The system header on older distros likely misses to include
> linux/types.h to get the kernel types defined.
Adding linux/types.h creates conflict with sys/types.h for me on RHEL5.6:
In file included from /usr/include/stdlib.h:438,
from ../../../../include/test.h:41,
from getrandom01.c:33:
/usr/include/sys/types.h:46: error: conflicting types for ‘loff_t’
/usr/include/linux/types.h:30: error: previous declaration of ‘loff_t’ was here
/usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’
/usr/include/linux/types.h:13: error: previous declaration of ‘dev_t’ was here
In file included from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:438,
from ../../../../include/test.h:41,
from getrandom01.c:33:
>
> 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.
Regards,
Jan
>
> --
> Cyril Hrubis
> chru...@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
>
------------------------------------------------------------------------------
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