I'd say that those constant values are Linux specific, not Ubuntu specific.
In your C file, you're getting fcntl.h
from /usr/include/fcntl.h
which contains:
/* Get the definitions of O_*, F_*, FD_*: all the
numbers and flag bits for `open', `fcntl', et al. */
#include <bits/fcntl.h>
In /usr/include/<your_arch>/bits/fcntl.h
you can see the following code:
/* Include generic Linux declarations. */
#include <bits/fcntl-linux.h>
Finally this /usr/include/<your_arch>/bits/fcntl-linux.h
file defines those values as follow:
#ifndef F_RDLCK
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
# define F_RDLCK 0 /* Read lock. */
# define F_WRLCK 1 /* Write lock. */
# define F_UNLCK 2 /* Remove lock. */
#endif
To confirm that it's not Ubuntu specific, you can check the definitions in the libc source, they are the same.
flock
structure? I tried to apply your technique toflock
strcuture but not sure if I got it right. From my searchflock
field order differs on Mac OS based o nhere (https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fcntl.2.html) but im not sure if all linux have same field order. – Noitidart Sep 24 '14 at 09:18libc.so.7
,libc.so.61.0
, andlibc.so
. Should I make seperate topic? – Noitidart Sep 25 '14 at 05:54