Whamcloud - gitweb
back out previous commit, which was more extensive than i'd intended
authormjmac <mjmac>
Thu, 28 Dec 2006 02:54:34 +0000 (02:54 +0000)
committermjmac <mjmac>
Thu, 28 Dec 2006 02:54:34 +0000 (02:54 +0000)
(shame on me for not using cvsdiffclient!)

libsysio/configure.in
libsysio/include/sysio.h
libsysio/src/readlink.c

index 4ed6794..9f83269 100644 (file)
@@ -101,17 +101,6 @@ AC_ARG_WITH(zero-sum-memory,
   [with_zero_sum_memory=no])
 AC_SUBST(ZERO_SUM_MEMORY)
 
-AC_ARG_WITH(defer-init-cwd,
-  AC_HELP_STRING([--with-defer-init-cwd],
-    [defer initialization of current working directory]),
-  [    case "${withval}" in
-        yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
-        no) ;;
-        *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
-       esac],
-  [with_defer_init_cwd=no])
-AC_SUBST(DEFER_INIT_CWD)
-
 AC_ARG_WITH(cplant_yod,
    AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
    [   case "${withval}" in    
@@ -209,20 +198,6 @@ if test "$machine" = rs6000; then
        machine="powerpc"
 fi
 
-AC_MSG_CHECKING(if readlink returns ssize_t)
-AC_TRY_COMPILE([
-       include <unistd.h>
-],[
-       ssize_t readlink(const char *, char *, size_t);
-],
-       readlink_returns_ssize_t="yes",
-       readlink_returns_ssize_t="yes"
-)
-AC_MSG_RESULT($readlink_returns_ssize_t)
-if test x$readlink_returns_ssize_t = xyes; then
-       AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
-fi
-
 # If we can't provoke the declaration of stat64 then we assume the
 # environment supports 64-bit file support naturally. Beware!
 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
@@ -260,6 +235,61 @@ fi
 AC_MSG_RESULT($alpha_linux_env)
 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
 
+# check for 64 bit stat, fstat, truncate, ftruncate syscalls
+# 
+AC_MSG_CHECKING(for 64 bit stat and truncate syscalls)
+AC_TRY_COMPILE([
+#include <sys/stat.h>
+#include <syscall.h>
+extern int syscall();],
+[char path[] = "/";
+int fd = 0;
+struct stat buf;
+syscall(SYS_stat64,path,&buf);
+syscall(SYS_fstat64,fd,&buf);
+syscall(SYS_truncate64, path, buf.st_size);
+syscall(SYS_ftruncate64, fd, buf.st_size);
+],
+       sysstat64_exists=yes,
+       sysstat64_exists=no)
+AC_MSG_RESULT($sysstat64_exists)
+if test x$sysstat64_exists = xno; then
+       AC_DEFINE(USE_NATIVE_STAT)
+fi
+
+# Check for fdatasync syscall
+#
+AC_MSG_CHECKING(for fdatasync system call)
+if test x$alpha_linux_env = xyes; then
+       _syscallnum=SYS_osf_fdatasync
+else
+       _syscallnum=SYS_fdatasync
+fi
+AC_TRY_COMPILE([
+#include <syscall.h>
+extern int syscall();],
+[int fd = 0;
+syscall(SYS_fdatasync, fd);],
+       syscall_fdatasync_exists=yes,
+       syscall_fdatasync_exists=no)
+AC_MSG_RESULT($syscall_fdatasync_exists)
+if test x$syscall_fdatasync_exists = xyes; then
+       AC_DEFINE_UNQUOTED(NATIVE_FDATASYNC, $_syscallnum)
+fi
+
+# Check for SYS_utime
+#
+AC_MSG_CHECKING(for utime system call)
+AC_TRY_COMPILE([
+#include <syscall.h>
+extern int syscall();],
+[syscall(SYS_utime);],
+       syscall_utime_exists=yes,
+       syscall_utime_exists=no)
+AC_MSG_RESULT($syscall_utime_exists)
+if test x$syscall_utime_exists = xno; then
+       AC_DEFINE(USE_NATIVE_UTIME)
+fi
 # Check for __st_ino 
 #
 AC_MSG_CHECKING(for __st_ino)
index bae86c2..770d741 100644 (file)
@@ -247,11 +247,7 @@ extern int SYSIO_INTERFACE_NAME(ftruncate64)(int fd, off64_t length);
 #endif
 extern int SYSIO_INTERFACE_NAME(rmdir)(const char *path);
 extern int SYSIO_INTERFACE_NAME(symlink)(const char *path1, const char *path2);
-#ifdef HAVE_POSIX_1003_READLINK
-extern ssize_t SYSIO_INTERFACE_NAME(readlink)(const char *path,
-#else
 extern int SYSIO_INTERFACE_NAME(readlink)(const char *path,
-#endif
                                char *buf,
                                size_t bufsiz);
 extern int SYSIO_INTERFACE_NAME(link)(const char *oldpath, const char *newpath);
index 2497dfd..7053c62 100644 (file)
  * lee@sandia.gov
  */
 
-#if defined(__linux__)
-#define _BSD_SOURCE
-#endif
 #include <unistd.h>
 #include <errno.h>
 #include <assert.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/queue.h>
 
 #include "sysio.h"
 #include "inode.h"
 #include "sysio-symbols.h"
 
-#ifdef HAVE_POSIX_1003_READLINK
-ssize_t
-#else
 int
-#endif
 SYSIO_INTERFACE_NAME(readlink)(const char *path, char *buf, size_t bufsiz)
 {
        struct intent intent;
@@ -74,15 +66,14 @@ SYSIO_INTERFACE_NAME(readlink)(const char *path, char *buf, size_t bufsiz)
        if (err)
                goto out;
        ino = pno->p_base->pb_ino;
-       if (!S_ISLNK(ino->i_stbuf.st_mode)) {
-               err = -EINVAL;
-               goto error;
-       }
        err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz);
+       if (err)
+               goto error;
+
 error:
        P_RELE(pno);
 out:
-       SYSIO_INTERFACE_RETURN(err < 0 ? -1 : err, err >= 0 ? 0 : err);
+       SYSIO_INTERFACE_RETURN(err, err >= 0 ? 0 : err);
 }
 
 #ifdef REDSTORM