linux/filter.h
linux/hiddev.h
linux/ip_vs.h
+ linux/ipc.h
linux/mmtimer.h
+ linux/msg.h
linux/perf_event.h
linux/seccomp.h
linux/securebits.h
+ linux/sem.h
+ linux/shm.h
linux/utsname.h
mqueue.h
netinet/sctp.h
sys/eventfd.h
sys/fanotify.h
sys/ioctl.h
+ sys/ipc.h
+ sys/msg.h
sys/reg.h
+ sys/sem.h
+ sys/shm.h
sys/signalfd.h
sys/vfs.h
sys/xattr.h
]))
+AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
[], [], [#include <stddef.h>
#include <sys/socket.h>
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/ipc.h>
+#ifdef HAVE_SYS_IPC_H
+# include <sys/ipc.h>
+#elif defined HAVE_LINUX_IPC_H
+# include <linux/ipc.h>
+/* While glibc uses __key, the kernel uses key. */
+# define __key key
+#endif
#if !defined IPC_64
# define IPC_64 0x100
*/
#include "defs.h"
+#include "ipc_defs.h"
-#include <sys/ipc.h>
-#include <sys/msg.h>
+#ifdef HAVE_SYS_MSG_H
+# include <sys/msg.h>
+#elif defined HAVE_LINUX_MSG_H
+# include <linux/msg.h>
+#endif
#include "xlat/ipc_msg_flags.h"
#include "xlat/resource_flags.h"
*/
#include "defs.h"
-#include "ipc_defs.h"
-#include <sys/msg.h>
#include DEF_MPERS_TYPE(msqid_ds_t)
+
+#include "ipc_defs.h"
+
+#ifdef HAVE_SYS_MSG_H
+/* The C library generally exports the struct the current kernel expects. */
+# include <sys/msg.h>
typedef struct msqid_ds msqid_ds_t;
+#elif defined HAVE_LINUX_MSG_H
+/* The linux header might provide the right struct. */
+# include <linux/msg.h>
+typedef struct msqid64_ds msqid_ds_t;
+#endif
+
#include MPERS_DEFS
#include "xlat/msgctl_flags.h"
static void
print_msqid_ds(struct tcb *tcp, const long addr, int cmd)
{
+ /* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
cmd &= ~IPC_64;
msqid_ds_t msqid_ds;
#include "defs.h"
#include "ipc_defs.h"
-#include <sys/sem.h>
+#ifdef HAVE_SYS_SEM_H
+# include <sys/sem.h>
+#elif defined HAVE_LINUX_SEM_H
+# include <linux/sem.h>
+#endif
#include "xlat/semctl_flags.h"
#include "xlat/semop_flags.h"
+#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
static void
tprint_sembuf(const struct sembuf *sb)
{
printflags(semop_flags, sb->sem_flg, "SEM_???");
tprints("}");
}
+#endif
static void
tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
{
+#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
unsigned long max_count;
struct sembuf sb;
tprints("]");
}
+#else
+ printaddr(addr);
+#endif
tprintf(", %lu", count);
}
#include "defs.h"
-#include <sys/shm.h>
+#ifdef HAVE_SYS_SHM_H
+# include <sys/shm.h>
+#elif defined HAVE_LINUX_SHM_H
+# include <linux/shm.h>
+#endif
#include "xlat/shm_resource_flags.h"
#include "xlat/shm_flags.h"
*/
#include "defs.h"
-#include "ipc_defs.h"
-
-#include <sys/shm.h>
#include DEF_MPERS_TYPE(shmid_ds_t)
-#include <sys/shm.h>
+
+#include "ipc_defs.h"
+
+#ifdef HAVE_SYS_SHM_H
+/* The C library generally exports the struct the current kernel expects. */
+# include <sys/shm.h>
typedef struct shmid_ds shmid_ds_t;
+#elif defined HAVE_LINUX_SHM_H
+/* The linux header might provide the right struct. */
+# include <linux/shm.h>
+typedef struct shmid64_ds shmid_ds_t;
+#endif
+
#include MPERS_DEFS
#include "xlat/shmctl_flags.h"
static void
print_shmid_ds(struct tcb *tcp, const long addr, int cmd)
{
+ /* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
cmd &= ~IPC_64;
shmid_ds_t shmid_ds;
#include "defs.h"
#include DEF_MPERS_TYPE(mq_attr_t)
+
#ifdef HAVE_MQUEUE_H
# include <mqueue.h>
typedef struct mq_attr mq_attr_t;
+#elif defined HAVE_LINUX_MQUEUE_H
+# include <linux/types.h>
+# include <linux/mqueue.h>
+typedef struct mq_attr mq_attr_t;
#endif
+
#include MPERS_DEFS
MPERS_PRINTER_DECL(void, printmqattr)(struct tcb *tcp, const long addr)
{
-# ifndef HAVE_MQUEUE_H
- printaddr(addr);
-# else
+#if defined HAVE_MQUEUE_H || defined HAVE_LINUX_MQUEUE_H
mq_attr_t attr;
if (umove_or_printaddr(tcp, addr, &attr))
return;
tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
(long) attr.mq_maxmsg, (long) attr.mq_msgsize,
(long) attr.mq_curmsgs);
-# endif
+#else
+ printaddr(addr);
+#endif
}