ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
/*
* Copyright ( c ) 1993 Ulrich Pegelow < pegelow @ moorea . uni - muenster . de >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
* Copyright ( c ) 2003 - 2006 Roland McGrath < roland @ redhat . com >
* Copyright ( c ) 2006 - 2015 Dmitry V . Levin < ldv @ altlinux . org >
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "defs.h"
# include "ipc_defs.h"
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
# ifdef HAVE_SYS_SEM_H
# include <sys / sem.h>
# elif defined HAVE_LINUX_SEM_H
# include <linux / sem.h>
# endif
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
# include "xlat/semctl_flags.h"
# include "xlat/semop_flags.h"
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
# if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
2016-05-08 01:56:59 +03:00
static bool
print_sembuf ( struct tcb * tcp , void * elem_buf , size_t elem_size , void * data )
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
{
2016-05-08 01:56:59 +03:00
const struct sembuf * sb = elem_buf ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
tprintf ( " {%u, %d, " , sb - > sem_num , sb - > sem_op ) ;
2016-05-17 01:00:46 +03:00
printflags ( semop_flags , ( unsigned short ) sb - > sem_flg , " SEM_??? " ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
tprints ( " } " ) ;
2016-05-08 01:56:59 +03:00
return true ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
}
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
# endif
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
static void
2016-09-09 22:13:54 +03:00
tprint_sembuf_array ( struct tcb * tcp , const long addr , const unsigned int count )
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
{
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
# if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
struct sembuf sb ;
2016-05-08 01:56:59 +03:00
print_array ( tcp , addr , count , & sb , sizeof ( sb ) ,
umoven_or_printaddr , print_sembuf , 0 ) ;
Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code. That
means no C library headers for strace to include. Add configure tests
to probe the headers from the kernel and use them when they are
available.
It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.
* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available. Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available. Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available. Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-10-31 07:47:53 +03:00
# else
printaddr ( addr ) ;
# endif
2016-09-09 22:13:54 +03:00
tprintf ( " , %u " , count ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
}
SYS_FUNC ( semop )
{
2016-09-07 15:41:17 +03:00
tprintf ( " %d, " , ( int ) tcp - > u_arg [ 0 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
if ( indirect_ipccall ( tcp ) ) {
tprint_sembuf_array ( tcp , tcp - > u_arg [ 3 ] , tcp - > u_arg [ 1 ] ) ;
} else {
tprint_sembuf_array ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] ) ;
}
return RVAL_DECODED ;
}
SYS_FUNC ( semtimedop )
{
2016-09-07 15:41:17 +03:00
tprintf ( " %d, " , ( int ) tcp - > u_arg [ 0 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
if ( indirect_ipccall ( tcp ) ) {
tprint_sembuf_array ( tcp , tcp - > u_arg [ 3 ] , tcp - > u_arg [ 1 ] ) ;
tprints ( " , " ) ;
# if defined(S390) || defined(S390X)
2015-09-18 18:16:11 +03:00
print_timespec ( tcp , tcp - > u_arg [ 2 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
# else
2015-09-18 18:16:11 +03:00
print_timespec ( tcp , tcp - > u_arg [ 4 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
# endif
} else {
tprint_sembuf_array ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] ) ;
tprints ( " , " ) ;
2015-09-18 18:16:11 +03:00
print_timespec ( tcp , tcp - > u_arg [ 3 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
}
return RVAL_DECODED ;
}
SYS_FUNC ( semget )
{
2016-09-08 15:49:35 +03:00
const int key = ( int ) tcp - > u_arg [ 0 ] ;
if ( key )
tprintf ( " %#x " , key ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
else
tprints ( " IPC_PRIVATE " ) ;
2016-09-07 15:41:17 +03:00
tprintf ( " , %d, " , ( int ) tcp - > u_arg [ 1 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
if ( printflags ( resource_flags , tcp - > u_arg [ 2 ] & ~ 0777 , NULL ) ! = 0 )
tprints ( " | " ) ;
2016-08-03 17:05:39 +03:00
print_numeric_umode_t ( tcp - > u_arg [ 2 ] & 0777 ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
return RVAL_DECODED ;
}
SYS_FUNC ( semctl )
{
2016-09-07 15:41:17 +03:00
tprintf ( " %d, %d, " , ( int ) tcp - > u_arg [ 0 ] , ( int ) tcp - > u_arg [ 1 ] ) ;
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
PRINTCTL ( semctl_flags , tcp - > u_arg [ 2 ] , " SEM_??? " ) ;
tprints ( " , " ) ;
2016-08-18 00:58:37 +03:00
if ( indirect_ipccall ( tcp )
# ifdef SPARC64
& & current_personality ! = 0
# endif
) {
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-19 05:06:26 +03:00
printnum_ptr ( tcp , tcp - > u_arg [ 3 ] ) ;
} else {
tprintf ( " %#lx " , tcp - > u_arg [ 3 ] ) ;
}
return RVAL_DECODED ;
}