| 91 | } |
| 92 | |
| 93 | static int setup_context(async_context *pctx, struct io_uring *ring) |
| 94 | { |
| 95 | int ret; |
| 96 | |
| 97 | pctx->ring = ring; |
| 98 | ret = getcontext(&pctx->ctx_fnew); |
| 99 | if (ret < 0) { |
| 100 | perror("getcontext"); |
| 101 | return -1; |
| 102 | } |
| 103 | pctx->stack_buf = malloc(SIGSTKSZ); |
| 104 | if (!pctx->stack_buf) { |
| 105 | perror("malloc"); |
| 106 | return -1; |
| 107 | } |
| 108 | pctx->ctx_fnew.uc_stack.ss_sp = pctx->stack_buf; |
| 109 | pctx->ctx_fnew.uc_stack.ss_size = SIGSTKSZ; |
| 110 | pctx->ctx_fnew.uc_link = &pctx->ctx_main; |
| 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | static int copy_file(async_context *pctx, int infd, int outfd, struct iovec* piov) |
| 116 | { |