From 8173bc6b200923cc8754d5e742922e0b1e081c98 Mon Sep 17 00:00:00 2001 From: twoneis Date: Fri, 25 Apr 2025 08:27:24 +0200 Subject: [PATCH] error messages --- code/leak.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/code/leak.c b/code/leak.c index c41cae5cf..0cbd4bb7e 100644 --- a/code/leak.c +++ b/code/leak.c @@ -48,9 +48,19 @@ main(void) printf("main: spray to reduce TLB noise part 1: %u objects\n", PIPE_BUFFER); for (size_t i = 0; i < SPRAY; i++) { - pipe2(pipes[i], O_NONBLOCK); - fcntl(pipes[i][0], F_SETPIPE_SZ, 2 << 12); - write(pipes[i][1], buffer, 8); + int ret; + ret = pipe2(pipes[i], O_NONBLOCK); + if (ret < 0) { + printf("main: error: pipe2: object %lu\n", i); + } + ret = fcntl(pipes[i][0], F_SETPIPE_SZ, 2 << 12); + if (ret < 0) { + printf("main: error: fcntl: object %lu\n", i); + } + ret = write(pipes[i][1], buffer, 8); + if (ret < 0) { + printf("main: error: write: object %lu\n", i); + } } // May need socket and two parts instead