Skip to content
Snippets Groups Projects
Commit a50c4715 authored by Jens Axboe's avatar Jens Axboe
Browse files

Revert "examples/ucontext-cp.c: Do not use SIGSTKSZ"

This reverts commit af31ce2c.

The commit is buggy and causes ucontext-cp to crash. Just revert it
for now.

Fixes: https://github.com/axboe/liburing/issues/459


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b3813170
Branches
Tags
No related merge requests found
......@@ -3,7 +3,6 @@
* 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>
......@@ -23,7 +22,9 @@
#define QD 64
#define BS 1024
size_t sigstksz = (8 * 1024 + sizeof (max_align_t) - 1) / sizeof (max_align_t);
#ifndef SIGSTKSZ
#define SIGSTKSZ 8192
#endif
typedef struct {
struct io_uring *ring;
......@@ -114,13 +115,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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment