login
Header Space

 
 

Re: [PATCH 02/18] flag parameters: socket and socketpair

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: Davide Libenzi <davidel@...>, Ulrich Drepper <drepper@...>, Linux Kernel Mailing List <linux-kernel@...>, <netdev@...>, <mtk.manpages@...>, Linus Torvalds <torvalds@...>
Date: Tuesday, May 6, 2008 - 7:43 am

> > > 	type = flag_remap(type, &fflags, SOCK_whatever, O_whatever);

Acute over-engineering ?

We've got lots of space for flag bits so surely we can do remap with a
shift and mask.

	flags = (type >> SOCK_FLAG_SHIFT) & SOCK_FLAG_MASK;
	type = type & SOCK_TYPE_MASK

For most boxes

SOCK_TYPE_MASK can easily be 0xFF
SOCK_FLAG_MASK O_CLOEXEC
SOCK_FLAG_SHIFT 0

and tweaked a bit depending what other flags we want.

In Linux we could actually just do SOCK_STREAM|O_CLOEXEC but that would be
bad news for portability to other OS where the trick might well not work.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 02/18] flag parameters: socket and socketpair, Ulrich Drepper, (Sun May 4, 11:42 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Ulrich Drepper, (Mon May 5, 10:33 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Andrew Morton, (Mon May 5, 10:42 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Ulrich Drepper, (Mon May 5, 11:02 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Ulrich Drepper, (Mon May 5, 10:58 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Andrew Morton, (Mon May 5, 11:05 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Ulrich Drepper, (Mon May 5, 11:10 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Davide Libenzi, (Mon May 5, 10:13 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Andrew Morton, (Mon May 5, 10:17 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Alan Cox, (Tue May 6, 7:43 am)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Davide Libenzi, (Mon May 5, 10:30 pm)
Re: [PATCH 02/18] flag parameters: socket and socketpair, YOSHIFUJI Hideaki / , (Mon May 5, 12:24 am)
Re: [PATCH 02/18] flag parameters: socket and socketpair, Ulrich Drepper, (Mon May 5, 1:00 am)
speck-geostationary