aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-05-21 15:36:26 -0700
committerH. Peter Anvin <hpa@zytor.com>2012-05-21 15:36:26 -0700
commit4600662f24eeee70ee28bc768cdaebb84bbc3345 (patch)
treec5ee8168feb31e8d3a746b13ce216cd9c3377f42
parentded7408767c5c2b1d21386efff594bf369380fa8 (diff)
downloadklibc-4600662f24eeee70ee28bc768cdaebb84bbc3345.tar.gz
[klibc] Move SEEK_ constants to a common header file
POSIX states that the SEEK_ constants should be defined by stdio.h, unistd.h, and fcntl.h. The easiest way to do that without having to worry about duplicate definitions is to move them to their own header file with header guards and #include it in the other files. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--usr/include/fcntl.h1
-rw-r--r--usr/include/klibc/seek.h14
-rw-r--r--usr/include/stdio.h5
-rw-r--r--usr/include/unistd.h1
4 files changed, 17 insertions, 4 deletions
diff --git a/usr/include/fcntl.h b/usr/include/fcntl.h
index 0908e2174d0d51..bbd6917334ffdd 100644
--- a/usr/include/fcntl.h
+++ b/usr/include/fcntl.h
@@ -7,6 +7,7 @@
#include <klibc/extern.h>
#include <klibc/compiler.h>
+#include <klibc/seek.h>
#include <sys/types.h>
#if defined(__mips__) && !defined(__mips64__)
# include <klibc/archfcntl.h>
diff --git a/usr/include/klibc/seek.h b/usr/include/klibc/seek.h
new file mode 100644
index 00000000000000..e8ffe257ebe3e7
--- /dev/null
+++ b/usr/include/klibc/seek.h
@@ -0,0 +1,14 @@
+/*
+ * klibc/seek.h
+ *
+ * SEEK constants - needed by stdio.h, fcntl.h, and unistd.h
+ */
+
+#ifndef _KLIBC_SEEK_H
+#define _KLIBC_SEEK_H
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#endif /* _KLIBC_SEEK_H */
diff --git a/usr/include/stdio.h b/usr/include/stdio.h
index f0e81e977d5d6a..f24ab6937d973f 100644
--- a/usr/include/stdio.h
+++ b/usr/include/stdio.h
@@ -7,6 +7,7 @@
#include <klibc/extern.h>
#include <klibc/sysconfig.h>
+#include <klibc/seek.h>
#include <stdarg.h>
#include <stddef.h>
#include <unistd.h>
@@ -26,10 +27,6 @@ typedef struct _IO_file FILE;
# define BUFSIZ _KLIBC_BUFSIZ
#endif
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
enum _IO_bufmode {
_IONBF,
_IOLBF,
diff --git a/usr/include/unistd.h b/usr/include/unistd.h
index 3af4c8f16dacb9..0390748b28c554 100644
--- a/usr/include/unistd.h
+++ b/usr/include/unistd.h
@@ -7,6 +7,7 @@
#include <klibc/extern.h>
#include <klibc/compiler.h>
+#include <klibc/seek.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/select.h>