mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
selftests/ipc: Fix msgque compiler warnings
[ Upstream commita147faa96f] 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:3a665531a3("selftests: IPC message queue copy feature test") Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
da4c428a82
commit
938251ee1e
@@ -1,9 +1,10 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/msg.h>
|
#include <sys/msg.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "../kselftest.h"
|
#include "../kselftest.h"
|
||||||
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
destroy:
|
destroy:
|
||||||
if (msgctl(id, IPC_RMID, 0))
|
if (msgctl(id, IPC_RMID, NULL))
|
||||||
printf("Failed to destroy queue: %d\n", -errno);
|
printf("Failed to destroy queue: %d\n", -errno);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err:
|
err:
|
||||||
if (msgctl(msgque->msq_id, IPC_RMID, 0)) {
|
if (msgctl(msgque->msq_id, IPC_RMID, NULL)) {
|
||||||
printf("Failed to destroy queue: %d\n", -errno);
|
printf("Failed to destroy queue: %d\n", -errno);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
@@ -129,7 +130,7 @@ err:
|
|||||||
|
|
||||||
int dump_queue(struct msgque_data *msgque)
|
int dump_queue(struct msgque_data *msgque)
|
||||||
{
|
{
|
||||||
struct msqid64_ds ds;
|
struct msqid_ds ds;
|
||||||
int kern_id;
|
int kern_id;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
@@ -245,7 +246,7 @@ int main(int argc, char **argv)
|
|||||||
return ksft_exit_pass();
|
return ksft_exit_pass();
|
||||||
|
|
||||||
err_destroy:
|
err_destroy:
|
||||||
if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
|
if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
|
||||||
printf("Failed to destroy queue: %d\n", -errno);
|
printf("Failed to destroy queue: %d\n", -errno);
|
||||||
return ksft_exit_fail();
|
return ksft_exit_fail();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user