All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] msgrcv/msgrcv08.c: Use struct msgbuf defined in <sys/msg.h>
@ 2019-03-20 21:57 Petr Vorel
  2019-03-21  9:51 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2019-03-20 21:57 UTC (permalink / raw)
  To: ltp

which requires to define _GNU_SOURCE.
This fixes MUSL build.

NOTE: char array from struct has usually length 1, the one from test had 16,
but that's not a limitation.

Fixes: eccd238da ("ipc/msgrcv: add new testcase msgrcv08")

Reported-by: Dengke Du <dengke.du@windriver.com>
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
Hi Li,

what was the reason to use size 16?

Kind regards,
Petr

PS: I found and fix this error independently while working on MUSL build
fixes, but than found it was reported by Dengke Du in PR #177 [1].

[1] https://github.com/linux-test-project/ltp/pull/177/commits/87c4a4ae2817f835a594ab795dc938a27c642b92
---
 testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
index a757c0d18..21d77c9dd 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
@@ -35,6 +35,7 @@
  *      If this progarm is compiled as 64-bit application it works.
  */
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -48,11 +49,6 @@ const int TST_TOTAL = 1;
 
 #if __WORDSIZE == 32
 
-struct msgbuf {
-	long mtype;     /* message type, must be > 0 */
-	char mtext[16]; /* message data */
-};
-
 static void msr(int msqid)
 {
 	struct msgbuf msbs;
-- 
2.21.0


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

* [LTP] [PATCH 1/1] msgrcv/msgrcv08.c: Use struct msgbuf defined in <sys/msg.h>
  2019-03-20 21:57 [LTP] [PATCH 1/1] msgrcv/msgrcv08.c: Use struct msgbuf defined in <sys/msg.h> Petr Vorel
@ 2019-03-21  9:51 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2019-03-21  9:51 UTC (permalink / raw)
  To: ltp

Hi!
> which requires to define _GNU_SOURCE.
> This fixes MUSL build.
> 
> NOTE: char array from struct has usually length 1, the one from test had 16,
> but that's not a limitation.
> 
> Fixes: eccd238da ("ipc/msgrcv: add new testcase msgrcv08")

It does not matter much here, but actually the structure is supposed to
be user defined, see the msgrcv manual page and you are supposed to pick
the message buffer length accordingly to your needs.

I guess that slightly better fix would be renaming the structure name,
the rest of the msgctl tests uses struct mbuf instead.

-- 
Cyril Hrubis
chrubis@suse.cz

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

end of thread, other threads:[~2019-03-21  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 21:57 [LTP] [PATCH 1/1] msgrcv/msgrcv08.c: Use struct msgbuf defined in <sys/msg.h> Petr Vorel
2019-03-21  9:51 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.