lkml.org 
[lkml]   [2011]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] Add cloexec information to fdinfo
On 06/20/2011 05:31 PM, Andrew Morton wrote:
> Does FD_ISSET return 0 or 1? Or 0 or non-zero?
>
> For x86 it's the former.
>
> <checks the architectures>
>
> arch/h8300/include/asm/posix_types.h: busted
> #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
>
> arch/m68k/include/asm/posix_types.h: busted
> #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
>
> arch/xtensa/include/asm/posix_types.h: busted
> #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))

I agree, this is an issue. Existing code works around this. We should
use the attached patch on top of the existing one.


This doesn't invalidate your patch to harmonize the architectures but
the above is what existing code does. I didn't use a tab in the output
since the initial string is long enough to force the subsequent text in
a new column. Using a single space seemed more visually pleasing.



Signed-off-by: Ulrich Drepper <drepper@gmail.com>

--- a/fs/proc/base.c 2011-06-28 02:54:01.888793757 -0400
+++ b/fs/proc/base.c 2011-06-28 02:54:30.668664335 -0400
@@ -1939,7 +1939,7 @@
"cloexec:\t%d\n",
(long long) file->f_pos,
file->f_flags,
- cloexec);
+ cloexec ? FD_CLOEXEC : 0);
}
spin_unlock(&files->file_lock);
put_files_struct(files);
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-06-28 09:21    [from the cache]
©2003-2011 Jasper Spaans