It's required by the semctl() API plus without that the test
case may fail on 64-bit Big Endian systems (like sparc64).

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmansk...@oracle.com>
---
 testcases/kernel/containers/sysvipc/sem_comm.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c 
b/testcases/kernel/containers/sysvipc/sem_comm.c
index 157ba0c..3d7e7bb 100644
--- a/testcases/kernel/containers/sysvipc/sem_comm.c
+++ b/testcases/kernel/containers/sysvipc/sem_comm.c
@@ -36,6 +36,7 @@
 #include "safe_macros.h"
 #include "libclone.h"
 #include "ipcns_helper.h"
+#include "lapi/semun.h"
 
 #define TESTKEY 124426L
 char *TCID     = "sem_comm";
@@ -57,6 +58,7 @@ static void setup(void)
 int chld1_sem(void *arg)
 {
        int id;
+       union semun su;
        struct sembuf sm;
 
        id = semget(TESTKEY, 1, IPC_CREAT);
@@ -65,7 +67,8 @@ int chld1_sem(void *arg)
                return 2;
        }
 
-       if (semctl(id, 0, SETVAL, 1) == -1) {
+       su.val = 1;
+       if (semctl(id, 0, SETVAL, su) == -1) {
                perror("semctl");
                semctl(id, 0, IPC_RMID);
                return 2;
@@ -97,6 +100,7 @@ int chld2_sem(void *arg)
 {
        int id, rval = 0;
        struct sembuf sm;
+       union semun su;
 
        /* wait for child1 to create the semaphore */
        TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
@@ -107,7 +111,8 @@ int chld2_sem(void *arg)
                return 2;
        }
 
-       if (semctl(id, 0, SETVAL, 1) == -1) {
+       su.val = 1;
+       if (semctl(id, 0, SETVAL, su) == -1) {
                perror("semctl");
                semctl(id, 0, IPC_RMID);
                return 2;
-- 
1.7.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

Reply via email to