summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-07-18 08:00:00 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-07-18 08:00:00 +0000
commit2ce9e7ec85182c9cee9e599acd67ce0b6cfea9de (patch)
treea19a133a83aebef59475a460aff393674855942c
parent03a436fdfb0482f1e228124260ec6dbe0421c35b (diff)
downloadstrace-2ce9e7ec85182c9cee9e599acd67ce0b6cfea9de.tar.gz
Consistently print process ids as signed integers
* block.c (block_ioctl): Print struct_blk_user_trace_setup.pid using PRINT_FIELD_D instead of PRINT_FIELD_U. * bpf.c (BPF_TASK_FD_QUERY): Print task_fd_query.pid using PRINT_FIELD_D instead of PRINT_FIELD_U. * ipc_msgctl.c (print_msqid_ds): Print msqid_ds.msg_lspid and msqid_ds.msg_lrpid using PRINT_FIELD_D. * ipc_shmctl.c (print_shmid_ds): Print shmid_ds.shm_cpid and shm_lpid using PRINT_FIELD_D. * msghdr.c (print_scm_creds): Print ucred.pid using PRINT_FIELD_D instead of PRINT_FIELD_U. * netlink.c (print_nlmsghdr): Print nlmsghdr.nlmsg_pid using %d format instead of %u. * tests/bpf.c (BPF_TASK_FD_QUERY_checks): Update expected output. * tests/ioctl_block.c (main): Update expected output. * tests/ipc_msg.c (main): Likewise. * tests/ipc_shm.c (main): Likewise. * tests/net-yy-netlink.c (main): Likewise. * tests/netlink_protocol.c (test_nlmsgerr): Likewise.
-rw-r--r--block.c2
-rw-r--r--bpf.c2
-rw-r--r--ipc_msgctl.c4
-rw-r--r--ipc_shmctl.c4
-rw-r--r--msghdr.c2
-rw-r--r--netlink.c2
-rw-r--r--tests/bpf.c8
-rw-r--r--tests/ioctl_block.c2
-rw-r--r--tests/ipc_msg.c6
-rw-r--r--tests/ipc_shm.c8
-rw-r--r--tests/net-yy-netlink.c4
-rw-r--r--tests/netlink_protocol.c4
12 files changed, 24 insertions, 24 deletions
diff --git a/block.c b/block.c
index 893269d09..a2f415510 100644
--- a/block.c
+++ b/block.c
@@ -179,7 +179,7 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
PRINT_FIELD_U(", ", buts, buf_nr);
PRINT_FIELD_U(", ", buts, start_lba);
PRINT_FIELD_U(", ", buts, end_lba);
- PRINT_FIELD_U(", ", buts, pid);
+ PRINT_FIELD_D(", ", buts, pid);
return 0;
} else {
struct_blk_user_trace_setup buts;
diff --git a/bpf.c b/bpf.c
index 469f809a5..b3ab9791b 100644
--- a/bpf.c
+++ b/bpf.c
@@ -927,7 +927,7 @@ BEGIN_BPF_CMD_DECODER(BPF_TASK_FD_QUERY)
if (entering(tcp)) {
set_tcb_priv_ulong(tcp, attr.buf_len);
- PRINT_FIELD_U("{task_fd_query={", attr, pid);
+ PRINT_FIELD_D("{task_fd_query={", attr, pid);
PRINT_FIELD_FD(", ", attr, fd, tcp);
PRINT_FIELD_U(", ", attr, flags);
PRINT_FIELD_U(", ", attr, buf_len);
diff --git a/ipc_msgctl.c b/ipc_msgctl.c
index cc20d7062..22ed13c5e 100644
--- a/ipc_msgctl.c
+++ b/ipc_msgctl.c
@@ -57,8 +57,8 @@ print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
tprintf(", msg_ctime=%u", (unsigned) msqid_ds.msg_ctime);
tprintf(", msg_qnum=%u", (unsigned) msqid_ds.msg_qnum);
tprintf(", msg_qbytes=%u", (unsigned) msqid_ds.msg_qbytes);
- tprintf(", msg_lspid=%u", (unsigned) msqid_ds.msg_lspid);
- tprintf(", msg_lrpid=%u", (unsigned) msqid_ds.msg_lrpid);
+ PRINT_FIELD_D(", ", msqid_ds, msg_lspid);
+ PRINT_FIELD_D(", ", msqid_ds, msg_lrpid);
tprints("}");
break;
diff --git a/ipc_shmctl.c b/ipc_shmctl.c
index c06fc4777..8c9e1e7a5 100644
--- a/ipc_shmctl.c
+++ b/ipc_shmctl.c
@@ -53,8 +53,8 @@ print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
PRINT_FIELD_UID(", ", shmid_ds.shm_perm, cgid);
tprints("}");
tprintf(", shm_segsz=%u", (unsigned) shmid_ds.shm_segsz);
- tprintf(", shm_cpid=%u", (unsigned) shmid_ds.shm_cpid);
- tprintf(", shm_lpid=%u", (unsigned) shmid_ds.shm_lpid);
+ PRINT_FIELD_D(", ", shmid_ds, shm_cpid);
+ PRINT_FIELD_D(", ", shmid_ds, shm_lpid);
tprintf(", shm_nattch=%u", (unsigned) shmid_ds.shm_nattch);
tprintf(", shm_atime=%u", (unsigned) shmid_ds.shm_atime);
tprintf(", shm_dtime=%u", (unsigned) shmid_ds.shm_dtime);
diff --git a/msghdr.c b/msghdr.c
index ec6e77f29..becbb5124 100644
--- a/msghdr.c
+++ b/msghdr.c
@@ -69,7 +69,7 @@ print_scm_creds(struct tcb *tcp, const void *cmsg_data,
{
const struct ucred *uc = cmsg_data;
- PRINT_FIELD_U("{", *uc, pid);
+ PRINT_FIELD_D("{", *uc, pid);
PRINT_FIELD_UID(", ", *uc, uid);
PRINT_FIELD_UID(", ", *uc, gid);
tprints("}");
diff --git a/netlink.c b/netlink.c
index 4b4ef448b..88d864a94 100644
--- a/netlink.c
+++ b/netlink.c
@@ -446,7 +446,7 @@ print_nlmsghdr(struct tcb *tcp,
decode_nlmsg_flags(nlmsghdr->nlmsg_flags,
nlmsghdr->nlmsg_type, family);
- tprintf(", seq=%u, pid=%u}", nlmsghdr->nlmsg_seq,
+ tprintf(", seq=%u, pid=%d}", nlmsghdr->nlmsg_seq,
nlmsghdr->nlmsg_pid);
}
diff --git a/tests/bpf.c b/tests/bpf.c
index 0965eb961..1b7e89fa5 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -1289,16 +1289,16 @@ static const struct bpf_attr_check BPF_BTF_GET_FD_BY_ID_checks[] = {
static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
{
- .data = { .BPF_TASK_FD_QUERY_data = { .pid = 0xdeadbeef } },
+ .data = { .BPF_TASK_FD_QUERY_data = { .pid = 1735928559 } },
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, pid),
- .str = "task_fd_query={pid=3735928559, fd=0" FD0_PATH
+ .str = "task_fd_query={pid=1735928559, fd=0" FD0_PATH
", flags=0, buf_len=0, buf=NULL, prog_id=0"
", fd_type=BPF_FD_TYPE_RAW_TRACEPOINT"
", probe_offset=0, probe_addr=0}"
},
{ /* 1 */
.data = { .BPF_TASK_FD_QUERY_data = {
- .pid = 0xcafef00d,
+ .pid = 1405705229,
.fd = 0xdeadbeef,
.flags = 0xfacefeed,
.buf_len = 0xdefaced,
@@ -1309,7 +1309,7 @@ static const struct bpf_attr_check BPF_TASK_FD_QUERY_checks[] = {
.probe_addr = 0xfac5fed5fac7fed8
} },
.size = offsetofend(struct BPF_TASK_FD_QUERY_struct, probe_addr),
- .str = "task_fd_query={pid=3405705229"
+ .str = "task_fd_query={pid=1405705229"
", fd=-559038737"
", flags=4207869677"
", buf_len=233811181"
diff --git a/tests/ioctl_block.c b/tests/ioctl_block.c
index 643daf871..67fee35c0 100644
--- a/tests/ioctl_block.c
+++ b/tests/ioctl_block.c
@@ -165,7 +165,7 @@ main(void)
ioctl(-1, BLKTRACESETUP, buts);
printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
- ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%u})"
+ ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%d})"
" = -1 EBADF (%m)\n",
buts->act_mask, buts->buf_size, buts->buf_nr,
buts->start_lba, buts->end_lba, buts->pid);
diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
index c5868da92..63bdd77d1 100644
--- a/tests/ipc_msg.c
+++ b/tests/ipc_msg.c
@@ -128,15 +128,15 @@ main(void)
printf("msgctl\\(%d, (%s\\|)?%s, \\{msg_perm=\\{uid=%u"
", gid=%u, mode=%#o, key=%u, cuid=%u, cgid=%u\\}, msg_stime=%u"
", msg_rtime=%u, msg_ctime=%u, msg_qnum=%u, msg_qbytes=%u"
- ", msg_lspid=%u, msg_lrpid=%u\\}\\) = 0\n",
+ ", msg_lspid=%d, msg_lrpid=%d\\}\\) = 0\n",
id, str_ipc_64, str_ipc_stat,
(unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
(unsigned) ds.msg_perm.mode, (unsigned) ds.msg_perm.__key,
(unsigned) ds.msg_perm.cuid, (unsigned) ds.msg_perm.cgid,
(unsigned) ds.msg_stime, (unsigned) ds.msg_rtime,
(unsigned) ds.msg_ctime, (unsigned) ds.msg_qnum,
- (unsigned) ds.msg_qbytes, (unsigned) ds.msg_lspid,
- (unsigned) ds.msg_lrpid);
+ (unsigned) ds.msg_qbytes, (int) ds.msg_lspid,
+ (int) ds.msg_lrpid);
if (msgctl(id, IPC_SET, &ds))
perror_msg_and_skip("msgctl IPC_SET");
diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c
index 296ee94ca..5cd414e30 100644
--- a/tests/ipc_shm.c
+++ b/tests/ipc_shm.c
@@ -168,15 +168,15 @@ main(void)
if (shmctl(id, IPC_STAT, &ds))
perror_msg_and_skip("shmctl IPC_STAT");
printf("shmctl\\(%d, (%s\\|)?%s, \\{shm_perm=\\{uid=%u, gid=%u, "
- "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%u, "
- "shm_lpid=%u, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
+ "mode=%#o, key=%u, cuid=%u, cgid=%u\\}, shm_segsz=%u, shm_cpid=%d, "
+ "shm_lpid=%d, shm_nattch=%u, shm_atime=%u, shm_dtime=%u, "
"shm_ctime=%u\\}\\) = 0\n",
id, str_ipc_64, str_ipc_stat,
(unsigned) ds.shm_perm.uid, (unsigned) ds.shm_perm.gid,
(unsigned) ds.shm_perm.mode, (unsigned) ds.shm_perm.__key,
(unsigned) ds.shm_perm.cuid, (unsigned) ds.shm_perm.cgid,
- (unsigned) ds.shm_segsz, (unsigned) ds.shm_cpid,
- (unsigned) ds.shm_lpid, (unsigned) ds.shm_nattch,
+ (unsigned) ds.shm_segsz, (int) ds.shm_cpid,
+ (int) ds.shm_lpid, (unsigned) ds.shm_nattch,
(unsigned) ds.shm_atime, (unsigned) ds.shm_dtime,
(unsigned) ds. shm_ctime);
diff --git a/tests/net-yy-netlink.c b/tests/net-yy-netlink.c
index 7567b6976..e2c955864 100644
--- a/tests/net-yy-netlink.c
+++ b/tests/net-yy-netlink.c
@@ -67,13 +67,13 @@ main(void)
if (bind(fd, sa, *len))
perror_msg_and_skip("bind");
printf("bind(%d" FMT_UNBOUND ", {sa_family=AF_NETLINK"
- ", nl_pid=%u, nl_groups=00000000}, %u) = 0\n",
+ ", nl_pid=%d, nl_groups=00000000}, %u) = 0\n",
fd, ARG_UNBOUND, addr.nl_pid, (unsigned) *len);
if (getsockname(fd, sa, len))
perror_msg_and_fail("getsockname");
printf("getsockname(%d" FMT_BOUND ", {sa_family=AF_NETLINK"
- ", nl_pid=%u, nl_groups=00000000}, [%u]) = 0\n",
+ ", nl_pid=%d, nl_groups=00000000}, [%u]) = 0\n",
fd, ARG_BOUND, addr.nl_pid, (unsigned) *len);
if (close(fd))
diff --git a/tests/netlink_protocol.c b/tests/netlink_protocol.c
index fd901d884..e632ba3fd 100644
--- a/tests/netlink_protocol.c
+++ b/tests/netlink_protocol.c
@@ -264,7 +264,7 @@ test_nlmsgerr(const int fd)
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
", seq=0, pid=0}, {error=-EACCES"
", msg={len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
- ", seq=%u, pid=%u}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
+ ", seq=%u, pid=%d}}}, %u, MSG_DONTWAIT, NULL, 0) = %s\n",
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
err->msg.nlmsg_seq, err->msg.nlmsg_pid,
nlh->nlmsg_len, sprintrc(rc));
@@ -289,7 +289,7 @@ test_nlmsgerr(const int fd)
printf("sendto(%d, {{len=%u, type=NLMSG_ERROR, flags=NLM_F_REQUEST"
", seq=0, pid=0}, {error=-EACCES"
", msg={{len=%u, type=NLMSG_NOOP, flags=NLM_F_REQUEST|0x%x"
- ", seq=%u, pid=%u}, \"\\x61\\x62\\x63\\x64\"}}}"
+ ", seq=%u, pid=%d}, \"\\x61\\x62\\x63\\x64\"}}}"
", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
fd, nlh->nlmsg_len, err->msg.nlmsg_len, NLM_F_DUMP,
err->msg.nlmsg_seq, err->msg.nlmsg_pid,