[PATCH V2 8/8] MIPS: Fix more *_NONBLOCK definitions
Kevin Cernekee
cernekee at gmail.com
Sat Apr 7 20:31:32 UTC 2012
MIPS defines O_NONBLOCK differently from most other architectures. The
common definitions use 04000 / 0x800, but MIPS uses 0200 / 0x80 instead.
After seeing a problem report involving one of the O_NONBLOCK
"derivatives," I looked through the tree to see what else might be
affected. Here is what I found:
O_NONBLOCK: correct
SOCK_NONBLOCK: correct (tst-sock-nonblock passes)
EPOLL_NONBLOCK: correct
SFD_NONBLOCK: correct (fixed in commit f87898ca; tst-signalfd passes)
TFD_NONBLOCK: incorrect (tst-timerfd fails)
IN_NONBLOCK: incorrect (tst-inotify fails)
The proposed change is to add #ifdef clauses for __mips__, similar to
what was done for SFD_NONBLOCK in include/sys/signalfd.h . This fixes
the two failing test cases.
Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
libc/sysdeps/linux/common/sys/inotify.h | 11 +++++++++++
libc/sysdeps/linux/common/sys/timerfd.h | 11 +++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/libc/sysdeps/linux/common/sys/inotify.h b/libc/sysdeps/linux/common/sys/inotify.h
index dc4e19d..4a10d6b 100644
--- a/libc/sysdeps/linux/common/sys/inotify.h
+++ b/libc/sysdeps/linux/common/sys/inotify.h
@@ -23,6 +23,16 @@
/* Flags for the parameter of inotify_init1. */
+#if defined __mips__
+enum
+ {
+ IN_CLOEXEC = 02000000,
+#define IN_CLOEXEC IN_CLOEXEC
+ IN_NONBLOCK = 0200
+#define IN_NONBLOCK IN_NONBLOCK
+ };
+
+#else
enum
{
IN_CLOEXEC = 02000000,
@@ -30,6 +40,7 @@ enum
IN_NONBLOCK = 04000
#define IN_NONBLOCK IN_NONBLOCK
};
+#endif
/* Structure describing an inotify event. */
diff --git a/libc/sysdeps/linux/common/sys/timerfd.h b/libc/sysdeps/linux/common/sys/timerfd.h
index c1bb06f..141338e 100644
--- a/libc/sysdeps/linux/common/sys/timerfd.h
+++ b/libc/sysdeps/linux/common/sys/timerfd.h
@@ -23,6 +23,16 @@
/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
+#if defined __mips__
+enum
+ {
+ TFD_CLOEXEC = 02000000,
+#define TFD_CLOEXEC TFD_CLOEXEC
+ TFD_NONBLOCK = 0200
+#define TFD_NONBLOCK TFD_NONBLOCK
+ };
+
+#else
enum
{
TFD_CLOEXEC = 02000000,
@@ -30,6 +40,7 @@ enum
TFD_NONBLOCK = 04000
#define TFD_NONBLOCK TFD_NONBLOCK
};
+#endif
/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
--
1.7.8.3
More information about the uClibc
mailing list