[PATCH] support C libs w/out System V shared memory/ipc
Dmitry V. Levin
ldv at altlinux.org
Tue Nov 24 05:35:43 UTC 2015
Hi,
On Sat, Oct 31, 2015 at 04:57:04PM +0300, Dmitry V. Levin wrote:
> On Sat, Oct 31, 2015 at 12:47:53AM -0400, Mike Frysinger wrote:
> > diff --git a/ipc_msg.c b/ipc_msg.c
> > index 55747cb..2fc7470 100644
> > --- a/ipc_msg.c
> > +++ b/ipc_msg.c
> > @@ -31,9 +31,7 @@
> > */
> >
> > #include "defs.h"
> > -
> > -#include <sys/ipc.h>
> > -#include <sys/msg.h>
> > +#include "ipc_defs.h"
> >
> > #include "xlat/ipc_msg_flags.h"
> > #include "xlat/resource_flags.h"
>
> I suppose <sys/msg.h> is required for "xlat/ipc_msg_flags.h"
>
> > diff --git a/ipc_shm.c b/ipc_shm.c
> > index 4a41690..03f38ab 100644
> > --- a/ipc_shm.c
> > +++ b/ipc_shm.c
> > @@ -32,8 +32,6 @@
> >
> > #include "defs.h"
> >
> > -#include <sys/shm.h>
> > -
> > #include "xlat/shm_resource_flags.h"
> > #include "xlat/shm_flags.h"
>
> Likewise, <sys/shm.h> is required for "xlat/shm_resource_flags.h"
I'm going to push your patch with the following editions, if you don't mind.
--- a/configure.ac
+++ b/configure.ac
@@ -259,10 +259,6 @@ AC_CHECK_FUNCS(m4_normalize([
]))
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
- asm/ipcbuf.h
- asm/msgbuf.h
- asm/sembuf.h
- asm/shmbuf.h
asm/sysmips.h
bluetooth/bluetooth.h
elf.h
@@ -275,7 +271,6 @@ AC_CHECK_HEADERS(m4_normalize([
linux/ip_vs.h
linux/ipc.h
linux/mmtimer.h
- linux/mqueue.h
linux/msg.h
linux/perf_event.h
linux/seccomp.h
@@ -301,6 +296,7 @@ AC_CHECK_HEADERS(m4_normalize([
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>
--- a/ipc_defs.h
+++ b/ipc_defs.h
@@ -27,7 +27,7 @@
#ifdef HAVE_SYS_IPC_H
# include <sys/ipc.h>
-#elif defined(HAVE_LINUX_IPC_H)
+#elif defined HAVE_LINUX_IPC_H
# include <linux/ipc.h>
/* While glibc uses __key, the kernel uses key. */
# define __key key
--- a/ipc_msg.c
+++ b/ipc_msg.c
@@ -33,6 +33,12 @@
#include "defs.h"
#include "ipc_defs.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"
--- a/ipc_msgctl.c
+++ b/ipc_msgctl.c
@@ -31,22 +31,21 @@
*/
#include "defs.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_ASM_MSGBUF_H)
-/* The asm header provides the 64bit struct directly for us. */
-# include <asm/msgbuf.h>
-typedef struct msqid64_ds msqid_ds_t;
-#elif defined(HAVE_LINUX_MSG_H)
+#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 DEF_MPERS_TYPE(msqid_ds_t)
+
#include MPERS_DEFS
#include "xlat/msgctl_flags.h"
--- a/ipc_sem.c
+++ b/ipc_sem.c
@@ -35,14 +35,14 @@
#ifdef HAVE_SYS_SEM_H
# include <sys/sem.h>
-#elif defined(HAVE_LINUX_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_SHM_H) || defined(HAVE_LINUX_SEM_H)
+#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
static void
tprint_sembuf(const struct sembuf *sb)
{
@@ -55,7 +55,7 @@ tprint_sembuf(const struct sembuf *sb)
static void
tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
{
-#if defined(HAVE_SYS_SHM_H) || defined(HAVE_LINUX_SEM_H)
+#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
unsigned long max_count;
struct sembuf sb;
--- a/ipc_shm.c
+++ b/ipc_shm.c
@@ -32,6 +32,12 @@
#include "defs.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"
--- a/ipc_shmctl.c
+++ b/ipc_shmctl.c
@@ -31,22 +31,21 @@
*/
#include "defs.h"
-#include "ipc_defs.h"
#include DEF_MPERS_TYPE(shmid_ds_t)
+
+#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_ASM_SHMBUF_H)
-/* The asm header provides the 64bit struct directly for us. */
-# include <asm/shmbuf.h>
-typedef struct shmid64_ds shmid_ds_t;
-#elif defined(HAVE_LINUX_SHM_H)
+#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"
--- a/print_mq_attr.c
+++ b/print_mq_attr.c
@@ -29,20 +29,21 @@
#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)
+#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;
@@ -51,5 +52,7 @@ MPERS_PRINTER_DECL(void, printmqattr)(struct tcb *tcp, const long addr)
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
}
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20151124/2d2d9f87/attachment.bin>
More information about the Strace-devel
mailing list