public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] sendmsg02: fix compilation on kernel < 2.6.27
@ 2013-04-23  8:37 Jan Stancek
  2013-04-23  8:48 ` Wanlong Gao
  2013-04-23 10:32 ` chrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Stancek @ 2013-04-23  8:37 UTC (permalink / raw)
  To: ltp-list

Using SOCK_CLOEXEC and SOCK_NONBLOCK breaks compilation
on older distros/kernels. These were originally taken from
systemd sources, but as it turns out they are not needed to
trigger this issue.

I confirmed, that issue can still be reproduced on 3.8 kernel
and that testcase can be compiled at least back to RHEL5.3 (2.6.18).

Reported-by: DAN LI <li.dan@cn.fujitsu.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/sendmsg/sendmsg02.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg02.c b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
index 8f38f2c..c38d438 100644
--- a/testcases/kernel/syscalls/sendmsg/sendmsg02.c
+++ b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
@@ -88,7 +88,7 @@ static void client(int id, int pipefd[])
 	mh.msg_iovlen = 1;
 
 	do {
-		fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
+		fd = socket(AF_UNIX, SOCK_DGRAM, 0);
 		write(pipefd[1], &fd, 1);
 		sendmsg(fd, &mh, MSG_NOSIGNAL);
 		close(fd);
@@ -109,7 +109,7 @@ static void server(int id, int pipefd[])
 	snprintf(sa.sun_path, sizeof(sa.sun_path), "socket_test%d", id);
 
 	do {
-		fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
+		fd = socket(AF_UNIX, SOCK_DGRAM, 0);
 		unlink(sa.sun_path);
 		bind(fd, (struct sockaddr *) &sa, sizeof(struct sockaddr_un));
 		read(pipefd[0], &fd, 1);
-- 
1.7.1


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
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] sendmsg02: fix compilation on kernel < 2.6.27
  2013-04-23  8:37 [LTP] [PATCH] sendmsg02: fix compilation on kernel < 2.6.27 Jan Stancek
@ 2013-04-23  8:48 ` Wanlong Gao
  2013-04-23 10:32 ` chrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Wanlong Gao @ 2013-04-23  8:48 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

On 04/23/2013 04:37 PM, Jan Stancek wrote:
> Using SOCK_CLOEXEC and SOCK_NONBLOCK breaks compilation
> on older distros/kernels. These were originally taken from
> systemd sources, but as it turns out they are not needed to
> trigger this issue.
> 
> I confirmed, that issue can still be reproduced on 3.8 kernel
> and that testcase can be compiled at least back to RHEL5.3 (2.6.18).
> 
> Reported-by: DAN LI <li.dan@cn.fujitsu.com>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>

Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

> ---
>  testcases/kernel/syscalls/sendmsg/sendmsg02.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg02.c b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
> index 8f38f2c..c38d438 100644
> --- a/testcases/kernel/syscalls/sendmsg/sendmsg02.c
> +++ b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
> @@ -88,7 +88,7 @@ static void client(int id, int pipefd[])
>  	mh.msg_iovlen = 1;
>  
>  	do {
> -		fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
> +		fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>  		write(pipefd[1], &fd, 1);
>  		sendmsg(fd, &mh, MSG_NOSIGNAL);
>  		close(fd);
> @@ -109,7 +109,7 @@ static void server(int id, int pipefd[])
>  	snprintf(sa.sun_path, sizeof(sa.sun_path), "socket_test%d", id);
>  
>  	do {
> -		fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
> +		fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>  		unlink(sa.sun_path);
>  		bind(fd, (struct sockaddr *) &sa, sizeof(struct sockaddr_un));
>  		read(pipefd[0], &fd, 1);
> 


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
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] sendmsg02: fix compilation on kernel < 2.6.27
  2013-04-23  8:37 [LTP] [PATCH] sendmsg02: fix compilation on kernel < 2.6.27 Jan Stancek
  2013-04-23  8:48 ` Wanlong Gao
@ 2013-04-23 10:32 ` chrubis
  1 sibling, 0 replies; 3+ messages in thread
From: chrubis @ 2013-04-23 10:32 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
>  testcases/kernel/syscalls/sendmsg/sendmsg02.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg02.c b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
> index 8f38f2c..c38d438 100644
> --- a/testcases/kernel/syscalls/sendmsg/sendmsg02.c
> +++ b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
> @@ -88,7 +88,7 @@ static void client(int id, int pipefd[])
>  	mh.msg_iovlen = 1;
>  
>  	do {
> -		fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
> +		fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>  		write(pipefd[1], &fd, 1);
>  		sendmsg(fd, &mh, MSG_NOSIGNAL);
>  		close(fd);
> @@ -109,7 +109,7 @@ static void server(int id, int pipefd[])
>  	snprintf(sa.sun_path, sizeof(sa.sun_path), "socket_test%d", id);
>  
>  	do {
> -		fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
> +		fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>  		unlink(sa.sun_path);
>  		bind(fd, (struct sockaddr *) &sa, sizeof(struct sockaddr_un));
>  		read(pipefd[0], &fd, 1);

This is fine.

And sorry that I haven't yet tested the testcase. I will hopefully
install OpenSUSE with selinux and test it soon.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
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:[~2013-04-23 10:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23  8:37 [LTP] [PATCH] sendmsg02: fix compilation on kernel < 2.6.27 Jan Stancek
2013-04-23  8:48 ` Wanlong Gao
2013-04-23 10:32 ` chrubis

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