summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-09-17 18:20:50 -0600
committerJens Axboe <axboe@kernel.dk>2021-09-17 18:20:50 -0600
commitc667d67d5f934e60117613dd113074a1bbbb61be (patch)
treef484ceb18bb67a3906304aedcd85a75abb2b1dad
parent1488fc5d0dececea9e468f8cfaafbbd2b215e2cb (diff)
parentaf31ce2cbfcaecc2a6f342532ede5e293a34f7f7 (diff)
downloadliburing-c667d67d5f934e60117613dd113074a1bbbb61be.tar.gz
liburing-c667d67d5f934e60117613dd113074a1bbbb61be.tar.bz2
Merge branch 'master' of https://github.com/kraj/liburing
* 'master' of https://github.com/kraj/liburing: examples/ucontext-cp.c: Do not use SIGSTKSZ
-rw-r--r--examples/ucontext-cp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/ucontext-cp.c b/examples/ucontext-cp.c
index ea0c934..b1369e2 100644
--- a/examples/ucontext-cp.c
+++ b/examples/ucontext-cp.c
@@ -3,6 +3,7 @@
* gcc -Wall -O2 -D_GNU_SOURCE -o ucontext-cp ucontext-cp.c -luring
*/
#define _POSIX_C_SOURCE 199309L
+#include <stddef.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
@@ -22,9 +23,7 @@
#define QD 64
#define BS 1024
-#ifndef SIGSTKSZ
-#define SIGSTKSZ 8192
-#endif
+size_t sigstksz = (8 * 1024 + sizeof (max_align_t) - 1) / sizeof (max_align_t);
typedef struct {
struct io_uring *ring;
@@ -115,13 +114,13 @@ static int setup_context(async_context *pctx, struct io_uring *ring)
perror("getcontext");
return -1;
}
- pctx->stack_buf = malloc(SIGSTKSZ);
+ pctx->stack_buf = malloc(sigstksz);
if (!pctx->stack_buf) {
perror("malloc");
return -1;
}
pctx->ctx_fnew.uc_stack.ss_sp = pctx->stack_buf;
- pctx->ctx_fnew.uc_stack.ss_size = SIGSTKSZ;
+ pctx->ctx_fnew.uc_stack.ss_size = sigstksz;
pctx->ctx_fnew.uc_link = &pctx->ctx_main;
return 0;