public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] containers: semctl replaced with semop in sysvipc/sem_comm.c
@ 2015-02-24 17:52 Matus Marhefka
  2015-02-26  9:06 ` Cyril Hrubis
  2015-02-26 12:57 ` [LTP] [PATCH v2] " Matus Marhefka
  0 siblings, 2 replies; 7+ messages in thread
From: Matus Marhefka @ 2015-02-24 17:52 UTC (permalink / raw)
  To: ltp-list

semctl call replaced with semop call for setting up semaphores initial
values because semctl needs non-standard type (not in sys/sem.h).

Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
---
 testcases/kernel/containers/sysvipc/sem_comm.c | 57 +++++++++++++++++---------
 1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c b/testcases/kernel/containers/sysvipc/sem_comm.c
index b44be6d..1ac5394 100644
--- a/testcases/kernel/containers/sysvipc/sem_comm.c
+++ b/testcases/kernel/containers/sysvipc/sem_comm.c
@@ -32,14 +32,19 @@
 #include <sys/wait.h>
 #include <stdio.h>
 #include <errno.h>
+#include "usctest.h"
 #include "test.h"
 #include "safe_macros.h"
 #include "libclone.h"
 #include "ipcns_helper.h"
 
+
 #define TESTKEY 124426L
 char *TCID	= "sem_comm";
 int TST_TOTAL	= 1;
+struct tst_checkpoint checkpoint1;
+struct tst_checkpoint checkpoint2;
+
 
 static void cleanup(void)
 {
@@ -51,7 +56,8 @@ static void setup(void)
 	tst_require_root(NULL);
 	check_newipc();
 	tst_tmpdir();
-	TST_CHECKPOINT_INIT(tst_rmdir);
+	TST_CHECKPOINT_CREATE(&checkpoint1);
+	TST_CHECKPOINT_CREATE(&checkpoint2);
 }
 
 int chld1_sem(void *arg)
@@ -59,32 +65,39 @@ int chld1_sem(void *arg)
 	int id;
 	struct sembuf sm;
 
-	id = semget(TESTKEY, 1, IPC_CREAT);
+	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR|IPC_EXCL);
 	if (id == -1) {
 		perror("semget");
 		return 2;
 	}
 
-	if (semctl(id, 0, SETVAL, 1) == -1) {
-		perror("semctl");
+	sm.sem_num = 0;
+	sm.sem_op = 1;
+	sm.sem_flg = IPC_NOWAIT;
+	if (semop(id, &sm, 1) == -1) {
+		perror("semop");
 		semctl(id, 0, IPC_RMID);
 		return 2;
 	}
 
-	/* tell child2 to continue and wait for it to create the semaphore */
-	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
+	/* tell child2 to continue */
+	TST_CHECKPOINT_SIGNAL_CHILD(NULL, &checkpoint1);
+
+	/* wait for child2 to create the semaphore */
+	TST_CHECKPOINT_CHILD_WAIT(&checkpoint2);
 
-	sm.sem_num = 0;
 	sm.sem_op = -1;
-	sm.sem_flg = IPC_NOWAIT;
 	if (semop(id, &sm, 1) == -1) {
 		perror("semop");
 		semctl(id, 0, IPC_RMID);
 		return 2;
 	}
 
-	/* tell child2 to continue and wait for it to lock the semaphore */
-	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
+	/* tell child2 to continue */
+	TST_CHECKPOINT_SIGNAL_CHILD(NULL, &checkpoint1);
+
+	/* wait for child2 to lock the semaphore */
+	TST_CHECKPOINT_CHILD_WAIT(&checkpoint2);
 
 	sm.sem_op = 1;
 	semop(id, &sm, 1);
@@ -99,26 +112,32 @@ int chld2_sem(void *arg)
 	struct sembuf sm;
 
 	/* wait for child1 to create the semaphore */
-	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
+	TST_CHECKPOINT_CHILD_WAIT(&checkpoint1);
 
-	id = semget(TESTKEY, 1, IPC_CREAT);
+	/* IPC_EXCL is excluded because we do not want semget call to fail
+	 * if namespaces logic doesn't work correctly */
+	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR);
 	if (id == -1) {
 		perror("semget");
 		return 2;
 	}
 
-	if (semctl(id, 0, SETVAL, 1) == -1) {
-		perror("semctl");
+	sm.sem_num = 0;
+	sm.sem_op = 1;
+	sm.sem_flg = IPC_NOWAIT;
+	if (semop(id, &sm, 1) == -1) {
+		perror("semop");
 		semctl(id, 0, IPC_RMID);
 		return 2;
 	}
 
-	/* tell child1 to continue and wait for it to lock the semaphore */
-	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
+	/* tell child1 to continue */
+	TST_CHECKPOINT_SIGNAL_CHILD(NULL, &checkpoint2);
+
+	/* wait for child1 to lock the semaphore */
+	TST_CHECKPOINT_CHILD_WAIT(&checkpoint1);
 
-	sm.sem_num = 0;
 	sm.sem_op = -1;
-	sm.sem_flg = IPC_NOWAIT;
 	if (semop(id, &sm, 1) == -1) {
 		if (errno == EAGAIN) {
 			rval = 1;
@@ -130,7 +149,7 @@ int chld2_sem(void *arg)
 	}
 
 	/* tell child1 to continue */
-	TST_SAFE_CHECKPOINT_WAKE(NULL, 0);
+	TST_CHECKPOINT_SIGNAL_CHILD(NULL, &checkpoint2);
 
 	sm.sem_op = 1;
 	semop(id, &sm, 1);
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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

* Re: [LTP] [PATCH] containers: semctl replaced with semop in sysvipc/sem_comm.c
  2015-02-24 17:52 [LTP] [PATCH] containers: semctl replaced with semop in sysvipc/sem_comm.c Matus Marhefka
@ 2015-02-26  9:06 ` Cyril Hrubis
  2015-02-26 12:57 ` [LTP] [PATCH v2] " Matus Marhefka
  1 sibling, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-02-26  9:06 UTC (permalink / raw)
  To: Matus Marhefka; +Cc: ltp-list

Hi!
> semctl call replaced with semop call for setting up semaphores initial
> values because semctl needs non-standard type (not in sys/sem.h).

Looks like this patch accidentally reverts:

commit aabb8340f63ed31afe995fd97795e542dc68b93c
Author: Cyril Hrubis <chrubis@suse.cz>
Date:   Wed Feb 4 14:37:03 2015 +0100

    Include usctest.h in test.h

and

commit 9f136a48c6205362cd8d35c726491ca93cb16514
Author: Cyril Hrubis <chrubis@suse.cz>
Date:   Tue Feb 17 17:16:09 2015 +0100

    lib: Rewrite checkpoint synchronization

Can you please fix that and resend.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH v2] containers: semctl replaced with semop in sysvipc/sem_comm.c
  2015-02-24 17:52 [LTP] [PATCH] containers: semctl replaced with semop in sysvipc/sem_comm.c Matus Marhefka
  2015-02-26  9:06 ` Cyril Hrubis
@ 2015-02-26 12:57 ` Matus Marhefka
  2015-02-26 13:22   ` Jan Stancek
  1 sibling, 1 reply; 7+ messages in thread
From: Matus Marhefka @ 2015-02-26 12:57 UTC (permalink / raw)
  To: ltp-list

semctl call replaced with semop call for setting up semaphores initial
values because semctl needs non-standard type (not in sys/sem.h).

Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
---
 testcases/kernel/containers/sysvipc/sem_comm.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c b/testcases/kernel/containers/sysvipc/sem_comm.c
index b44be6d..fba6767 100644
--- a/testcases/kernel/containers/sysvipc/sem_comm.c
+++ b/testcases/kernel/containers/sysvipc/sem_comm.c
@@ -59,14 +59,17 @@ int chld1_sem(void *arg)
 	int id;
 	struct sembuf sm;
 
-	id = semget(TESTKEY, 1, IPC_CREAT);
+	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR|IPC_EXCL);
 	if (id == -1) {
 		perror("semget");
 		return 2;
 	}
 
-	if (semctl(id, 0, SETVAL, 1) == -1) {
-		perror("semctl");
+	sm.sem_num = 0;
+	sm.sem_op = 1;
+	sm.sem_flg = IPC_NOWAIT;
+	if (semop(id, &sm, 1) == -1) {
+		perror("semop");
 		semctl(id, 0, IPC_RMID);
 		return 2;
 	}
@@ -74,9 +77,7 @@ int chld1_sem(void *arg)
 	/* tell child2 to continue and wait for it to create the semaphore */
 	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
 
-	sm.sem_num = 0;
 	sm.sem_op = -1;
-	sm.sem_flg = IPC_NOWAIT;
 	if (semop(id, &sm, 1) == -1) {
 		perror("semop");
 		semctl(id, 0, IPC_RMID);
@@ -101,14 +102,19 @@ int chld2_sem(void *arg)
 	/* wait for child1 to create the semaphore */
 	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
 
-	id = semget(TESTKEY, 1, IPC_CREAT);
+	/* IPC_EXCL is excluded because we do not want semget call to fail
+	 * if namespaces logic doesn't work correctly */
+	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR);
 	if (id == -1) {
 		perror("semget");
 		return 2;
 	}
 
-	if (semctl(id, 0, SETVAL, 1) == -1) {
-		perror("semctl");
+	sm.sem_num = 0;
+	sm.sem_op = 1;
+	sm.sem_flg = IPC_NOWAIT;
+	if (semop(id, &sm, 1) == -1) {
+		perror("semop");
 		semctl(id, 0, IPC_RMID);
 		return 2;
 	}
@@ -116,9 +122,7 @@ int chld2_sem(void *arg)
 	/* tell child1 to continue and wait for it to lock the semaphore */
 	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
 
-	sm.sem_num = 0;
 	sm.sem_op = -1;
-	sm.sem_flg = IPC_NOWAIT;
 	if (semop(id, &sm, 1) == -1) {
 		if (errno == EAGAIN) {
 			rval = 1;
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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

* Re: [LTP] [PATCH v2] containers: semctl replaced with semop in sysvipc/sem_comm.c
  2015-02-26 12:57 ` [LTP] [PATCH v2] " Matus Marhefka
@ 2015-02-26 13:22   ` Jan Stancek
  2015-04-20 10:28     ` Matus Marhefka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Stancek @ 2015-02-26 13:22 UTC (permalink / raw)
  To: Matus Marhefka; +Cc: ltp-list





----- Original Message -----
> From: "Matus Marhefka" <mmarhefk@redhat.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, 26 February, 2015 1:57:41 PM
> Subject: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c
> 
> semctl call replaced with semop call for setting up semaphores initial
> values because semctl needs non-standard type (not in sys/sem.h).
> 
> Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>

Looks good to me.
Reviewed-by: Jan Stancek <jstancek@redhat.com>

Regards,
Jan

> ---
>  testcases/kernel/containers/sysvipc/sem_comm.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c
> b/testcases/kernel/containers/sysvipc/sem_comm.c
> index b44be6d..fba6767 100644
> --- a/testcases/kernel/containers/sysvipc/sem_comm.c
> +++ b/testcases/kernel/containers/sysvipc/sem_comm.c
> @@ -59,14 +59,17 @@ int chld1_sem(void *arg)
>  	int id;
>  	struct sembuf sm;
>  
> -	id = semget(TESTKEY, 1, IPC_CREAT);
> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR|IPC_EXCL);
>  	if (id == -1) {
>  		perror("semget");
>  		return 2;
>  	}
>  
> -	if (semctl(id, 0, SETVAL, 1) == -1) {
> -		perror("semctl");
> +	sm.sem_num = 0;
> +	sm.sem_op = 1;
> +	sm.sem_flg = IPC_NOWAIT;
> +	if (semop(id, &sm, 1) == -1) {
> +		perror("semop");
>  		semctl(id, 0, IPC_RMID);
>  		return 2;
>  	}
> @@ -74,9 +77,7 @@ int chld1_sem(void *arg)
>  	/* tell child2 to continue and wait for it to create the semaphore */
>  	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>  
> -	sm.sem_num = 0;
>  	sm.sem_op = -1;
> -	sm.sem_flg = IPC_NOWAIT;
>  	if (semop(id, &sm, 1) == -1) {
>  		perror("semop");
>  		semctl(id, 0, IPC_RMID);
> @@ -101,14 +102,19 @@ int chld2_sem(void *arg)
>  	/* wait for child1 to create the semaphore */
>  	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
>  
> -	id = semget(TESTKEY, 1, IPC_CREAT);
> +	/* IPC_EXCL is excluded because we do not want semget call to fail
> +	 * if namespaces logic doesn't work correctly */
> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR);
>  	if (id == -1) {
>  		perror("semget");
>  		return 2;
>  	}
>  
> -	if (semctl(id, 0, SETVAL, 1) == -1) {
> -		perror("semctl");
> +	sm.sem_num = 0;
> +	sm.sem_op = 1;
> +	sm.sem_flg = IPC_NOWAIT;
> +	if (semop(id, &sm, 1) == -1) {
> +		perror("semop");
>  		semctl(id, 0, IPC_RMID);
>  		return 2;
>  	}
> @@ -116,9 +122,7 @@ int chld2_sem(void *arg)
>  	/* tell child1 to continue and wait for it to lock the semaphore */
>  	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>  
> -	sm.sem_num = 0;
>  	sm.sem_op = -1;
> -	sm.sem_flg = IPC_NOWAIT;
>  	if (semop(id, &sm, 1) == -1) {
>  		if (errno == EAGAIN) {
>  			rval = 1;
> --
> 1.8.3.1
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v2] containers: semctl replaced with semop in sysvipc/sem_comm.c
  2015-02-26 13:22   ` Jan Stancek
@ 2015-04-20 10:28     ` Matus Marhefka
  2015-04-21  9:21       ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 7+ messages in thread
From: Matus Marhefka @ 2015-04-20 10:28 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi,

please consider pushing this reviewed patch.

Thanks,
Matus Marhefka


----- Original Message -----
From: "Jan Stancek" <jstancek@redhat.com>
To: "Matus Marhefka" <mmarhefk@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Sent: Thursday, February 26, 2015 2:22:24 PM
Subject: Re: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c





----- Original Message -----
> From: "Matus Marhefka" <mmarhefk@redhat.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, 26 February, 2015 1:57:41 PM
> Subject: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c
> 
> semctl call replaced with semop call for setting up semaphores initial
> values because semctl needs non-standard type (not in sys/sem.h).
> 
> Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>

Looks good to me.
Reviewed-by: Jan Stancek <jstancek@redhat.com>

Regards,
Jan

> ---
>  testcases/kernel/containers/sysvipc/sem_comm.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c
> b/testcases/kernel/containers/sysvipc/sem_comm.c
> index b44be6d..fba6767 100644
> --- a/testcases/kernel/containers/sysvipc/sem_comm.c
> +++ b/testcases/kernel/containers/sysvipc/sem_comm.c
> @@ -59,14 +59,17 @@ int chld1_sem(void *arg)
>  	int id;
>  	struct sembuf sm;
>  
> -	id = semget(TESTKEY, 1, IPC_CREAT);
> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR|IPC_EXCL);
>  	if (id == -1) {
>  		perror("semget");
>  		return 2;
>  	}
>  
> -	if (semctl(id, 0, SETVAL, 1) == -1) {
> -		perror("semctl");
> +	sm.sem_num = 0;
> +	sm.sem_op = 1;
> +	sm.sem_flg = IPC_NOWAIT;
> +	if (semop(id, &sm, 1) == -1) {
> +		perror("semop");
>  		semctl(id, 0, IPC_RMID);
>  		return 2;
>  	}
> @@ -74,9 +77,7 @@ int chld1_sem(void *arg)
>  	/* tell child2 to continue and wait for it to create the semaphore */
>  	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>  
> -	sm.sem_num = 0;
>  	sm.sem_op = -1;
> -	sm.sem_flg = IPC_NOWAIT;
>  	if (semop(id, &sm, 1) == -1) {
>  		perror("semop");
>  		semctl(id, 0, IPC_RMID);
> @@ -101,14 +102,19 @@ int chld2_sem(void *arg)
>  	/* wait for child1 to create the semaphore */
>  	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
>  
> -	id = semget(TESTKEY, 1, IPC_CREAT);
> +	/* IPC_EXCL is excluded because we do not want semget call to fail
> +	 * if namespaces logic doesn't work correctly */
> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR);
>  	if (id == -1) {
>  		perror("semget");
>  		return 2;
>  	}
>  
> -	if (semctl(id, 0, SETVAL, 1) == -1) {
> -		perror("semctl");
> +	sm.sem_num = 0;
> +	sm.sem_op = 1;
> +	sm.sem_flg = IPC_NOWAIT;
> +	if (semop(id, &sm, 1) == -1) {
> +		perror("semop");
>  		semctl(id, 0, IPC_RMID);
>  		return 2;
>  	}
> @@ -116,9 +122,7 @@ int chld2_sem(void *arg)
>  	/* tell child1 to continue and wait for it to lock the semaphore */
>  	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>  
> -	sm.sem_num = 0;
>  	sm.sem_op = -1;
> -	sm.sem_flg = IPC_NOWAIT;
>  	if (semop(id, &sm, 1) == -1) {
>  		if (errno == EAGAIN) {
>  			rval = 1;
> --
> 1.8.3.1
> 

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v2] containers: semctl replaced with semop in sysvipc/sem_comm.c
  2015-04-20 10:28     ` Matus Marhefka
@ 2015-04-21  9:21       ` Stanislav Kholmanskikh
  2015-04-21 10:12         ` Matus Marhefka
  0 siblings, 1 reply; 7+ messages in thread
From: Stanislav Kholmanskikh @ 2015-04-21  9:21 UTC (permalink / raw)
  To: Matus Marhefka, Jan Stancek; +Cc: ltp-list

Hi.

On 04/20/2015 01:28 PM, Matus Marhefka wrote:
> Hi,
>
> please consider pushing this reviewed patch.
>
> Thanks,
> Matus Marhefka
>
>
> ----- Original Message -----
> From: "Jan Stancek" <jstancek@redhat.com>
> To: "Matus Marhefka" <mmarhefk@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Thursday, February 26, 2015 2:22:24 PM
> Subject: Re: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c
>
>
>
>
>
> ----- Original Message -----
>> From: "Matus Marhefka" <mmarhefk@redhat.com>
>> To: ltp-list@lists.sourceforge.net
>> Sent: Thursday, 26 February, 2015 1:57:41 PM
>> Subject: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c
>>
>> semctl call replaced with semop call for setting up semaphores initial
>> values because semctl needs non-standard type (not in sys/sem.h).

Emm, when I was preparing patches:

b681672752634a70ba1bd6b1c6b5ae2967ac13e5 ("Keep the definition of union 
semun in one place")
586b51bf334b189d3e48760676ffeb39ce2a4371 ("sem_comm: pass a semun union 
to semctl()")

I overlooked your patch. Sorry.

It seems the above patches fixes what you were trying to fix with your 
patch, and so it became redundant.

Do you agree?

Sorry again.


>>
>> Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
>
> Looks good to me.
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
> Regards,
> Jan
>
>> ---
>>   testcases/kernel/containers/sysvipc/sem_comm.c | 24 ++++++++++++++----------
>>   1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c
>> b/testcases/kernel/containers/sysvipc/sem_comm.c
>> index b44be6d..fba6767 100644
>> --- a/testcases/kernel/containers/sysvipc/sem_comm.c
>> +++ b/testcases/kernel/containers/sysvipc/sem_comm.c
>> @@ -59,14 +59,17 @@ int chld1_sem(void *arg)
>>   	int id;
>>   	struct sembuf sm;
>>
>> -	id = semget(TESTKEY, 1, IPC_CREAT);
>> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR|IPC_EXCL);
>>   	if (id == -1) {
>>   		perror("semget");
>>   		return 2;
>>   	}
>>
>> -	if (semctl(id, 0, SETVAL, 1) == -1) {
>> -		perror("semctl");
>> +	sm.sem_num = 0;
>> +	sm.sem_op = 1;
>> +	sm.sem_flg = IPC_NOWAIT;
>> +	if (semop(id, &sm, 1) == -1) {
>> +		perror("semop");
>>   		semctl(id, 0, IPC_RMID);
>>   		return 2;
>>   	}
>> @@ -74,9 +77,7 @@ int chld1_sem(void *arg)
>>   	/* tell child2 to continue and wait for it to create the semaphore */
>>   	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>>
>> -	sm.sem_num = 0;
>>   	sm.sem_op = -1;
>> -	sm.sem_flg = IPC_NOWAIT;
>>   	if (semop(id, &sm, 1) == -1) {
>>   		perror("semop");
>>   		semctl(id, 0, IPC_RMID);
>> @@ -101,14 +102,19 @@ int chld2_sem(void *arg)
>>   	/* wait for child1 to create the semaphore */
>>   	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
>>
>> -	id = semget(TESTKEY, 1, IPC_CREAT);
>> +	/* IPC_EXCL is excluded because we do not want semget call to fail
>> +	 * if namespaces logic doesn't work correctly */
>> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR);
>>   	if (id == -1) {
>>   		perror("semget");
>>   		return 2;
>>   	}
>>
>> -	if (semctl(id, 0, SETVAL, 1) == -1) {
>> -		perror("semctl");
>> +	sm.sem_num = 0;
>> +	sm.sem_op = 1;
>> +	sm.sem_flg = IPC_NOWAIT;
>> +	if (semop(id, &sm, 1) == -1) {
>> +		perror("semop");
>>   		semctl(id, 0, IPC_RMID);
>>   		return 2;
>>   	}
>> @@ -116,9 +122,7 @@ int chld2_sem(void *arg)
>>   	/* tell child1 to continue and wait for it to lock the semaphore */
>>   	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>>
>> -	sm.sem_num = 0;
>>   	sm.sem_op = -1;
>> -	sm.sem_flg = IPC_NOWAIT;
>>   	if (semop(id, &sm, 1) == -1) {
>>   		if (errno == EAGAIN) {
>>   			rval = 1;
>> --
>> 1.8.3.1
>>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v2] containers: semctl replaced with semop in sysvipc/sem_comm.c
  2015-04-21  9:21       ` Stanislav Kholmanskikh
@ 2015-04-21 10:12         ` Matus Marhefka
  0 siblings, 0 replies; 7+ messages in thread
From: Matus Marhefka @ 2015-04-21 10:12 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: ltp-list

Hi,

no problem and yes, the patches

b681672752634a70ba1bd6b1c6b5ae2967ac13e5 ("Keep the definition of union 
semun in one place")
586b51bf334b189d3e48760676ffeb39ce2a4371 ("sem_comm: pass a semun union 
to semctl()")

fixes the issue and so my old patch became redundant, thanks for pointing it out.


----- Original Message -----
From: "Stanislav Kholmanskikh" <stanislav.kholmanskikh@oracle.com>
To: "Matus Marhefka" <mmarhefk@redhat.com>, "Jan Stancek" <jstancek@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Sent: Tuesday, April 21, 2015 11:21:18 AM
Subject: Re: [LTP] [PATCH v2] containers: semctl replaced with semop in sysvipc/sem_comm.c

Hi.

On 04/20/2015 01:28 PM, Matus Marhefka wrote:
> Hi,
>
> please consider pushing this reviewed patch.
>
> Thanks,
> Matus Marhefka
>
>
> ----- Original Message -----
> From: "Jan Stancek" <jstancek@redhat.com>
> To: "Matus Marhefka" <mmarhefk@redhat.com>
> Cc: ltp-list@lists.sourceforge.net
> Sent: Thursday, February 26, 2015 2:22:24 PM
> Subject: Re: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c
>
>
>
>
>
> ----- Original Message -----
>> From: "Matus Marhefka" <mmarhefk@redhat.com>
>> To: ltp-list@lists.sourceforge.net
>> Sent: Thursday, 26 February, 2015 1:57:41 PM
>> Subject: [LTP] [PATCH v2] containers: semctl replaced with semop in	sysvipc/sem_comm.c
>>
>> semctl call replaced with semop call for setting up semaphores initial
>> values because semctl needs non-standard type (not in sys/sem.h).

Emm, when I was preparing patches:

b681672752634a70ba1bd6b1c6b5ae2967ac13e5 ("Keep the definition of union 
semun in one place")
586b51bf334b189d3e48760676ffeb39ce2a4371 ("sem_comm: pass a semun union 
to semctl()")

I overlooked your patch. Sorry.

It seems the above patches fixes what you were trying to fix with your 
patch, and so it became redundant.

Do you agree?

Sorry again.


>>
>> Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
>
> Looks good to me.
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
> Regards,
> Jan
>
>> ---
>>   testcases/kernel/containers/sysvipc/sem_comm.c | 24 ++++++++++++++----------
>>   1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c
>> b/testcases/kernel/containers/sysvipc/sem_comm.c
>> index b44be6d..fba6767 100644
>> --- a/testcases/kernel/containers/sysvipc/sem_comm.c
>> +++ b/testcases/kernel/containers/sysvipc/sem_comm.c
>> @@ -59,14 +59,17 @@ int chld1_sem(void *arg)
>>   	int id;
>>   	struct sembuf sm;
>>
>> -	id = semget(TESTKEY, 1, IPC_CREAT);
>> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR|IPC_EXCL);
>>   	if (id == -1) {
>>   		perror("semget");
>>   		return 2;
>>   	}
>>
>> -	if (semctl(id, 0, SETVAL, 1) == -1) {
>> -		perror("semctl");
>> +	sm.sem_num = 0;
>> +	sm.sem_op = 1;
>> +	sm.sem_flg = IPC_NOWAIT;
>> +	if (semop(id, &sm, 1) == -1) {
>> +		perror("semop");
>>   		semctl(id, 0, IPC_RMID);
>>   		return 2;
>>   	}
>> @@ -74,9 +77,7 @@ int chld1_sem(void *arg)
>>   	/* tell child2 to continue and wait for it to create the semaphore */
>>   	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>>
>> -	sm.sem_num = 0;
>>   	sm.sem_op = -1;
>> -	sm.sem_flg = IPC_NOWAIT;
>>   	if (semop(id, &sm, 1) == -1) {
>>   		perror("semop");
>>   		semctl(id, 0, IPC_RMID);
>> @@ -101,14 +102,19 @@ int chld2_sem(void *arg)
>>   	/* wait for child1 to create the semaphore */
>>   	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
>>
>> -	id = semget(TESTKEY, 1, IPC_CREAT);
>> +	/* IPC_EXCL is excluded because we do not want semget call to fail
>> +	 * if namespaces logic doesn't work correctly */
>> +	id = semget(TESTKEY, 1, IPC_CREAT|S_IRUSR|S_IWUSR);
>>   	if (id == -1) {
>>   		perror("semget");
>>   		return 2;
>>   	}
>>
>> -	if (semctl(id, 0, SETVAL, 1) == -1) {
>> -		perror("semctl");
>> +	sm.sem_num = 0;
>> +	sm.sem_op = 1;
>> +	sm.sem_flg = IPC_NOWAIT;
>> +	if (semop(id, &sm, 1) == -1) {
>> +		perror("semop");
>>   		semctl(id, 0, IPC_RMID);
>>   		return 2;
>>   	}
>> @@ -116,9 +122,7 @@ int chld2_sem(void *arg)
>>   	/* tell child1 to continue and wait for it to lock the semaphore */
>>   	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
>>
>> -	sm.sem_num = 0;
>>   	sm.sem_op = -1;
>> -	sm.sem_flg = IPC_NOWAIT;
>>   	if (semop(id, &sm, 1) == -1) {
>>   		if (errno == EAGAIN) {
>>   			rval = 1;
>> --
>> 1.8.3.1
>>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2015-04-21 10:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 17:52 [LTP] [PATCH] containers: semctl replaced with semop in sysvipc/sem_comm.c Matus Marhefka
2015-02-26  9:06 ` Cyril Hrubis
2015-02-26 12:57 ` [LTP] [PATCH v2] " Matus Marhefka
2015-02-26 13:22   ` Jan Stancek
2015-04-20 10:28     ` Matus Marhefka
2015-04-21  9:21       ` Stanislav Kholmanskikh
2015-04-21 10:12         ` Matus Marhefka

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