linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: David Howells <dhowells@redhat.com>
Cc: Tony Luck <tony.luck@intel.com>,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 21/21] posix_types: Remove fd_set macros
Date: Tue, 14 Feb 2012 11:44:30 -0800	[thread overview]
Message-ID: <4F3AB99E.5040705@zytor.com> (raw)
In-Reply-To: <30935.1329247114@redhat.com>

On 02/14/2012 11:18 AM, David Howells wrote:
> Tony Luck <tony.luck@intel.com> wrote:
> 
>> Adding a #include <linux/string.h> to include/linux/time.h fixes them for me.
> 
> Which is one of the reasons I'd rather not see these things cropping up in
> linux/time.h.  Either put them in linux/select.h (mirroring userspace) or
> stick them in linux/poll.h with the rest of the polling paraphernalia.
> 
> __FD_SET() and co aren't exported to userspace anyway, as I understand it, so
> it shouldn't hurt to bung them in linux/poll.h, and if they are exported to
> userspace, they should stay in posix_types.h, shouldn't they?
> 
> To support this, at least three #includes will have to be added to
> linux/time.h: linux/posix_types.h (which is fair enough), linux/bitops.h and
> linux/string.h.

We can do that, but we'd almost certainly have to #include
<linux/select.h> in <linux/time.h>.  The following macros are defined in
<linux/time.h> and *exported to userspace*:

#define NFDBITS                 __NFDBITS

#define FD_SETSIZE              __FD_SETSIZE
#define FD_SET(fd,fdsetp)       __FD_SET(fd,fdsetp)
#define FD_CLR(fd,fdsetp)       __FD_CLR(fd,fdsetp)
#define FD_ISSET(fd,fdsetp)     __FD_ISSET(fd,fdsetp)
#define FD_ZERO(fdsetp)         __FD_ZERO(fdsetp)

Now, this largely mimics what has happened in userspace over time; to
quote POSIX:

The <sys/time.h> header shall define the fd_set type as described in
<sys/select.h>.

The <sys/time.h> header shall define the following as described in
<sys/select.h>:
FD_CLR( )
FD_ISSET( )
FD_SET( )
FD_ZERO( )
FD_SETSIZE

[...]

Inclusion of the <sys/time.h> header may make visible all symbols from
the <sys/select.h> header.

Cleaning up <linux/time.h> would indeed be a worthwhile goal -- it's not
clear to me that it can safely be used to build a POSIX-compliant
userspace.  In particular, it mixes the functions of <sys/time.h> and
<time.h>, but <time.h> symbols are not permitted to leak into
<sys/time.h> space as far as I read the specification.  However, this
feels like a slightly orthogonal task (in fact, it might belong more in
your uabi work.)

	-hpa
-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

  reply	other threads:[~2012-02-14 19:44 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08  5:08 [PATCH 00/21] RFC: Make all arches use <asm-generic/posix_types.h> H. Peter Anvin
2012-02-08  5:08 ` H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 01/21] posix_types: Make __kernel_[ug]id32_t default to unsigned int H. Peter Anvin
2012-02-08  5:08 ` [PATCH 02/21] posix_types: Make it possible to override __kernel_fsid_t H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 03/21] alpha: Use generic posix_types.h H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 04/21] arm: " H. Peter Anvin
2012-02-09  0:57   ` Russell King - ARM Linux
2012-02-08  5:08 ` [PATCH 05/21] avr32: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 06/21] cris: " H. Peter Anvin
2012-02-08 13:21   ` Jesper Nilsson
2012-02-08  5:08 ` [PATCH 07/21] frv: " H. Peter Anvin
2012-02-08  5:08 ` [PATCH 08/21] h8300: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 09/21] ia64: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 10/21] m32r: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 11/21] m68k: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-19 10:28   ` Geert Uytterhoeven
2012-02-08  5:08 ` [PATCH 12/21] mips: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 13/21] mn10300: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 14/21] parisc: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-08  5:08 ` [PATCH 15/21] powerpc: " H. Peter Anvin
2012-02-08  5:08   ` H. Peter Anvin
2012-02-09  6:14   ` Benjamin Herrenschmidt
2012-02-08  5:09 ` [PATCH 16/21] s390: " H. Peter Anvin
2012-02-08  5:09   ` H. Peter Anvin
2012-02-08  9:04   ` Martin Schwidefsky
2012-02-08 16:55     ` H. Peter Anvin
2012-02-08 18:01       ` Martin Schwidefsky
2012-02-08  5:09 ` [PATCH 17/21] sh: Remove unnecessary posix_types.h type overrides H. Peter Anvin
2012-02-08  5:09 ` [PATCH 18/21] sparc: Use generic posix_types.h H. Peter Anvin
2012-02-08  5:09   ` H. Peter Anvin
2012-02-09  1:27   ` David Miller
2012-02-09  1:27     ` David Miller
2012-02-08  5:09 ` [PATCH 19/21] x86: " H. Peter Anvin
2012-02-08  5:09   ` H. Peter Anvin
2012-02-08  5:09 ` [PATCH 20/21] xtensa: " H. Peter Anvin
2012-02-08  5:09   ` H. Peter Anvin
2012-02-08  5:09 ` [PATCH 21/21] posix_types: Remove fd_set macros H. Peter Anvin
2012-02-08  5:09   ` H. Peter Anvin
2012-02-08 12:20 ` David Howells
2012-02-08 16:57   ` H. Peter Anvin
2012-02-08 21:24   ` David Howells
2012-02-08 21:24     ` David Howells
2012-02-08 21:30     ` H. Peter Anvin
2012-02-08 21:30       ` H. Peter Anvin
2012-02-14 18:59       ` Tony Luck
2012-02-14 19:18       ` David Howells
2012-02-14 19:44         ` H. Peter Anvin [this message]
2012-02-14 20:14           ` H. Peter Anvin
2012-02-16 13:42 ` [PATCH 20/21] xtensa: Use generic posix_types.h David Howells
2012-02-16 17:45   ` Marc Gauthier
2012-02-16 13:44 ` [PATCH 13/21] mn10300: " David Howells
2012-02-16 13:44 ` [PATCH 15/21] powerpc: " David Howells
2012-02-16 20:26   ` Benjamin Herrenschmidt
2012-02-16 20:58     ` H. Peter Anvin
2012-02-16 17:49 ` [PATCH 0/3] Eliminating __FD_*() functions from the kernel David Howells
2012-02-16 17:49   ` David Howells
2012-02-16 17:49   ` [PATCH 1/3] Wrap accesses to the fd_sets in struct fdtable David Howells
2012-02-16 17:49   ` [PATCH 2/3] Replace the fd_sets in struct fdtable with an array of unsigned longs David Howells
2012-02-16 17:50   ` [PATCH 3/3] Delete the __FD_*() funcs for operating on fd_set from linux/time.h David Howells
2012-02-16 17:50     ` David Howells
2012-02-20 21:12 ` [PATCH 13/21] mn10300: Use generic posix_types.h David Howells
2012-02-20 21:12   ` David Howells
2012-02-20 21:12 ` [PATCH 07/21] frv: " David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3AB99E.5040705@zytor.com \
    --to=hpa@zytor.com \
    --cc=arnd@arndb.de \
    --cc=dhowells@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).