This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Sharing of bits/fcntl.h on Linux (SPARC, x86)
On Monday, October 22, 2012 13:43:09 Roland McGrath wrote:
> > Also under __USE_FILE_OFFSET64 or only under __USE_LARGEFILE64?
>
> Only under the latter. That's the condition under which <sys/types.h>
> will define off64_t.
OK, here's a revised patch, tested on Linux/x86-64.
Ok to commit now?
Andreas
2012-10-23 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.
[__USE_LARGEFILE64 && !__off64_t_defined]: Define off64_t.
[__USE_LARGEFILE64]: Use off64_t in declaration of lock64,
posix_fadvise64, posix_fallocate64.
diff --git a/io/fcntl.h b/io/fcntl.h
index 81f34bf..d9524f8 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -34,28 +34,31 @@ __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
+
+#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
+typedef __off64_t off64_t;
+# define __off64_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 +205,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 +234,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);
@@ -240,7 +243,7 @@ extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int lockf64 (int __fd, int __cmd, __off64_t __len);
+extern int lockf64 (int __fd, int __cmd, off64_t __len);
# endif
#endif
@@ -248,7 +251,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
@@ -260,7 +263,7 @@ extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
+extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
int __advise) __THROW;
# endif
@@ -270,7 +273,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,
@@ -281,7 +284,7 @@ extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
+extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
# endif
#endif
--
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