Open BebeSparkelSparkel opened 3 years ago
Is there someone using openBSD to help out to get file locking working? Or someone who could help to provide a patch dedicated for openBSD?
@BebeSparkelSparkel as a first untestet shot you could add the #include <fcntl.h>
after the include of sys/file.h in https://github.com/fanglingsu/vimb/blob/652f4111b6e11d0ce280ae2a7b5d8f09f85bb253/src/file-storage.c#L22. Accroding to https://man.openbsd.org/flock.2 this could be enough to compile vimb.
I don't know this project, but I found this ticket investigating some similar, where flock
is not visible. Are you defining _POSIX_C_SOURCE
?
The following output from an OpenBSD 6.9 machine may help you:
builder3$ cat test.c
#include <fcntl.h>
int main (void)
{
flock(0,0);
return 0;
}
builder3$ cc -fsyntax-only test.c
builder3$ cc -fsyntax-only -D_BSD_SOURCE test.c
builder3$ cc -fsyntax-only -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L test.c
builder3$ cc -fsyntax-only -D_POSIX_C_SOURCE=200809L test.c
test.c:5:3: warning: implicit declaration of function 'flock' is invalid in C99 [-Wimplicit-function-declaration]
flock(0,0);
^
1 warning generated.
i.e. if you define _POSIX_C_SOURCE
you seem to also need to define _BSD_SOURCE
.
This issue has been automatically marked as stale because it has not had activity within the last 60 days.
Trying to build this on openBSD and having problems with undeclared identifier 'LOCK_EX' and 'LOCK_UN'.
Similar to #76 and #302. The
fix/FreeBSD-compile-error
branch seems to have been deleted.I tried adding
#include <fcntl.h>
tofile-storage.c
. man flock.