On Sun, 8 Dec 2024 13:36:07 +0800 Chris Billington <cbilling...@emulti.net> wrote:
> First steps, getting the program to build, having solved a few type errors I > have run into the following issue: > ... > /home/chris/Downloads/build/ctune/src/datastructure/CircularBuffer.c:36:17: > warning: call to undeclared function 'syscall'; ISO C99 and later do not > support implicit function declarations [-Wimplicit-function-declaration] > long fd = syscall( __NR_memfd_create, name, flags ); > ^ > /home/chris/Downloads/build/ctune/src/datastructure/CircularBuffer.c:36:26: > error: use of undeclared identifier '__NR_memfd_create' > long fd = syscall( __NR_memfd_create, name, flags ); > ^ > 1 warning and 1 error generated. OpenBSD has neither the syscall(2) nor memfd_create(2) functions from Linux. I would try mkstemp(3) and unlink(2) to create a file descriptor. That might look like #ifdef __OpenBSD__ int fd; char buf [] = "/tmp/mem.XXXXXXXXXX"; fd = mkstemp( buf ); if( fd != -1 ) unlink( buf ); return fd; #else long fd = syscall( __NR_memfd_create, name, flags ); ... return cast; #endif If mkstemp or unlink aren't declared, then #include <stdlib.h> or <unistd.h>. --gkoehler