[PATCH 2/4] inotify.h: Use new "bits/" scheme for arch-specific flags

Kevin Cernekee cernekee at gmail.com
Sun Apr 8 18:43:00 UTC 2012


glibc has split off the arch-specific flag definitions (like
IN_NONBLOCK) into <arch>/bits/inotify.h, so that there are no longer
multiple redundant copies of the entire header file.  We will adopt the
same scheme in uClibc.

Special cases are included for: alpha mips sparc

hppa was omitted because it has not been updated in glibc.

All others use the common definition.

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 Makefile.in                              |    1 +
 libc/sysdeps/linux/alpha/bits/inotify.h  |   29 +++++++++++++++++++++++++++++
 libc/sysdeps/linux/common/bits/inotify.h |   29 +++++++++++++++++++++++++++++
 libc/sysdeps/linux/common/sys/inotify.h  |   20 +++++++-------------
 libc/sysdeps/linux/mips/bits/inotify.h   |   29 +++++++++++++++++++++++++++++
 libc/sysdeps/linux/sparc/bits/inotify.h  |   29 +++++++++++++++++++++++++++++
 6 files changed, 124 insertions(+), 13 deletions(-)
 create mode 100644 libc/sysdeps/linux/alpha/bits/inotify.h
 create mode 100644 libc/sysdeps/linux/common/bits/inotify.h
 create mode 100644 libc/sysdeps/linux/mips/bits/inotify.h
 create mode 100644 libc/sysdeps/linux/sparc/bits/inotify.h

diff --git a/Makefile.in b/Makefile.in
index 82a2eff..5cedaa8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -271,6 +271,7 @@ HEADERS_RM-$(UCLIBC_HAS_WORDEXP)             += wordexp.h
 HEADERS_RM-$(UCLIBC_HAS_XATTR)               += sys/xattr.h
 HEADERS_RM-$(UCLIBC_HAS_XLOCALE)             += xlocale.h
 HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC)          += sys/eventfd.h sys/fsuid.h \
+	bits/inotify.h \
 	sys/inotify.h \
 	sys/kdaemon.h \
 	sys/perm.h \
diff --git a/libc/sysdeps/linux/alpha/bits/inotify.h b/libc/sysdeps/linux/alpha/bits/inotify.h
new file mode 100644
index 0000000..3fbe3b8
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/inotify.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_SYS_INOTIFY_H
+# error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead."
+#endif
+
+/* Flags for the parameter of inotify_init1.  */
+enum
+  {
+    IN_CLOEXEC  = 010000000,
+#define IN_CLOEXEC IN_CLOEXEC
+    IN_NONBLOCK = 000000004
+#define IN_NONBLOCK IN_NONBLOCK
+  };
diff --git a/libc/sysdeps/linux/common/bits/inotify.h b/libc/sysdeps/linux/common/bits/inotify.h
new file mode 100644
index 0000000..291f008
--- /dev/null
+++ b/libc/sysdeps/linux/common/bits/inotify.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_SYS_INOTIFY_H
+# error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead."
+#endif
+
+/* Flags for the parameter of inotify_init1.  */
+enum
+  {
+    IN_CLOEXEC = 02000000,
+#define IN_CLOEXEC IN_CLOEXEC
+    IN_NONBLOCK = 00004000
+#define IN_NONBLOCK IN_NONBLOCK
+  };
diff --git a/libc/sysdeps/linux/common/sys/inotify.h b/libc/sysdeps/linux/common/sys/inotify.h
index 07be37d..a1d74d6 100644
--- a/libc/sysdeps/linux/common/sys/inotify.h
+++ b/libc/sysdeps/linux/common/sys/inotify.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -12,24 +12,16 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifndef	_SYS_INOTIFY_H
 #define	_SYS_INOTIFY_H	1
 
 #include <stdint.h>
 
-
-/* Flags for the parameter of inotify_init1.  */
-enum
-  {
-    IN_CLOEXEC = 02000000,
-#define IN_CLOEXEC IN_CLOEXEC
-    IN_NONBLOCK = 04000
-#define IN_NONBLOCK IN_NONBLOCK
-  };
+/* Get the platform-dependent flags.  */
+#include <bits/inotify.h>
 
 
 /* Structure describing an inotify event.  */
@@ -72,6 +64,8 @@ struct inotify_event
 #define IN_ONLYDIR	 0x01000000	/* Only watch the path if it is a
 					   directory.  */
 #define IN_DONT_FOLLOW	 0x02000000	/* Do not follow a sym link.  */
+#define IN_EXCL_UNLINK	 0x04000000	/* Exclude events on unlinked
+					   objects.  */
 #define IN_MASK_ADD	 0x20000000	/* Add to the mask of an already
 					   existing watch.  */
 #define IN_ISDIR	 0x40000000	/* Event occurred against dir.  */
diff --git a/libc/sysdeps/linux/mips/bits/inotify.h b/libc/sysdeps/linux/mips/bits/inotify.h
new file mode 100644
index 0000000..67d648b
--- /dev/null
+++ b/libc/sysdeps/linux/mips/bits/inotify.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_SYS_INOTIFY_H
+# error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead."
+#endif
+
+/* Flags for the parameter of inotify_init1.  */
+enum
+  {
+    IN_CLOEXEC = 02000000,
+#define IN_CLOEXEC IN_CLOEXEC
+    IN_NONBLOCK = 00000200
+#define IN_NONBLOCK IN_NONBLOCK
+  };
diff --git a/libc/sysdeps/linux/sparc/bits/inotify.h b/libc/sysdeps/linux/sparc/bits/inotify.h
new file mode 100644
index 0000000..ca62d89
--- /dev/null
+++ b/libc/sysdeps/linux/sparc/bits/inotify.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2005-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_SYS_INOTIFY_H
+# error "Never use <bits/inotify.h> directly; include <sys/inotify.h> instead."
+#endif
+
+/* Flags for the parameter of inotify_init1.  */
+enum
+  {
+    IN_CLOEXEC = 0x400000,
+#define IN_CLOEXEC IN_CLOEXEC
+    IN_NONBLOCK = 0x004000
+#define IN_NONBLOCK IN_NONBLOCK
+  };
-- 
1.7.8.3



More information about the uClibc mailing list