Commit 7c743d1f authored by Nils Goroll's avatar Nils Goroll

get lp64 right for interposer

platform dependencies, remove functions we invented, done implement functions which don't exist on the platform

linux needs sys/time.h
no lutimes on solaris
also fix return value of readlinkat (also _s_size_t)
there is no rmdirat, remove our invention
only implement mkostemp* where they exist
parent 44ada9e4
......@@ -48,6 +48,7 @@ stdarg.h
dirent.h
sys/mkdev.h
sys/stat_impl.h
sys/time.h
)
## functions we currently require.
......@@ -102,6 +103,9 @@ attropen
fgetxattr
fsetxattr
_xstat
lutimes
mkostemp
mkostemps
)
......
......@@ -58,6 +58,10 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
// linux futimesat utimes lutimes
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <utime.h> // utimbuf
......
......@@ -8,9 +8,12 @@ FUNCTION(int, rmdir, const char *)
FUNCTION(int, mkdir, const char *, mode_t)
FUNCTION(int, rename, const char *, const char *)
FUNCTION(int, utimes, const char *, const struct timeval *)
FUNCTION(int, lutimes, const char *, const struct timeval *)
FUNCTION(int, utime, const char *, const struct utimbuf *)
#if defined(HAVE_LUTIMES)
FUNCTION(int, lutimes, const char *, const struct timeval *)
#endif
/* at funcs */
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
......@@ -22,7 +25,7 @@ FUNCTION(int, unlinkat, int, const char *, int)
FUNCTION(int, symlinkat, const char *, int, const char *)
#endif
#if defined(HAVE_READLINKAT)
FUNCTION(int, readlinkat, int, const char *, char *, size_t)
FUNCTION(ssize_t, readlinkat, int, const char *, char *, size_t)
#endif
FUNCTION(int, fchownat, int, const char *, uid_t, gid_t, int)
#if defined(HAVE_MKNODAT)
......@@ -31,7 +34,6 @@ FUNCTION(int, mknodat, int, const char *, mode_t, dev_t)
#if defined(HAVE_MKFIFOAT)
FUNCTION(int, mkfifoat, int, const char *, mode_t)
#endif
FUNCTION(int, rmdirat, int, const char *)
#if defined(HAVE_MKDIRAT)
FUNCTION(int, mkdirat, int, const char *, mode_t)
#endif
......@@ -56,9 +58,6 @@ FUNCTION(int, lchown, const char *, uid_t, gid_t)
/* mkstemp */
FUNCTION(char *, mktemp, char *)
FUNCTION(char *, mkdtemp, char *)
/* mkstemp GNU */
#if defined(_GNU_SOURCE)
#endif
FUNCTION(DIR *, opendir, const char *)
......
......@@ -33,14 +33,19 @@ FUNCTION(int, lstat, const char *, struct stat *)
#endif /* __XOPEN... */
/* 64 mkstemp*/
FUNCTION(int, mkstemp, char *)
FUNCTION(int, mkstemps, char *, int)
FUNCTION(int, mkstemp, char *)
FUNCTION(int, mkstemps, char *, int)
FUNCTION64(int, mkstemp, char *)
FUNCTION64(int, mkstemps, char *, int)
/* 64 mkstemp GNU*/
#if defined(_GNU_SOURCE)
#if defined(HAVE_MKOSTEMP)
FUNCTION64(int, mkostemp, char *, int)
FUNCTION(int, mkostemp, char *, int)
#endif
#if defined(HAVE_MKOSTEMPS)
FUNCTION(int, mkostemps, char *, int, int)
FUNCTION64(int, mkostemps, char *, int, int)
FUNCTION(int, mkostemp, char *, int)
FUNCTION(int, mkostemps, char *, int, int)
#endif
#endif /* GNU_SOURCE */
......@@ -64,6 +64,9 @@
#else
#define _FILE_OFFSET_BITS 32
#endif
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#ifdef HAVE_ASSERT_H
#include <assert.h>
......@@ -85,6 +88,36 @@
# endif
#endif
#ifdef INTERPOSE
# include <longpath/longpath_common.h>
# define real(x) real_ ## x
# if defined(_LP64)
# define real64(x) real_ ## x
# else
# define real64(x) real_ ## x ## 64
# endif
# define our(x) x
# if defined(_LP64)
# define our64(x) x
# else
# define our64(x) x ## 64
# endif
#else /* ! INTERPOSE */
# include <longpath/longpath.h>
# define real(x) x
# if defined(_LP64)
# define real64(x) x
# else
# define real64(x) x ## 64
# endif
# define our(x) x ## l
# if defined(_LP64)
# define our64(x) x ## l
# else
# define our64(x) x ## l ## 64
# endif
#endif /* INTERPOSE */
// string functions
#if defined(HAVE_STRING_H)
# include <string.h>
......@@ -117,28 +150,6 @@
# include <sys/xattr.h>
#endif
#ifdef INTERPOSE
# include <longpath/longpath_common.h>
# define real(x) real_ ## x
# define real64(x) real_ ## x ## 64
# define our(x) x
# define our64(x) x ## 64
#else /* ! INTERPOSE */
# include <longpath/longpath.h>
# define real(x) x
# if defined(_LP64)
# define real64(x) x
# else
# define real64(x) x ## 64
# endif
# define our(x) x ## l
# if defined(_LP64)
# define our64(x) x ## l
# else
# define our64(x) x ## l ## 64
# endif
#endif /* INTERPOSE */
static int _openat(int, const char *, int, mode_t mode);
#if !defined(_LP64)
static int _openat64(int, const char *, int, mode_t mode);
......@@ -617,7 +628,7 @@ our(symlink)(const char *dest, const char *path) {
/** READLINK **/
#ifdef HAVE_READLINKAT
int
ssize_t
our(readlinkat)(int fd, const char *name, char *buf, size_t count) {
Xatl(real(readlinkat), fd, name, buf, count);
}
......@@ -761,14 +772,9 @@ our64(lstat)(const char *name, struct stat64 *sb) {
/* RMDIR */
int
our(rmdirat)(int fd, const char *name) {
return our(unlinkat)(fd, name, AT_REMOVEDIR);
}
int
our(rmdir)(const char *name) {
return our(rmdirat)(AT_FDCWD, name);
return our(unlinkat)(AT_FDCWD, name, AT_REMOVEDIR);
}
/* MKDIR */
......@@ -1041,16 +1047,6 @@ our(mkstemps)(char *template, int slen) {
return _mkxtempl(template, slen, 0, T_FILE);
}
int
our(mkostemp)(char *template, int flags) {
return _mkxtempl(template, 0, flags, T_FILE);
}
int
our(mkostemps)(char *template, int slen, int flags) {
return _mkxtempl(template, slen, flags, T_FILE);
}
#if !defined(_LP64)
int
our64(mkstemp)(char *template) {
......@@ -1061,17 +1057,39 @@ int
our64(mkstemps)(char *template, int slen) {
return _mkxtempl(template, slen, 0, T_FILE64);
}
#endif /* ! _LP64 */
/* mkstemp GNU */
#if defined(_GNU_SOURCE)
#if defined(HAVE_MKOSTEMP)
int
our(mkostemp)(char *template, int flags) {
return _mkxtempl(template, 0, flags, T_FILE);
}
#endif
#if defined(HAVE_MKOSTEMPS)
int
our(mkostemps)(char *template, int slen, int flags) {
return _mkxtempl(template, slen, flags, T_FILE);
}
#endif
#if !defined(_LP64)
#if defined(HAVE_MKOSTEMP)
int
our64(mkostemp)(char *template, int flags) {
return _mkxtempl(template, 0, flags, T_FILE64);
}
#endif
#if defined(HAVE_MKOSTEMPS)
int
our64(mkostemps)(char *template, int slen, int flags) {
return _mkxtempl(template, slen, flags, T_FILE64);
}
#endif
#endif /* HAVE_MKOSTEMPS */
#endif /* ! _LP64 */
#endif /* _GNU_SOURCE */
/* UTIMES */
......@@ -1139,6 +1157,7 @@ our(utimes)(const char *path, const struct timeval tv[2]) {
return our(utimensat)(AT_FDCWD, path, tsp, 0);
}
#if defined(HAVE_LUTIMES)
int
our(lutimes)(const char *path, const struct timeval tv[2]) {
struct timespec ts[2];
......@@ -1148,6 +1167,7 @@ our(lutimes)(const char *path, const struct timeval tv[2]) {
return our(utimensat)(AT_FDCWD, path, tsp, AT_SYMLINK_NOFOLLOW);
}
#endif
int
our(utime)(const char *path, const struct utimbuf *times) {
......
......@@ -277,8 +277,12 @@ test_ ## fname(const char *path, const char *templsuff) { \
t_mkXstempXl(mkstempl)
t_mkXstempXl(mkstempsl, strlen(templsuff))
#if defined(HAVE_MKOSTEMP)
t_mkXstempXl(mkostempl, O_SYNC)
#endif
#if defined(HAVE_MKOSTEMPL)
t_mkXstempXl(mkostempsl, strlen(templsuff), O_SYNC)
#endif
static void
test_mkXstempXl(const char *path) {
......@@ -288,8 +292,12 @@ test_mkXstempXl(const char *path) {
/* TEST mkostempsl */
test_mkstempl(path, "");
test_mkstempsl(path, "suffix123");
#if defined(HAVE_MKOSTEMP)
test_mkostempl(path, "");
#endif
#if defined(HAVE_MKOSTEMPL)
test_mkostempsl(path, "suffix123");
#endif
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment