This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Sharing of bits/fcntl.h on Linux (SPARC, x86)


On 10/22/2012 06:49 PM, Roland McGrath wrote:
If the intent is that e.g. <fcntl.h> should declare off_t, then we should
change all the prototypes that appear in the header to use the public forms
of the types.

I'm feeling a bit unsure about this. Here's a patch to implement this. Should we also always define off64_t?

With this patch on x86-64, the conform test for POSIX passes completely.

Andreas

2012-10-22 Andreas Jaeger <aj@suse.de>

	* io/fcntl.h: Always define mode_t, off_t, pid_t and use these
	types for creat, creat64, lockf, posix_fadvise, posix_fallocate.

diff --git a/io/fcntl.h b/io/fcntl.h
index 81f34bf..8ac309a 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -34,28 +34,26 @@ __BEGIN_DECLS
    numbers and flag bits for `open', `fcntl', et al.  */
 #include <bits/fcntl.h>

-#if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
-# ifndef __mode_t_defined
+#ifndef __mode_t_defined
 typedef __mode_t mode_t;
-#  define __mode_t_defined
-# endif
+# define __mode_t_defined
+#endif

-# ifndef __off_t_defined
-#  ifndef __USE_FILE_OFFSET64
+#ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
 typedef __off_t off_t;
-#  else
+# else
 typedef __off64_t off_t;
-#  endif
-#  define __off_t_defined
 # endif
+# define __off_t_defined
+#endif

-# ifndef __pid_t_defined
+#ifndef __pid_t_defined
 typedef __pid_t pid_t;
-#  define __pid_t_defined
-# endif
-#endif	/* X/Open */
+# define __pid_t_defined
+#endif

/* For XPG all symbols from <sys/stat.h> should also be available. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
@@ -202,17 +200,17 @@ extern int openat64 (int __fd, const char *__file, int __oflag, ...)
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_FILE_OFFSET64
-extern int creat (const char *__file, __mode_t __mode) __nonnull ((1));
+extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
#else
# ifdef __REDIRECT
-extern int __REDIRECT (creat, (const char *__file, __mode_t __mode),
+extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
creat64) __nonnull ((1));
# else
# define creat creat64
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
+extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
#endif


#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
@@ -231,7 +229,7 @@ extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
# define F_TEST 3 /* Test a region for other processes locks. */


# ifndef __USE_FILE_OFFSET64
-extern int lockf (int __fd, int __cmd, __off_t __len);
+extern int lockf (int __fd, int __cmd, off_t __len);
# else
# ifdef __REDIRECT
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
@@ -248,7 +246,7 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len);
/* Advice the system about the expected behaviour of the application with
respect to the file associated with FD. */
# ifndef __USE_FILE_OFFSET64
-extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
+extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
int __advise) __THROW;
# else
# ifdef __REDIRECT_NTH
@@ -270,7 +268,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
-extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
+extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
# else
# ifdef __REDIRECT
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,



-- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]