bigfile/virtmem: Fix build with recent glibc
It was bigfile/pagefault.c:45:36: warning: ‘struct ucontext’ declared inside parameter list will not be visible outside of this definition or declaration static int faulted_by(const struct ucontext *uc); ^~~~~~~~ bigfile/pagefault.c: In function ‘on_pagefault’: bigfile/pagefault.c:59:24: warning: passing argument 1 of ‘faulted_by’ from incompatible pointer type [-Wincompatible-pointer-types] write = faulted_by(uc); ^~ bigfile/pagefault.c:45:12: note: expected ‘const struct ucontext *’ but argument is of type ‘struct ucontext *’ static int faulted_by(const struct ucontext *uc); ^~~~~~~~~~ bigfile/pagefault.c: At top level: bigfile/pagefault.c:208:36: warning: ‘struct ucontext’ declared inside parameter list will not be visible outside of this definition or declaration static int faulted_by(const struct ucontext *uc) ^~~~~~~~ bigfile/pagefault.c:208:12: error: conflicting types for ‘faulted_by’ static int faulted_by(const struct ucontext *uc) ^~~~~~~~~~ bigfile/pagefault.c:45:12: note: previous declaration of ‘faulted_by’ was here static int faulted_by(const struct ucontext *uc); ^~~~~~~~~~ bigfile/pagefault.c: In function ‘faulted_by’: bigfile/pagefault.c:217:15: error: dereferencing pointer to incomplete type ‘const struct ucontext’ write = uc->uc_mcontext.gregs[REG_ERR] & 0x2; ^~ bigfile/pagefault.c: At top level: bigfile/pagefault.c:45:12: warning: ‘faulted_by’ used but never defined static int faulted_by(const struct ucontext *uc); ^~~~~~~~~~ bigfile/pagefault.c:208:12: warning: ‘faulted_by’ defined but not used [-Wunused-function] static int faulted_by(const struct ucontext *uc) ^~~~~~~~~~ Change to using ucontext_t because apparently there is no `struct ucontext` anymore (and man for sigaction says 3rd parameter to hander is of type `ucontext_t *` - not `struct ucontext *` - cast to `void *`) Explicitly include <ucontext.h> because we are dereferencing ucontext_t, even though today it appears to be included by <signal.h>.
Showing
Please register or sign in to comment