Sharing of bits/fcntl.h for Linux - some questions
Andreas Jaeger
aj@suse.com
Mon Oct 15 09:59:00 GMT 2012
Roland proposed in the thread about "[Patch] Add name_to_handle_at and
open_by_handle_at for PowerPC" the following:
> They are in bits/fcntl.h because they are Linux-specific. It would be a
> reasonable cleanup to add a new shared bits/fcntl-linux.h and move the
> repetitious parts of the linux/*/bits/fcntl.h files there and make them
> all #include <bits/fcntl-linux.h>.
I've looked a bit at this and have a first go and like to solve first
some questions:
1) s390x is the only odd architecture for these two values, the kernel
header has something like:
# if defined __s390x__
# define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */
# else
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
# endif
Should we do this as well for constants where only one architecture is
the odd one? Or should the header only contain architecture independent
stuff?
2) There are some values that are different on a few architectures. The
Linux kernel <asm-generic/fcntl.h> handles this as following:
- include a architecture specific file that includes some stuf and can
define some values
- check in the generic file whether the value is defined, e.g.:
#ifndef O_EXCL
#define O_EXCL 00000200 /* not fcntl */
#endif
Should we do something like this as well - or have every architecture
define O_EXCL etc.? (half of the architectures have different values)
3) struct flock/flock64 have on SPARC an extra padding.
struct flock64
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like
`lseek'). */
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
__ARCH_FLOCK_PAD
};
The Linux kernel adds an __ARCH_FLOCK_PAD with the definition that can
be set by an architecture. Should we do the same - or have each
architecture have its own copy?
I'm attaching a generic file <bits/fcntl.h> and the x86 specific
<bits/fcntl-linux.h> for those eager to look at them (as new files since
they are basically new) - and will clean them up based on the comments I
receive for the above three problems and then send them for review,
Andreas
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fcntl.h
Type: text/x-chdr
Size: 7915 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20121015/937c9b58/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fcntl-linux.h
Type: text/x-chdr
Size: 4069 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20121015/937c9b58/attachment-0001.bin>
More information about the Libc-alpha
mailing list