Re: [PATCH] Add cloexec information to fdinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

--- 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);

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux