ipc: use printxval for printing key

Convert explicit constant printing logic into a printxval call in order
to account for xlat style setting.

* defs.h (ipc_private): New xlat array declaration.
* ipc_msg.c (SYS_FUNC(msgget)): Use printxval for printing IPC_PRIVATE.
* ipc_sem.c (SYS_FUNC(semtimedop)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* xlat/ipc_private.in: New file.
This commit is contained in:
Eugene Syromyatnikov 2018-03-10 06:17:11 +01:00
parent b416f61c3e
commit a465477fc7
5 changed files with 6 additions and 15 deletions

1
defs.h
View File

@ -299,6 +299,7 @@ extern const struct xlat evdev_abs[];
extern const struct xlat iffflags[];
extern const struct xlat inet_protocols[];
extern const struct xlat ip_type_of_services[];
extern const struct xlat ipc_private[];
extern const struct xlat msg_flags[];
extern const struct xlat netlink_protocols[];
extern const struct xlat nl_netfilter_msg_types[];

View File

@ -41,15 +41,12 @@
#endif
#include "xlat/ipc_msg_flags.h"
#include "xlat/ipc_private.h"
#include "xlat/resource_flags.h"
SYS_FUNC(msgget)
{
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
tprints(", ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");

View File

@ -103,11 +103,7 @@ SYS_FUNC(semtimedop)
SYS_FUNC(semget)
{
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
tprintf(", %d, ", (int) tcp->u_arg[1]);
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");

View File

@ -52,11 +52,7 @@
SYS_FUNC(shmget)
{
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
unsigned int flags = tcp->u_arg[2] & ~0777;

1
xlat/ipc_private.in Normal file
View File

@ -0,0 +1 @@
IPC_PRIVATE 0