linux/arch
David Howells 1dce27c5aa Wrap accesses to the fd_sets in struct fdtable
Wrap accesses to the fd_sets in struct fdtable (for recording open files and
close-on-exec flags) so that we can move away from using fd_sets since we
abuse the fd_set structs by not allocating the full-sized structure under
normal circumstances and by non-core code looking at the internals of the
fd_sets.

The first abuse means that use of FD_ZERO() on these fd_sets is not permitted,
since that cannot be told about their abnormal lengths.

This introduces six wrapper functions for setting, clearing and testing
close-on-exec flags and fd-is-open flags:

	void __set_close_on_exec(int fd, struct fdtable *fdt);
	void __clear_close_on_exec(int fd, struct fdtable *fdt);
	bool close_on_exec(int fd, const struct fdtable *fdt);
	void __set_open_fd(int fd, struct fdtable *fdt);
	void __clear_open_fd(int fd, struct fdtable *fdt);
	bool fd_is_open(int fd, const struct fdtable *fdt);

Note that I've prepended '__' to the names of the set/clear functions because
they require the caller to hold a lock to use them.

Note also that I haven't added wrappers for looking behind the scenes at the
the array.  Possibly that should exist too.

Signed-off-by: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20120216174942.23314.1364.stgit@warthog.procyon.org.uk
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
2012-02-19 10:30:52 -08:00
..
alpha alpha: Use generic posix_types.h 2012-02-14 12:01:27 -08:00
arm arm: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
avr32 avr32: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
blackfin Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci 2012-01-11 18:50:26 -08:00
c6x C6X: replace tick_nohz_stop/restart_sched_tick calls 2012-01-08 15:13:16 -05:00
cris cris: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
frv frv: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
h8300 h8300: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
hexagon lib: move GENERIC_IOMAP to lib/Kconfig 2011-11-24 22:21:19 +02:00
ia64 ia64: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
m32r m32r: Use generic posix_types.h 2012-02-14 12:01:28 -08:00
m68k m68k: Use generic posix_types.h 2012-02-14 12:01:29 -08:00
microblaze Revert "microblaze: Add topology init" 2012-01-31 09:06:52 +01:00
mips mips: Use generic posix_types.h 2012-02-14 12:01:29 -08:00
mn10300 mn10300: Use generic posix_types.h 2012-02-14 12:01:29 -08:00
openrisc Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2012-01-16 14:34:54 -08:00
parisc parisc: Use generic posix_types.h 2012-02-14 12:01:29 -08:00
powerpc Wrap accesses to the fd_sets in struct fdtable 2012-02-19 10:30:52 -08:00
s390 s390: Use generic posix_types.h 2012-02-14 12:01:29 -08:00
score score: fix off-by-one index into syscall table 2012-01-23 08:38:49 -08:00
sh sh: Remove unnecessary posix_types.h type overrides 2012-02-14 12:01:29 -08:00
sparc sparc: Use generic posix_types.h 2012-02-14 12:01:30 -08:00
tile Merge branch 'for-next' of git://git.infradead.org/users/dhowells/linux-headers 2012-01-14 18:03:30 -08:00
um Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit 2012-01-17 16:41:31 -08:00
unicore32 Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci 2012-01-11 18:50:26 -08:00
x86 x86: Use generic posix_types.h 2012-02-14 12:01:30 -08:00
xtensa xtensa: Use generic posix_types.h 2012-02-14 12:01:30 -08:00
.gitignore
Kconfig mm,x86,um: move CMPXCHG_DOUBLE config option 2012-01-12 20:13:03 -08:00