diff options
-rw-r--r-- | ChangeLog.txt | 6 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | ports/darwin/guts/fcntl.c | 4 | ||||
-rw-r--r-- | ports/darwin/guts/open.c | 4 | ||||
-rw-r--r-- | ports/unix/guts/access.c | 6 | ||||
-rw-r--r-- | ports/unix/guts/fchmod.c | 8 | ||||
-rw-r--r-- | ports/unix/guts/fchmodat.c | 14 | ||||
-rw-r--r-- | ports/unix/guts/fchown.c | 12 | ||||
-rw-r--r-- | ports/unix/guts/fchownat.c | 16 | ||||
-rw-r--r-- | ports/unix/guts/fopen.c | 14 | ||||
-rw-r--r-- | ports/unix/guts/freopen.c | 12 | ||||
-rw-r--r-- | ports/unix/guts/link.c | 12 | ||||
-rw-r--r-- | ports/unix/guts/mkdirat.c | 10 | ||||
-rw-r--r-- | ports/unix/guts/mkdtemp.c | 8 | ||||
-rw-r--r-- | ports/unix/guts/mknodat.c | 10 | ||||
-rw-r--r-- | ports/unix/guts/mkstemp.c | 12 | ||||
-rw-r--r-- | ports/unix/guts/opendir.c | 10 | ||||
-rw-r--r-- | ports/unix/guts/remove.c | 6 | ||||
-rw-r--r-- | ports/unix/guts/rename.c | 18 | ||||
-rw-r--r-- | ports/unix/guts/renameat.c | 20 | ||||
-rw-r--r-- | ports/unix/guts/rmdir.c | 12 | ||||
-rw-r--r-- | ports/unix/guts/symlinkat.c | 10 | ||||
-rw-r--r-- | ports/unix/guts/unlinkat.c | 14 | ||||
-rw-r--r-- | pseudo_client.c | 21 | ||||
-rw-r--r-- | pseudo_client.h | 10 | ||||
-rw-r--r-- | pseudo_ipc.c | 21 | ||||
-rw-r--r-- | pseudo_ipc.h | 7 | ||||
-rw-r--r-- | pseudo_wrappers.c | 4 |
28 files changed, 132 insertions, 171 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index c101fc6..de1ff31 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +2012-08-02: + * (seebs) fix some Darwin-specific bitrot for clang/llvm. + * (seebs) Drop the _plain thing, convert unix/guts/* to use + PSEUDO_STATBUF. + * (seebs) Tag 1.4.1. + 2012-07-27: * (seebs) Convert from .tgz to tar.bz2 since that's handier for Yocto. diff --git a/Makefile.in b/Makefile.in index d49e879..83fc89f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,7 +26,7 @@ BITS=@BITS@ ARCH_FLAGS=@ARCH_FLAGS@ MARK64=@MARK64@ RPATH=@RPATH@ -VERSION=1.4 +VERSION=1.4.1 LIB=@LIB@ BIN=bin diff --git a/ports/darwin/guts/fcntl.c b/ports/darwin/guts/fcntl.c index ef42b33..1cc8258 100644 --- a/ports/darwin/guts/fcntl.c +++ b/ports/darwin/guts/fcntl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Wind River Systems; see + * Copyright (c) 2011, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * int fcntl(int fd, int cmd, ... { struct flock *lock }) @@ -7,8 +7,6 @@ */ int save_errno; long long flag = 0; - void *ptr = 0; - off_t off = 0; va_start(ap, cmd); flag = va_arg(ap, long long); diff --git a/ports/darwin/guts/open.c b/ports/darwin/guts/open.c index dba6800..1ed5882 100644 --- a/ports/darwin/guts/open.c +++ b/ports/darwin/guts/open.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2011 Wind River Systems; see + * Copyright (c) 2011, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * int open(const char *path, int flags, ... { int mode }) * int rc = -1; */ - struct stat buf = { 0 }; + struct stat buf = { }; int existed = 1; int save_errno; diff --git a/ports/unix/guts/access.c b/ports/unix/guts/access.c index 5a92957..0093a3b 100644 --- a/ports/unix/guts/access.c +++ b/ports/unix/guts/access.c @@ -1,17 +1,17 @@ /* - * Copyright (c) 2010 Wind River Systems; see + * Copyright (c) 2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int * wrap_access(const char *path, int mode) { * int rc = -1; */ - struct stat buf; + PSEUDO_STATBUF buf; /* note: no attempt to handle the case where user isn't * root. */ - rc = real_stat(path, &buf); + rc = base_stat(path, &buf); if (rc == -1) return rc; diff --git a/ports/unix/guts/fchmod.c b/ports/unix/guts/fchmod.c index 7c6a6ad..1d4fae8 100644 --- a/ports/unix/guts/fchmod.c +++ b/ports/unix/guts/fchmod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,15 +7,15 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; int save_errno = errno; - if (real_fstat(fd, &buf) == -1) { + if (base_fstat(fd, &buf) == -1) { /* can't stat it, can't chmod it */ return -1; } buf.st_mode = (buf.st_mode & ~07777) | (mode & 07777); - msg = pseudo_client_op_plain(OP_FCHMOD, 0, fd, -1, 0, &buf); + msg = pseudo_client_op(OP_FCHMOD, 0, fd, -1, 0, &buf); real_fchmod(fd, PSEUDO_FS_MODE(mode, S_ISDIR(buf.st_mode))); if (msg && msg->result != RESULT_SUCCEED) { errno = EPERM; diff --git a/ports/unix/guts/fchmodat.c b/ports/unix/guts/fchmodat.c index 5095c77..a14d1b1 100644 --- a/ports/unix/guts/fchmodat.c +++ b/ports/unix/guts/fchmodat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,7 +7,7 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS @@ -16,12 +16,12 @@ return -1; } if (flags & AT_SYMLINK_NOFOLLOW) { - rc = real_lstat(path, &buf); + rc = base_lstat(path, &buf); } else { - rc = real_stat(path, &buf); + rc = base_stat(path, &buf); } #else - rc = real___fxstatat(_STAT_VER, dirfd, path, &buf, flags); + rc = base_fstatat(dirfd, path, &buf, flags); #endif if (rc == -1) { return rc; @@ -36,7 +36,7 @@ /* purely for debugging purposes: check whether file * is already in database. */ - msg = pseudo_client_op_plain(OP_STAT, 0, -1, -1, path, &buf); + msg = pseudo_client_op(OP_STAT, 0, -1, -1, path, &buf); if (!msg || msg->result != RESULT_SUCCEED) { pseudo_debug(2, "chmodat to 0%o on %d/%s, ino %llu, new file.\n", mode, dirfd, path, (unsigned long long) buf.st_ino); @@ -57,7 +57,7 @@ */ buf.st_mode = (buf.st_mode & ~07777) | (mode & 07777); - msg = pseudo_client_op_plain(OP_CHMOD, 0, -1, dirfd, path, &buf); + msg = pseudo_client_op(OP_CHMOD, 0, -1, dirfd, path, &buf); if (msg && msg->result != RESULT_SUCCEED) { errno = EPERM; rc = -1; diff --git a/ports/unix/guts/fchown.c b/ports/unix/guts/fchown.c index c36a869..72a1e46 100644 --- a/ports/unix/guts/fchown.c +++ b/ports/unix/guts/fchown.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,10 +7,10 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; - if (real_fstat(fd, &buf) == -1) { + if (base_fstat(fd, &buf) == -1) { save_errno = errno; pseudo_debug(2, "fchown failing because fstat failed: %s\n", strerror(errno)); @@ -18,11 +18,11 @@ return -1; } if (owner == (uid_t) -1 || group == (gid_t) -1) { - msg = pseudo_client_op_plain(OP_STAT, 0, fd, -1, NULL, &buf); + msg = pseudo_client_op(OP_STAT, 0, fd, -1, NULL, &buf); /* copy in any existing values... */ if (msg) { if (msg->result == RESULT_SUCCEED) { - pseudo_stat_msg_plain(&buf, msg); + pseudo_stat_msg(&buf, msg); } else { pseudo_debug(2, "fchown fd %d, ino %llu, unknown file.\n", fd, (unsigned long long) buf.st_ino); @@ -41,7 +41,7 @@ } pseudo_debug(2, "fchown, fd %d: %d:%d -> %d:%d\n", fd, owner, group, buf.st_uid, buf.st_gid); - msg = pseudo_client_op_plain(OP_FCHOWN, 0, fd, -1, 0, &buf); + msg = pseudo_client_op(OP_FCHOWN, 0, fd, -1, 0, &buf); if (msg && msg->result != RESULT_SUCCEED) { errno = EPERM; rc = -1; diff --git a/ports/unix/guts/fchownat.c b/ports/unix/guts/fchownat.c index 9585fb0..8d3ee05 100644 --- a/ports/unix/guts/fchownat.c +++ b/ports/unix/guts/fchownat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,7 +7,7 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; int doing_link = 0; @@ -17,12 +17,12 @@ return -1; } if (flags & AT_SYMLINK_NOFOLLOW) { - rc = real_lstat(path, &buf); + rc = base_lstat(path, &buf); } else { - rc = real_stat(path, &buf); + rc = base_stat(path, &buf); } #else - rc = real___fxstatat(_STAT_VER, dirfd, path, &buf, flags); + rc = base_fstatat(dirfd, path, &buf, flags); #endif if (rc == -1) { return rc; @@ -34,11 +34,11 @@ save_errno = errno; if (owner == (uid_t) -1 || group == (gid_t) -1) { - msg = pseudo_client_op_plain(OP_STAT, 0, -1, -1, path, &buf); + msg = pseudo_client_op(OP_STAT, 0, -1, -1, path, &buf); /* copy in any existing values... */ if (msg) { if (msg->result == RESULT_SUCCEED) { - pseudo_stat_msg_plain(&buf, msg); + pseudo_stat_msg(&buf, msg); } else { pseudo_debug(2, "chownat to %d:%d on %d/%s, ino %llu, new file.\n", owner, group, dirfd, path, @@ -53,7 +53,7 @@ if (group != (gid_t) -1) { buf.st_gid = group; } - msg = pseudo_client_op_plain(OP_CHOWN, 0, -1, dirfd, path, &buf); + msg = pseudo_client_op(OP_CHOWN, 0, -1, dirfd, path, &buf); if (msg && msg->result != RESULT_SUCCEED) { errno = EPERM; rc = -1; diff --git a/ports/unix/guts/fopen.c b/ports/unix/guts/fopen.c index 9dd6c33..c7b8da5 100644 --- a/ports/unix/guts/fopen.c +++ b/ports/unix/guts/fopen.c @@ -1,14 +1,14 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static FILE * * wrap_fopen(const char *path, const char *mode) { * FILE * rc = 0; */ - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; - int existed = (real_stat(path, &buf) != -1); + int existed = (base_stat(path, &buf) != -1); rc = real_fopen(path, mode); save_errno = errno; @@ -17,15 +17,15 @@ int fd = fileno(rc); pseudo_debug(2, "fopen '%s': fd %d <FILE %p>\n", path, fd, (void *) rc); - if (real_fstat(fd, &buf) != -1) { + if (base_fstat(fd, &buf) != -1) { if (!existed) { - pseudo_client_op_plain(OP_CREAT, 0, -1, -1, path, &buf); + pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf); } - pseudo_client_op_plain(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf); + pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf); } else { pseudo_debug(1, "fopen (fd %d) succeeded, but fstat failed (%s).\n", fd, strerror(errno)); - pseudo_client_op_plain(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0); + pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0); } errno = save_errno; } diff --git a/ports/unix/guts/freopen.c b/ports/unix/guts/freopen.c index b5a7bfc..eb788b3 100644 --- a/ports/unix/guts/freopen.c +++ b/ports/unix/guts/freopen.c @@ -6,9 +6,9 @@ * wrap_freopen(const char *path, const char *mode, FILE *stream) { * FILE * rc = NULL; */ - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; - int existed = (real_stat(path, &buf) != -1); + int existed = (base_stat(path, &buf) != -1); rc = real_freopen(path, mode, stream); save_errno = errno; @@ -17,15 +17,15 @@ int fd = fileno(rc); pseudo_debug(2, "freopen '%s': fd %d\n", path, fd); - if (real_fstat(fd, &buf) != -1) { + if (base_fstat(fd, &buf) != -1) { if (!existed) { - pseudo_client_op_plain(OP_CREAT, 0, -1, -1, path, &buf); + pseudo_client_op(OP_CREAT, 0, -1, -1, path, &buf); } - pseudo_client_op_plain(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf); + pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, &buf); } else { pseudo_debug(1, "fopen (fd %d) succeeded, but stat failed (%s).\n", fd, strerror(errno)); - pseudo_client_op_plain(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0); + pseudo_client_op(OP_OPEN, pseudo_access_fopen(mode), fd, -1, path, 0); } errno = save_errno; } diff --git a/ports/unix/guts/link.c b/ports/unix/guts/link.c index 81316e2..09551ac 100644 --- a/ports/unix/guts/link.c +++ b/ports/unix/guts/link.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,7 +7,7 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; rc = real_link(oldpath, newpath); if (rc == 0) { @@ -19,16 +19,16 @@ * files they link to. This is contraPOSIX, but * it's apparently useful. */ - real_lstat(oldpath, &buf); + base_lstat(oldpath, &buf); /* a link should copy the existing database entry, if * there is one. OP_LINK is also used to insert unseen * files, though, so it can't be implicit. */ - msg = pseudo_client_op_plain(OP_STAT, 0, -1, -1, oldpath, &buf); + msg = pseudo_client_op(OP_STAT, 0, -1, -1, oldpath, &buf); if (msg) { - pseudo_stat_msg_plain(&buf, msg); + pseudo_stat_msg(&buf, msg); } - pseudo_client_op_plain(OP_LINK, 0, -1, -1, newpath, &buf); + pseudo_client_op(OP_LINK, 0, -1, -1, newpath, &buf); } /* return rc; diff --git a/ports/unix/guts/mkdirat.c b/ports/unix/guts/mkdirat.c index 97141fc..e846b70 100644 --- a/ports/unix/guts/mkdirat.c +++ b/ports/unix/guts/mkdirat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -16,16 +16,16 @@ rc = real_mkdirat(dirfd, path, PSEUDO_FS_MODE(mode, 1)); #endif if (rc != -1) { - struct stat buf; + PSEUDO_STATBUF buf; int stat_rc; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS - stat_rc = real_lstat(path, &buf); + stat_rc = base_lstat(path, &buf); #else - stat_rc = real___fxstatat(_STAT_VER, dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); + stat_rc = base_fstatat(dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); #endif if (stat_rc != -1) { - pseudo_client_op_plain(OP_MKDIR, 0, -1, dirfd, path, &buf); + pseudo_client_op(OP_MKDIR, 0, -1, dirfd, path, &buf); } else { pseudo_debug(1, "mkdir of %s succeeded, but stat failed: %s\n", path, strerror(errno)); diff --git a/ports/unix/guts/mkdtemp.c b/ports/unix/guts/mkdtemp.c index 92d4da7..194f0cb 100644 --- a/ports/unix/guts/mkdtemp.c +++ b/ports/unix/guts/mkdtemp.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Wind River Systems; see + * Copyright (c) 2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static char * * wrap_mkdtemp(char *template) { * char * rc = NULL; */ - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; size_t len; char *tmp_template; @@ -29,8 +29,8 @@ if (rc != NULL) { save_errno = errno; - if (real_stat(rc, &buf) != -1) { - pseudo_client_op_plain(OP_CREAT, 0, -1, -1, tmp_template, &buf); + if (base_stat(rc, &buf) != -1) { + pseudo_client_op(OP_CREAT, 0, -1, -1, tmp_template, &buf); } else { pseudo_debug(1, "mkdtemp (path %s) succeeded, but fstat failed (%s).\n", rc, strerror(errno)); diff --git a/ports/unix/guts/mknodat.c b/ports/unix/guts/mknodat.c index 2b24cd0..32a4d5b 100644 --- a/ports/unix/guts/mknodat.c +++ b/ports/unix/guts/mknodat.c @@ -7,16 +7,16 @@ */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS if (dirfd != AT_FDCWD) { errno = ENOSYS; return -1; } - rc = real_stat(path, &buf); + rc = base_stat(path, &buf); #else - rc = real___fxstatat(_STAT_VER, dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); + rc = base_fstatat(dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); #endif if (rc != -1) { /* if we can stat the file, you can't mknod it */ @@ -33,7 +33,7 @@ if (rc == -1) { return -1; } - real_fstat(rc, &buf); + base_fstat(rc, &buf); /* mknod does not really open the file. We don't have * to use wrap_close because we've never exposed this file * descriptor to the client code. @@ -44,7 +44,7 @@ buf.st_mode = (PSEUDO_DB_MODE(buf.st_mode, mode) & 07777) | (mode & ~07777); buf.st_rdev = dev; - msg = pseudo_client_op_plain(OP_MKNOD, 0, -1, dirfd, path, &buf); + msg = pseudo_client_op(OP_MKNOD, 0, -1, dirfd, path, &buf); if (msg && msg->result != RESULT_SUCCEED) { errno = EPERM; rc = -1; diff --git a/ports/unix/guts/mkstemp.c b/ports/unix/guts/mkstemp.c index 46c0be1..2ad3f19 100644 --- a/ports/unix/guts/mkstemp.c +++ b/ports/unix/guts/mkstemp.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int * wrap_mkstemp(char *template) { * int rc = -1; */ - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; size_t len; char *tmp_template; @@ -29,13 +29,13 @@ if (rc != -1) { save_errno = errno; - if (real_fstat(rc, &buf) != -1) { - pseudo_client_op_plain(OP_CREAT, 0, -1, -1, tmp_template, &buf); - pseudo_client_op_plain(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, &buf); + if (base_fstat(rc, &buf) != -1) { + pseudo_client_op(OP_CREAT, 0, -1, -1, tmp_template, &buf); + pseudo_client_op(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, &buf); } else { pseudo_debug(1, "mkstemp (fd %d) succeeded, but fstat failed (%s).\n", rc, strerror(errno)); - pseudo_client_op_plain(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, 0); + pseudo_client_op(OP_OPEN, PSA_READ | PSA_WRITE, rc, -1, tmp_template, 0); } errno = save_errno; } diff --git a/ports/unix/guts/opendir.c b/ports/unix/guts/opendir.c index e69717e..31f5738 100644 --- a/ports/unix/guts/opendir.c +++ b/ports/unix/guts/opendir.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010 Wind River Systems; see + * Copyright (c) 2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static DIR * * wrap_opendir(const char *path) { * DIR * rc = NULL; */ - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; rc = real_opendir(path); @@ -14,12 +14,12 @@ int fd; save_errno = errno; fd = dirfd(rc); - if (real_fstat(fd, &buf) == -1) { + if (base_fstat(fd, &buf) == -1) { pseudo_debug(1, "diropen (fd %d) succeeded, but fstat failed (%s).\n", fd, strerror(errno)); - pseudo_client_op_plain(OP_OPEN, PSA_READ, fd, -1, path, 0); + pseudo_client_op(OP_OPEN, PSA_READ, fd, -1, path, 0); } else { - pseudo_client_op_plain(OP_OPEN, PSA_READ, fd, -1, path, &buf); + pseudo_client_op(OP_OPEN, PSA_READ, fd, -1, path, &buf); } diff --git a/ports/unix/guts/remove.c b/ports/unix/guts/remove.c index 902a640..4e2cecb 100644 --- a/ports/unix/guts/remove.c +++ b/ports/unix/guts/remove.c @@ -1,13 +1,13 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int * wrap_remove(const char *path) { * int rc = -1; */ - struct stat buf; - if (real_lstat(path, &buf) == -1) { + PSEUDO_STATBUF buf; + if (base_lstat(path, &buf) == -1) { errno = ENOENT; return -1; } diff --git a/ports/unix/guts/rename.c b/ports/unix/guts/rename.c index 04892c1..1473a8d 100644 --- a/ports/unix/guts/rename.c +++ b/ports/unix/guts/rename.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,7 +7,7 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat oldbuf, newbuf; + PSEUDO_STATBUF oldbuf, newbuf; int oldrc, newrc; int save_errno; int old_db_entry = 0; @@ -23,14 +23,14 @@ save_errno = errno; - newrc = real_lstat(newpath, &newbuf); - oldrc = real_lstat(oldpath, &oldbuf); + newrc = base_lstat(newpath, &newbuf); + oldrc = base_lstat(oldpath, &oldbuf); errno = save_errno; /* newpath must be removed. */ /* as with unlink, we have to mark that the file may get deleted */ - msg = pseudo_client_op_plain(OP_MAY_UNLINK, 0, -1, -1, newpath, newrc ? NULL : &newbuf); + msg = pseudo_client_op(OP_MAY_UNLINK, 0, -1, -1, newpath, newrc ? NULL : &newbuf); if (msg && msg->result == RESULT_SUCCEED) old_db_entry = 1; rc = real_rename(oldpath, newpath); @@ -40,10 +40,10 @@ /* since we failed, that wasn't really unlinked -- put * it back. */ - pseudo_client_op_plain(OP_CANCEL_UNLINK, 0, -1, -1, newpath, &newbuf); + pseudo_client_op(OP_CANCEL_UNLINK, 0, -1, -1, newpath, &newbuf); } else { /* confirm that the file was removed */ - pseudo_client_op_plain(OP_DID_UNLINK, 0, -1, -1, newpath, &newbuf); + pseudo_client_op(OP_DID_UNLINK, 0, -1, -1, newpath, &newbuf); } } if (rc == -1) { @@ -86,9 +86,9 @@ } pseudo_debug(1, "creating new '%s' [%llu] to rename\n", oldpath, (unsigned long long) oldbuf.st_ino); - pseudo_client_op_plain(OP_LINK, 0, -1, -1, oldpath, &oldbuf); + pseudo_client_op(OP_LINK, 0, -1, -1, oldpath, &oldbuf); } - pseudo_client_op_plain(OP_RENAME, 0, -1, -1, newpath, &oldbuf, oldpath); + pseudo_client_op(OP_RENAME, 0, -1, -1, newpath, &oldbuf, oldpath); errno = save_errno; /* return rc; diff --git a/ports/unix/guts/renameat.c b/ports/unix/guts/renameat.c index f13cd1e..d8138bb 100644 --- a/ports/unix/guts/renameat.c +++ b/ports/unix/guts/renameat.c @@ -7,7 +7,7 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat oldbuf, newbuf; + PSEUDO_STATBUF oldbuf, newbuf; int oldrc, newrc; int save_errno; int old_db_entry = 0; @@ -31,18 +31,18 @@ save_errno = errno; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS - newrc = real_lstat(newpath, &newbuf); - oldrc = real_lstat(oldpath, &oldbuf); + newrc = base_lstat(newpath, &newbuf); + oldrc = base_lstat(oldpath, &oldbuf); #else - oldrc = real___fxstatat(_STAT_VER, olddirfd, oldpath, &oldbuf, AT_SYMLINK_NOFOLLOW); - newrc = real___fxstatat(_STAT_VER, newdirfd, newpath, &newbuf, AT_SYMLINK_NOFOLLOW); + oldrc = base_fstatat(olddirfd, oldpath, &oldbuf, AT_SYMLINK_NOFOLLOW); + newrc = base_fstatat(newdirfd, newpath, &newbuf, AT_SYMLINK_NOFOLLOW); #endif errno = save_errno; /* newpath must be removed. */ /* as with unlink, we have to mark that the file may get deleted */ - msg = pseudo_client_op_plain(OP_MAY_UNLINK, 0, -1, newdirfd, newpath, newrc ? NULL : &newbuf); + msg = pseudo_client_op(OP_MAY_UNLINK, 0, -1, newdirfd, newpath, newrc ? NULL : &newbuf); if (msg && msg->result == RESULT_SUCCEED) old_db_entry = 1; rc = real_renameat(olddirfd, oldpath, newdirfd, newpath); @@ -52,10 +52,10 @@ /* since we failed, that wasn't really unlinked -- put * it back. */ - pseudo_client_op_plain(OP_CANCEL_UNLINK, 0, -1, newdirfd, newpath, &newbuf); + pseudo_client_op(OP_CANCEL_UNLINK, 0, -1, newdirfd, newpath, &newbuf); } else { /* confirm that the file was removed */ - pseudo_client_op_plain(OP_DID_UNLINK, 0, -1, newdirfd, newpath, &newbuf); + pseudo_client_op(OP_DID_UNLINK, 0, -1, newdirfd, newpath, &newbuf); } } if (rc == -1) { @@ -98,12 +98,12 @@ } pseudo_debug(1, "creating new '%s' [%llu] to rename\n", oldpath, (unsigned long long) oldbuf.st_ino); - pseudo_client_op_plain(OP_LINK, 0, -1, olddirfd, oldpath, &oldbuf); + pseudo_client_op(OP_LINK, 0, -1, olddirfd, oldpath, &oldbuf); } /* special case: use 'fd' for olddirfd, because * we know it has no other meaning for RENAME */ - pseudo_client_op_plain(OP_RENAME, 0, olddirfd, newdirfd, newpath, &oldbuf, oldpath); + pseudo_client_op(OP_RENAME, 0, olddirfd, newdirfd, newpath, &oldbuf, oldpath); errno = save_errno; /* return rc; diff --git a/ports/unix/guts/rmdir.c b/ports/unix/guts/rmdir.c index 7307fcd..a47e01c 100644 --- a/ports/unix/guts/rmdir.c +++ b/ports/unix/guts/rmdir.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -7,25 +7,25 @@ * int rc = -1; */ pseudo_msg_t *msg; - struct stat buf; + PSEUDO_STATBUF buf; int save_errno; int old_db_entry = 0; - rc = real_lstat(path, &buf); + rc = base_lstat(path, &buf); if (rc == -1) { return rc; } - msg = pseudo_client_op_plain(OP_MAY_UNLINK, 0, -1, -1, path, &buf); + msg = pseudo_client_op(OP_MAY_UNLINK, 0, -1, -1, path, &buf); if (msg && msg->result == RESULT_SUCCEED) old_db_entry = 1; rc = real_rmdir(path); if (old_db_entry) { if (rc == -1) { save_errno = errno; - pseudo_client_op_plain(OP_CANCEL_UNLINK, 0, -1, -1, path, &buf); + pseudo_client_op(OP_CANCEL_UNLINK, 0, -1, -1, path, &buf); errno = save_errno; } else { - pseudo_client_op_plain(OP_DID_UNLINK, 0, -1, -1, path, &buf); + pseudo_client_op(OP_DID_UNLINK, 0, -1, -1, path, &buf); } } else { pseudo_debug(1, "rmdir on <%s>, not in database, no effect.\n", path); diff --git a/ports/unix/guts/symlinkat.c b/ports/unix/guts/symlinkat.c index 9912c31..1346db1 100644 --- a/ports/unix/guts/symlinkat.c +++ b/ports/unix/guts/symlinkat.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int * wrap_symlinkat(const char *oldname, int dirfd, const char *newpath) { * int rc = -1; */ - struct stat buf; + PSEUDO_STATBUF buf; char *roldname = 0; if (oldname[0] == '/' && pseudo_chroot_len && !pseudo_nosymlinkexp) { @@ -30,9 +30,9 @@ return rc; } #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS - rc = real_lstat(newpath, &buf); + rc = base_lstat(newpath, &buf); #else - rc = real___fxstatat(_STAT_VER, dirfd, newpath, &buf, AT_SYMLINK_NOFOLLOW); + rc = base_fstatat(dirfd, newpath, &buf, AT_SYMLINK_NOFOLLOW); #endif if (rc == -1) { int save_errno = errno; @@ -43,7 +43,7 @@ return rc; } /* just record the entry */ - pseudo_client_op_plain(OP_SYMLINK, 0, -1, dirfd, newpath, &buf); + pseudo_client_op(OP_SYMLINK, 0, -1, dirfd, newpath, &buf); free(roldname); diff --git a/ports/unix/guts/unlinkat.c b/ports/unix/guts/unlinkat.c index 7b51ab9..8a359d1 100644 --- a/ports/unix/guts/unlinkat.c +++ b/ports/unix/guts/unlinkat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2010 Wind River Systems; see + * Copyright (c) 2008-2010, 2012 Wind River Systems; see * guts/COPYRIGHT for information. * * static int @@ -8,7 +8,7 @@ */ pseudo_msg_t *msg; int save_errno; - struct stat buf; + PSEUDO_STATBUF buf; int old_db_entry; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS @@ -29,14 +29,14 @@ #endif #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS - rc = real_lstat(path, &buf); + rc = base_lstat(path, &buf); #else - rc = real___fxstatat(_STAT_VER, dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); + rc = base_fstatat(dirfd, path, &buf, AT_SYMLINK_NOFOLLOW); #endif if (rc == -1) { return rc; } - msg = pseudo_client_op_plain(OP_MAY_UNLINK, 0, -1, dirfd, path, &buf); + msg = pseudo_client_op(OP_MAY_UNLINK, 0, -1, dirfd, path, &buf); if (msg && msg->result == RESULT_SUCCEED) old_db_entry = 1; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS @@ -47,10 +47,10 @@ if (old_db_entry) { if (rc == -1) { save_errno = errno; - pseudo_client_op_plain(OP_CANCEL_UNLINK, 0, -1, -1, path, &buf); + pseudo_client_op(OP_CANCEL_UNLINK, 0, -1, -1, path, &buf); errno = save_errno; } else { - pseudo_client_op_plain(OP_DID_UNLINK, 0, -1, -1, path, &buf); + pseudo_client_op(OP_DID_UNLINK, 0, -1, -1, path, &buf); } } else { pseudo_debug(1, "unlink on <%s>, not in database, no effect.\n", path); diff --git a/pseudo_client.c b/pseudo_client.c index 4a30420..4150a89 100644 --- a/pseudo_client.c +++ b/pseudo_client.c @@ -1025,27 +1025,6 @@ base_path(int dirfd, const char *path, int leave_last) { return newpath; } -#if PSEUDO_STATBUF_64 -pseudo_msg_t * -pseudo_client_op_plain(pseudo_op_t op, int access, int fd, int dirfd, const char *path, const struct stat *buf, ...) { - char *oldpath = NULL; - PSEUDO_STATBUF buf64; - - if (op == OP_RENAME) { - va_list ap; - va_start(ap, buf); - oldpath = va_arg(ap, char *); - va_end(ap); - } - if (buf) { - pseudo_stat64_from32(&buf64, buf); - return pseudo_client_op(op, access, fd, dirfd, path, &buf64, oldpath); - } else { - return pseudo_client_op(op, access, fd, dirfd, path, NULL, oldpath); - } -} -#endif - pseudo_msg_t * pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path, const PSEUDO_STATBUF *buf, ...) { pseudo_msg_t *result = 0; diff --git a/pseudo_client.h b/pseudo_client.h index e3ad02b..80880b4 100644 --- a/pseudo_client.h +++ b/pseudo_client.h @@ -19,9 +19,15 @@ */ extern pseudo_msg_t *pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path, const PSEUDO_STATBUF *buf, ...); #if PSEUDO_STATBUF_64 -extern pseudo_msg_t *pseudo_client_op_plain(pseudo_op_t op, int access, int fd, int dirfd, const char *path, const struct stat *buf, ...); +#define base_lstat lstat64 +#define base_fstat fstat64 +#define base_stat stat64 +#define base_fstatat(dirfd, path, buf, flags) real___fxstatat64(_STAT_VER, dirfd, path, buf, flags) #else -#define pseudo_client_op_plain pseudo_client_op +#define base_lstat lstat +#define base_fstat fstat +#define base_stat stat +#define base_fstatat(dirfd, path, buf, flags) real___fxstatat(_STAT_VER, dirfd, path, buf, flags) #endif extern void pseudo_antimagic(void); extern void pseudo_magic(void); diff --git a/pseudo_ipc.c b/pseudo_ipc.c index 341c647..b76e37a 100644 --- a/pseudo_ipc.c +++ b/pseudo_ipc.c @@ -241,24 +241,3 @@ pseudo_stat_msg(PSEUDO_STATBUF *buf, const pseudo_msg_t *msg) { buf->st_mode = msg->mode; buf->st_rdev = msg->rdev; } - -#if PSEUDO_STATBUF_64 -void -pseudo_msg_stat_plain(pseudo_msg_t *msg, const struct stat *buf) { - PSEUDO_STATBUF buf64; - if (buf) { - pseudo_stat64_from32(&buf64, buf); - pseudo_msg_stat(msg, &buf64); - } -} - -void -pseudo_stat_msg_plain(struct stat *buf, const pseudo_msg_t *msg) { - PSEUDO_STATBUF buf64; - if (buf) { - pseudo_stat64_from32(&buf64, buf); - pseudo_stat_msg(&buf64, msg); - pseudo_stat32_from64(buf, &buf64); - } -} -#endif diff --git a/pseudo_ipc.h b/pseudo_ipc.h index 48aaa38..46277bc 100644 --- a/pseudo_ipc.h +++ b/pseudo_ipc.h @@ -66,10 +66,3 @@ extern int pseudo_msg_send(int fd, pseudo_msg_t *, size_t, const char *); void pseudo_msg_stat(pseudo_msg_t *msg, const PSEUDO_STATBUF *buf); void pseudo_stat_msg(PSEUDO_STATBUF *buf, const pseudo_msg_t *msg); -#if PSEUDO_STATBUF_64 -void pseudo_stat_msg_plain(struct stat *buf, const pseudo_msg_t *msg); -void pseudo_msg_stat_plain(pseudo_msg_t *msg, const struct stat *buf); -#else -#define pseudo_stat_msg_plain pseudo_stat_msg -#define pseudo_msg_stat_plain pseudo_msg_stat -#endif diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c index f11f172..a594d2e 100644 --- a/pseudo_wrappers.c +++ b/pseudo_wrappers.c @@ -1,7 +1,7 @@ /* * pseudo_wrappers.c, shared code for wrapper functions * - * Copyright (c) 2008-2011 Wind River Systems, Inc. + * Copyright (c) 2008-2012 Wind River Systems, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the Lesser GNU General Public License version 2.1 as @@ -117,7 +117,7 @@ pseudo_init_one_wrapper(pseudo_function *func) { s += strlen(s) - 2; /* *at() don't have to exist */ if (!strcmp(s, "at")) { - continue; + return; } #else if (e != NULL) { |