This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Use fopen "rce" in ARM ioperm


A recent libc change made libc more consistently use "rce" in internal 
fopen calls (read-only, not a cancellation point, close-on-exec).  I've 
applied this patch to make ARM ioperm do likewise for consistency.

Remarks:

* I don't really expect this code actually has many users on ARM; it's 
more legacy compatibility with an x86 interface.

* Alpha maintainers will probably wish to make a similar change to the 
Alpha version along with other backlogged sysdeps updates.

* This file (and the Alpha version) also has an __open call on /dev/mem, 
which it seems clear should use O_CLOEXEC (any time a file descriptor is 
opened and closed internally by a function, it should be O_CLOEXEC so it 
doesn't leak if another thread does fork+exec at the wrong time), and 
likely should also be open_not_cancel_2.  But given that the IA64 version 
in libc also uses __open there without O_CLOEXEC, and given that this is 
mainly legacy code for compatibility with other architectures, for now 
I've left that __open call unchanged.

diff --git a/ChangeLog.arm b/ChangeLog.arm
index c61cfe4..8c14f08 100644
--- a/ChangeLog.arm
+++ b/ChangeLog.arm
@@ -1,3 +1,8 @@
+2011-11-16  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/arm/ioperm.c (init_iosys): Use "c" and
+	"e" in fopen.
+
 2011-10-26  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/arm/dl-machine.h, sysdeps/unix/arm/sysdep.S: Restore
diff --git a/sysdeps/unix/sysv/linux/arm/ioperm.c b/sysdeps/unix/sysv/linux/arm/ioperm.c
index 8af1ea3..8ac9b09 100644
--- a/sysdeps/unix/sysv/linux/arm/ioperm.c
+++ b/sysdeps/unix/sysv/linux/arm/ioperm.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998, 1999, 2003, 2005, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2003, 2005, 2008, 2011
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Phil Blundell, based on the Alpha version by
    David Mosberger.
@@ -135,7 +136,7 @@ init_iosys (void)
     {
       FILE * fp;
 
-      fp = fopen (PATH_CPUINFO, "r");
+      fp = fopen (PATH_CPUINFO, "rce");
       if (! fp)
 	return -1;
       while ((n = fscanf (fp, "Hardware\t: %256[^\n]\n", systype))

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]