aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2019-04-08 13:13:44 -0400
committerShuah Khan <skhan@linuxfoundation.org>2019-04-19 19:18:00 -0400
commita147faa96f832f76e772b1e448e94ea84c774081 (patch)
tree71ac764454f523ba76bc81308a27a22626daedc0
parentdff6d2ae56d0056261e2f7b19c4b96b86b893cd8 (diff)
selftests/ipc: Fix msgque compiler warnings
This fixes the various compiler warnings when building the msgque selftest. The primary change is using sys/msg.h instead of linux/msg.h directly to gain the API declarations. Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test") Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-rw-r--r--tools/testing/selftests/ipc/msgque.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index dac927e82336..4c156aeab6b8 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -1,9 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#define _GNU_SOURCE
2#include <stdlib.h> 3#include <stdlib.h>
3#include <stdio.h> 4#include <stdio.h>
4#include <string.h> 5#include <string.h>
5#include <errno.h> 6#include <errno.h>
6#include <linux/msg.h> 7#include <sys/msg.h>
7#include <fcntl.h> 8#include <fcntl.h>
8 9
9#include "../kselftest.h" 10#include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)
73 return 0; 74 return 0;
74 75
75destroy: 76destroy:
76 if (msgctl(id, IPC_RMID, 0)) 77 if (msgctl(id, IPC_RMID, NULL))
77 printf("Failed to destroy queue: %d\n", -errno); 78 printf("Failed to destroy queue: %d\n", -errno);
78 return ret; 79 return ret;
79} 80}
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
120 121
121 ret = 0; 122 ret = 0;
122err: 123err:
123 if (msgctl(msgque->msq_id, IPC_RMID, 0)) { 124 if (msgctl(msgque->msq_id, IPC_RMID, NULL)) {
124 printf("Failed to destroy queue: %d\n", -errno); 125 printf("Failed to destroy queue: %d\n", -errno);
125 return -errno; 126 return -errno;
126 } 127 }
@@ -129,7 +130,7 @@ err:
129 130
130int dump_queue(struct msgque_data *msgque) 131int dump_queue(struct msgque_data *msgque)
131{ 132{
132 struct msqid64_ds ds; 133 struct msqid_ds ds;
133 int kern_id; 134 int kern_id;
134 int i, ret; 135 int i, ret;
135 136
@@ -245,7 +246,7 @@ int main(int argc, char **argv)
245 return ksft_exit_pass(); 246 return ksft_exit_pass();
246 247
247err_destroy: 248err_destroy:
248 if (msgctl(msgque.msq_id, IPC_RMID, 0)) { 249 if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
249 printf("Failed to destroy queue: %d\n", -errno); 250 printf("Failed to destroy queue: %d\n", -errno);
250 return ksft_exit_fail(); 251 return ksft_exit_fail();
251 } 252 }