[PATCH v4 06/10] Do not use PIDs larger than INT_MAX in tests
Ákos Uzonyi
uzonyi.akos at gmail.com
Sat Jun 13 16:18:33 UTC 2020
* tests/bpf.c (BPF_TASK_FD_QUERY_checks): Use smaller PIDs.
* tests/ioctl_block.c (main): Print PID as signed integer.
* pidfd_send_signal.c (main): Likewise.
---
tests/bpf.c | 8 ++++----
tests/ioctl_block.c | 2 +-
tests/pidfd_send_signal.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/bpf.c b/tests/bpf.c
index 0b426d8a..c83854cb 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 643daf87..67fee35c 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/pidfd_send_signal.c b/tests/pidfd_send_signal.c
index 4b736815..ca01c04a 100644
--- a/tests/pidfd_send_signal.c
+++ b/tests/pidfd_send_signal.c
@@ -54,10 +54,10 @@ main(void)
sys_pidfd_send_signal(fd, SIGUSR2, si, -1);
printf("pidfd_send_signal(%d, SIGUSR2, {si_signo=SIGUSR1"
- ", si_code=SI_QUEUE, si_errno=%u, si_pid=%u, si_uid=%u"
+ ", si_code=SI_QUEUE, si_errno=%u, si_pid=%d, si_uid=%u"
", si_value={int=%d, ptr=%p}}, %#x) = %s\n",
fd, si->si_errno, si->si_pid, si->si_uid, si->si_int, si->si_ptr,
- -1U, errstr);
+ -1, errstr);
puts("+++ exited with 0 +++");
return 0;
--
2.27.0
More information about the Strace-devel
mailing list