liburing
liburing copied to clipboard
Not using Posix-specific things in headers
The user of this library, if they're using flags like -std=c17 -pedantic, they need to also define _POSIX_C_SOURCE to at least 200809L in order to get rid of these errors:
clang -std=c18 -pedantic -luring -Wall -Wextra main.c
In file included from main.c:43:
/usr/include/liburing.h:947:30: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_unlinkat(sqe, AT_FDCWD, path, flags);
^
/usr/include/liburing.h:964:30: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_renameat(sqe, AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
^
/usr/include/liburing.h:964:49: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_renameat(sqe, AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
^
/usr/include/liburing.h:984:29: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_mkdirat(sqe, AT_FDCWD, path, mode);
^
/usr/include/liburing.h:999:39: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_symlinkat(sqe, target, AT_FDCWD, linkpath);
^
/usr/include/liburing.h:1015:28: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_linkat(sqe, AT_FDCWD, oldpath, AT_FDCWD, newpath, flags);
^
/usr/include/liburing.h:1015:47: error: use of undeclared identifier 'AT_FDCWD'
io_uring_prep_linkat(sqe, AT_FDCWD, oldpath, AT_FDCWD, newpath, flags);
^
The reason is this:
in features.h line 350:
#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L
# define __USE_XOPEN2K8 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1
#endif
And AT_FDCWD is a Posix thing and is not available in standard C.
And this is only a problem because it's being used in header files like syscall-defs.h.