linux/Documentation
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
..
2011-09-27 18:08:04 +02:00
2011-09-27 18:08:04 +02:00
2010-02-24 13:51:32 +01:00
2011-09-27 18:08:04 +02:00
2011-06-07 16:06:01 +02:00
2011-03-31 11:26:23 -03:00
2012-02-01 09:14:17 -08:00
2011-11-04 15:52:51 -04:00
2011-06-13 13:43:05 +02:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-09-27 18:08:04 +02:00
2011-03-31 11:26:23 -03:00
2011-11-02 16:07:02 -07:00
2011-12-11 10:32:23 -08:00
2011-12-27 11:27:12 +01:00
2012-01-16 12:34:12 +04:00
2011-09-27 18:08:04 +02:00
2011-03-31 11:26:23 -03:00
2011-09-27 18:08:04 +02:00
2012-01-04 16:04:30 -08:00
2011-03-31 11:26:23 -03:00
2010-04-08 11:34:34 +02:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2012-01-13 10:12:23 -08:00
2011-12-27 11:27:12 +01:00
2011-03-31 11:26:23 -03:00
2011-12-12 14:14:31 -08:00
2011-03-31 11:26:23 -03:00
2011-09-27 18:08:04 +02:00
2011-03-07 13:20:05 -08:00
2011-06-13 13:43:05 +02:00
2011-09-27 18:08:04 +02:00
2011-09-27 18:08:04 +02:00
2012-01-26 14:11:31 +01:00
2011-09-27 18:08:04 +02:00
2011-03-31 11:26:23 -03:00
2010-07-19 10:56:54 +02:00
2010-03-16 11:47:56 +01:00
2012-01-02 13:04:55 +01:00