Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147594227
D4980.id12421.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D4980.id12421.diff
View Options
Index: include/stdio.h
===================================================================
--- include/stdio.h
+++ include/stdio.h
@@ -302,7 +302,9 @@
char *ctermid(char *);
FILE *fdopen(int, const char *);
-int fileno(FILE *);
+#ifndef __FILENO_C
+static __inline int fileno(FILE *);
+#endif
#endif /* __POSIX_VISIBLE */
#if __POSIX_VISIBLE >= 199209
@@ -328,7 +330,9 @@
void clearerr_unlocked(FILE *);
int feof_unlocked(FILE *);
int ferror_unlocked(FILE *);
-int fileno_unlocked(FILE *);
+#ifndef __FILENO_C
+static __inline int fileno_unlocked(FILE *);
+#endif
#endif
#if __POSIX_VISIBLE >= 200112
@@ -482,6 +486,30 @@
extern int __isthreaded;
+#if __POSIX_VISIBLE
+#ifndef __FILENO_C
+static __inline int
+fileno(FILE *p)
+{
+ return (!__isthreaded ? __sfileno(p) : (fileno)(p));
+}
+#endif
+#endif
+
+#if __BSD_VISIBLE
+/*
+ * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
+ * B.8.2.7 for the rationale behind the *_unlocked() macros.
+ */
+#ifndef __FILENO_C
+static __inline int
+fileno_unlocked(FILE *p)
+{
+ return __sfileno(p);
+}
+#endif
+#endif
+
#ifndef __cplusplus
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
@@ -494,10 +522,6 @@
#define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
#define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
-#if __POSIX_VISIBLE
-#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
-#endif
-
#define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
#define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
@@ -512,7 +536,6 @@
#define feof_unlocked(p) __sfeof(p)
#define ferror_unlocked(p) __sferror(p)
#define clearerr_unlocked(p) __sclearerr(p)
-#define fileno_unlocked(p) __sfileno(p)
#endif
#if __POSIX_VISIBLE >= 199506
#define getc_unlocked(fp) __sgetc(fp)
Index: lib/libc/stdio/fileno.c
===================================================================
--- lib/libc/stdio/fileno.c
+++ lib/libc/stdio/fileno.c
@@ -37,6 +37,7 @@
__FBSDID("$FreeBSD$");
#include "namespace.h"
+#define __FILENO_C
#include <stdio.h>
#include "un-namespace.h"
#include "libc_private.h"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 13, 5:00 AM (18 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29609508
Default Alt Text
D4980.id12421.diff (2 KB)
Attached To
Mode
D4980: Avoid C++ namespace pollution from POSIX headers
Attached
Detach File
Event Timeline
Log In to Comment