- /* _GNU_SOURCE is needed for struct shm_info.used_ids on musl libc */
-# define _GNU_SOURCE
-
- /* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */
- /* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */
- /* X/OPEN tells us to use <sys/{types,ipc,shm}.h> for shmctl() */
-# include <sys/types.h>
-# include <sys/ipc.h>
-# include <sys/sem.h>
-# include <sys/msg.h>
-# include <sys/shm.h>
-
- /* For older kernels the same holds for the defines below */
-# ifndef MSG_STAT
-# define MSG_STAT 11
-# define MSG_INFO 12
-# endif
-
-# ifndef SHM_STAT
-# define SHM_STAT 13
-# define SHM_INFO 14
- struct shm_info {
- int used_ids;
- ulong shm_tot; /* total allocated shm */
- ulong shm_rss; /* total resident shm */
- ulong shm_swp; /* total swapped shm */
- ulong swap_attempts;
- ulong swap_successes;
- };
-# endif
-
-# ifndef SEM_STAT
-# define SEM_STAT 18
-# define SEM_INFO 19
-# endif
-
- /* The last arg of semctl is a union semun, but where is it defined?
- X/OPEN tells us to define it ourselves, but until recently
- Linux include files would also define it. */
-# 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;
- struct semid_ds *buf;
- unsigned short *array;
- struct seminfo *__buf;
- };
-# endif
+/* _GNU_SOURCE is needed for struct shm_info.used_ids on musl libc */
+#define _GNU_SOURCE
+
+/* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */
+/* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */
+/* X/OPEN tells us to use <sys/{types,ipc,shm}.h> for shmctl() */
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
+#include <sys/types.h>
+
+/* For older kernels the same holds for the defines below */
+#ifndef MSG_STAT
+#define MSG_STAT 11
+#define MSG_INFO 12
+#endif
+
+#ifndef SHM_STAT
+#define SHM_STAT 13
+#define SHM_INFO 14
+struct shm_info {
+ int used_ids;
+ ulong shm_tot; /* total allocated shm */
+ ulong shm_rss; /* total resident shm */
+ ulong shm_swp; /* total swapped shm */
+ ulong swap_attempts;
+ ulong swap_successes;
+};
+#endif
+
+#ifndef SEM_STAT
+#define SEM_STAT 18
+#define SEM_INFO 19
+#endif
+
+/* The last arg of semctl is a union semun, but where is it defined?
+ X/OPEN tells us to define it ourselves, but until recently
+ Linux include files would also define it. */
+#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;
+ struct semid_ds *buf;
+ unsigned short *array;
+ struct seminfo *__buf;
+};
+#endif