aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreao <andreao@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-22 14:47:06 +0000
committerandreao <andreao@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-22 14:47:06 +0000
commita2e2e840e084e0b61fb2a6b234537c922398634f (patch)
tree255cc1cd000fe90dabbb89ef1d2ffb5e5ad9fea5
parentec4b2d11943878f68f4e0d5c902e5854e6576284 (diff)
add definitions of STDIN_FILENO, STDOUT_FILENO and STDERR_FILENO to unistd.h
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/st/cli-be@146580 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstd/include/bits/libstd_stdio.h10
-rw-r--r--libstd/include/stdio.h6
-rw-r--r--libstd/include/unistd.h6
3 files changed, 17 insertions, 5 deletions
diff --git a/libstd/include/bits/libstd_stdio.h b/libstd/include/bits/libstd_stdio.h
index 8b3e687d503..d2dbf27fc61 100644
--- a/libstd/include/bits/libstd_stdio.h
+++ b/libstd/include/bits/libstd_stdio.h
@@ -23,8 +23,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef __LIBSTD_STDIO_H
#define __LIBSTD_STDIO_H
-#if !defined __STDIO_H__ && !defined __LIBSTD_CRT_BUILD
-# error "Never use <bits/libstd_math.h> directly; include <math.h> instead."
+#if !defined(__STDIO_H__) && ! defined(__UNISTD_H) && !defined(__LIBSTD_CRT_BUILD)
+# error "Never use <bits/libstd_stdio.h> directly; include <stdio.h> or <unistd.h> instead."
#endif
/* Remember to update values in src/MSCorlibWrapper.cs */
@@ -62,6 +62,12 @@ enum {
__LIBSTD_TMP_MAX = 17576 /* Vary 3 lower cases letters = 26*26*26 */
};
+enum {
+ __LIBSTD_STDIN_FILENO = 0,
+ __LIBSTD_STDOUT_FILENO = 1,
+ __LIBSTD_STDERR_FILENO = 2
+};
+
__END_EXTERN_C
#endif /*__LIBSTD_STDIO_H */
diff --git a/libstd/include/stdio.h b/libstd/include/stdio.h
index 22050cb87e9..59a5a02af45 100644
--- a/libstd/include/stdio.h
+++ b/libstd/include/stdio.h
@@ -58,9 +58,9 @@ LIBSTD_LPROTO(FILE *, freopen, const char *restrict, const char *restrict, FILE
LIBSTD_LPROTO(int, setvbuf, FILE *restrict, char *restrict, int, size_t);
LIBSTD_LPROTO(void, setbuf, FILE *restrict, char *restrict);
-#define stdin (LIBSTD_LNAME(__io_ftable_get_entry)(0))
-#define stdout (LIBSTD_LNAME(__io_ftable_get_entry)(1))
-#define stderr (LIBSTD_LNAME(__io_ftable_get_entry)(2))
+#define stdin (LIBSTD_LNAME(__io_ftable_get_entry)(__LIBSTD_STDIN_FILENO))
+#define stdout (LIBSTD_LNAME(__io_ftable_get_entry)(__LIBSTD_STDOUT_FILENO))
+#define stderr (LIBSTD_LNAME(__io_ftable_get_entry)(__LIBSTD_STDERR_FILENO))
diff --git a/libstd/include/unistd.h b/libstd/include/unistd.h
index b9d47f361a4..a590173557a 100644
--- a/libstd/include/unistd.h
+++ b/libstd/include/unistd.h
@@ -31,6 +31,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
/* Included for off_t, ssize_t */
#include <sys/types.h>
+#include <bits/libstd_stdio.h>
+
__BEGIN_EXTERN_C
LIBSTD_LPROTO(int, close, int);
@@ -38,6 +40,10 @@ LIBSTD_LPROTO(ssize_t, read, int, void *, size_t);
LIBSTD_LPROTO(ssize_t, write, int, const void *, size_t);
LIBSTD_LPROTO(off_t, lseek, int, off_t, int);
+#define STDIN_FILENO __LIBSTD_STDIN_FILENO
+#define STDOUT_FILENO __LIBSTD_STDOUT_FILENO
+#define STDERR_FILENO __LIBSTD_STDERR_FILENO
+
LIBSTD_LPROTO(int, isatty, int);
__END_EXTERN_C