Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/ucontext-cp.c: cope with variable SIGSTKSZ
The size of C arrays at file scope must be constant. The following compiler error occurs with recent upstream glibc (2.33.9000): CC ucontext-cp ucontext-cp.c:31:23: error: variably modified ‘stack_buf’ at file scope 31 | unsigned char stack_buf[SIGSTKSZ]; | ^~~~~~~~~ make[1]: *** [Makefile:26: ucontext-cp] Error 1 The following glibc commit changed SIGSTKSZ from a constant value to a variable: commit 6c57d320484988e87e446e2e60ce42816bf51d53 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Feb 1 11:00:38 2021 -0800 sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] ... +# define SIGSTKSZ sysconf (_SC_SIGSTKSZ) Allocate the stack buffer explicitly to avoid declaring an array at file scope. Cc: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
- Loading branch information