@@ -29,7 +29,7 @@
#include <sys/sem.h>
#include "test.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
void cleanup(void);
void setup(void);
new file mode 100644
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2015 Linux Test Project
+ */
+
+#include <sys/sem.h>
+
+#ifndef LAPI_SEM_H
+#define LAPI_SEM_H
+
+#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
+/* union semun is defined by including <sys/sem.h> */
+#else
+/* according to X/OPEN we have to define it ourselves */
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
+ unsigned short *array; /* array for GETALL, SETALL */
+ /* Linux specific part: */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+};
+#endif
+
+#ifndef SEM_STAT_ANY
+# define SEM_STAT_ANY 20
+#endif
+
+#endif /* LAPI_SEM_H */
deleted file mode 100644
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2015 Linux Test Project
- */
-
-#ifndef SEMUN_H__
-#define SEMUN_H__
-
-#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
-/* union semun is defined by including <sys/sem.h> */
-#else
-/* according to X/OPEN we have to define it ourselves */
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
- unsigned short *array; /* array for GETALL, SETALL */
- /* Linux specific part: */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-#endif
-
-#endif /* SEMUN_H__ */
@@ -27,7 +27,6 @@
#define _GNU_SOURCE
#include <sys/ipc.h>
-#include <sys/sem.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
@@ -35,7 +34,7 @@
#include "ipcns_helper.h"
#include "test.h"
#include "safe_macros.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
#define TESTKEY 124426L
char *TCID = "sem_comm";
@@ -47,13 +47,12 @@
#include <string.h>
#include <signal.h>
#include <sys/stat.h>
-#include <sys/sem.h>
#include "tlibio.h"
#include "test.h"
#include "safe_macros.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
char *TCID = "pipeio";
int TST_TOTAL = 1;
@@ -40,8 +40,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/ipc.h>
-#include <sys/sem.h>
-#include "lapi/semun.h"
+#include "lapi/sem.h"
int verbose = 0;
int loops = 100;
@@ -45,12 +45,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <sys/sem.h>
#include <errno.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/ipc.h>
-#include "lapi/semun.h"
+#include "lapi/sem.h"
#include "test.h"
#define KEY IPC_PRIVATE
@@ -40,11 +40,10 @@
#include <sys/msg.h>
#include <sys/resource.h>
#include <sys/select.h>
-#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include "lapi/semun.h"
+#include "lapi/sem.h"
/* indexes into environment variable array */
#define ADBG 0
@@ -6,7 +6,7 @@
* Cross verify the _high fields being set to 0 by the kernel.
*/
#include "lapi/sembuf.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
#include "tst_test.h"
#include "libnewipc.h"
@@ -8,10 +8,9 @@
*/
#include <stdlib.h>
-#include <sys/sem.h>
#include "tst_test.h"
#include "libnewipc.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
#include "semop.h"
#define NSEMS 4
@@ -22,10 +22,9 @@
#define _GNU_SOURCE
#include <pwd.h>
#include <sys/ipc.h>
-#include <sys/sem.h>
#include "tst_test.h"
#include "libnewipc.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
#include "semop.h"
static int valid_sem_id = -1;
@@ -11,10 +11,9 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <sys/sem.h>
#include "tst_test.h"
#include "libnewipc.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
#include "semop.h"
static key_t semkey;
@@ -34,7 +34,6 @@
#define _GNU_SOURCE
#include <sys/ipc.h>
#include <sys/stat.h>
-#include <sys/sem.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
@@ -45,7 +44,7 @@
#include "config.h"
#include "test.h"
#include "safe_macros.h"
-#include "lapi/semun.h"
+#include "lapi/sem.h"
char *TCID = "sendmsg02";