glibc_version_header
glibc_version_header copied to clipboard
handle fcntl64 from glibc 2.28
I am compiling on ubuntu 20.04 (2.31) and forcing glibc 2.19. It doesn't work because of new symbol fcntl64
which wasn't included in previous versions of glibc.
This SO answer possibly has solution: https://stackoverflow.com/a/58472959/1966790
I have the same problem, I'm currently doing this:
#include <stdarg.h>
#include <syscall.h>
int my_fcntl (int fd, int cmd, ...) {
va_list ap;
long arg;
va_start (ap, cmd);
arg = va_arg (ap, long);
va_end (ap);
return syscall (SYS_fcntl64, 3, fd, cmd, arg);
}
And replaced the only instance I had of fcntl with my_fcntl (could have done a #define fcntl my_fcntl as well).
This is of course far from ideal as it doesn't handle 64 bits offsets. I didn't need them, because I'm using F_GETFL and F_SETFL to set O_NONBLOCK.
I would be using this library instead if it had proper fcntl support on systems with glibc 2.28 onwards.