1. 25 1月, 2008 1 次提交
  2. 20 7月, 2007 1 次提交
  3. 24 5月, 2007 1 次提交
  4. 17 5月, 2007 1 次提交
  5. 11 5月, 2007 2 次提交
  6. 09 5月, 2007 3 次提交
    • U
      utimensat implementation · 1c710c89
      Ulrich Drepper 提交于
      Implement utimensat(2) which is an extension to futimesat(2) in that it
      
      a) supports nano-second resolution for the timestamps
      b) allows to selectively ignore the atime/mtime value
      c) allows to selectively use the current time for either atime or mtime
      d) supports changing the atime/mtime of a symlink itself along the lines
         of the BSD lutimes(3) functions
      
      For this change the internally used do_utimes() functions was changed to
      accept a timespec time value and an additional flags parameter.
      
      Additionally the sys_utime function was changed to match compat_sys_utime
      which already use do_utimes instead of duplicating the work.
      
      Also, the completely missing futimensat() functionality is added.  We have
      such a function in glibc but we have to resort to using /proc/self/fd/* which
      not everybody likes (chroot etc).
      
      Test application (the syscall number will need per-arch editing):
      
      #include <errno.h>
      #include <fcntl.h>
      #include <time.h>
      #include <sys/time.h>
      #include <stddef.h>
      #include <syscall.h>
      
      #define __NR_utimensat 280
      
      #define UTIME_NOW       ((1l << 30) - 1l)
      #define UTIME_OMIT      ((1l << 30) - 2l)
      
      int
      main(void)
      {
        int status = 0;
      
        int fd = open("ttt", O_RDWR|O_CREAT|O_EXCL, 0666);
        if (fd == -1)
          error (1, errno, "failed to create test file \"ttt\"");
      
        struct stat64 st1;
        if (fstat64 (fd, &st1) != 0)
          error (1, errno, "fstat failed");
      
        struct timespec t[2];
        t[0].tv_sec = 0;
        t[0].tv_nsec = 0;
        t[1].tv_sec = 0;
        t[1].tv_nsec = 0;
        if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
          error (1, errno, "utimensat failed");
      
        struct stat64 st2;
        if (fstat64 (fd, &st2) != 0)
          error (1, errno, "fstat failed");
      
        if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
          {
            puts ("atim not reset to zero");
            status = 1;
          }
        if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
          {
            puts ("mtim not reset to zero");
            status = 1;
          }
        if (status != 0)
          goto out;
      
        t[0] = st1.st_atim;
        t[1].tv_sec = 0;
        t[1].tv_nsec = UTIME_OMIT;
        if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
          error (1, errno, "utimensat failed");
      
        if (fstat64 (fd, &st2) != 0)
          error (1, errno, "fstat failed");
      
        if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
            || st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
          {
            puts ("atim not set");
            status = 1;
          }
        if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
          {
            puts ("mtim changed from zero");
            status = 1;
          }
        if (status != 0)
          goto out;
      
        t[0].tv_sec = 0;
        t[0].tv_nsec = UTIME_OMIT;
        t[1] = st1.st_mtim;
        if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
          error (1, errno, "utimensat failed");
      
        if (fstat64 (fd, &st2) != 0)
          error (1, errno, "fstat failed");
      
        if (st2.st_atim.tv_sec != st1.st_atim.tv_sec
            || st2.st_atim.tv_nsec != st1.st_atim.tv_nsec)
          {
            puts ("mtim changed from original time");
            status = 1;
          }
        if (st2.st_mtim.tv_sec != st1.st_mtim.tv_sec
            || st2.st_mtim.tv_nsec != st1.st_mtim.tv_nsec)
          {
            puts ("mtim not set");
            status = 1;
          }
        if (status != 0)
          goto out;
      
        sleep (2);
      
        t[0].tv_sec = 0;
        t[0].tv_nsec = UTIME_NOW;
        t[1].tv_sec = 0;
        t[1].tv_nsec = UTIME_NOW;
        if (syscall(__NR_utimensat, AT_FDCWD, "ttt", t, 0) != 0)
          error (1, errno, "utimensat failed");
      
        if (fstat64 (fd, &st2) != 0)
          error (1, errno, "fstat failed");
      
        struct timeval tv;
        gettimeofday(&tv,NULL);
      
        if (st2.st_atim.tv_sec <= st1.st_atim.tv_sec
            || st2.st_atim.tv_sec > tv.tv_sec)
          {
            puts ("atim not set to NOW");
            status = 1;
          }
        if (st2.st_mtim.tv_sec <= st1.st_mtim.tv_sec
            || st2.st_mtim.tv_sec > tv.tv_sec)
          {
            puts ("mtim not set to NOW");
            status = 1;
          }
      
        if (symlink ("ttt", "tttsym") != 0)
          error (1, errno, "cannot create symlink");
      
        t[0].tv_sec = 0;
        t[0].tv_nsec = 0;
        t[1].tv_sec = 0;
        t[1].tv_nsec = 0;
        if (syscall(__NR_utimensat, AT_FDCWD, "tttsym", t, AT_SYMLINK_NOFOLLOW) != 0)
          error (1, errno, "utimensat failed");
      
        if (lstat64 ("tttsym", &st2) != 0)
          error (1, errno, "lstat failed");
      
        if (st2.st_atim.tv_sec != 0 || st2.st_atim.tv_nsec != 0)
          {
            puts ("symlink atim not reset to zero");
            status = 1;
          }
        if (st2.st_mtim.tv_sec != 0 || st2.st_mtim.tv_nsec != 0)
          {
            puts ("symlink mtim not reset to zero");
            status = 1;
          }
        if (status != 0)
          goto out;
      
        t[0].tv_sec = 1;
        t[0].tv_nsec = 0;
        t[1].tv_sec = 1;
        t[1].tv_nsec = 0;
        if (syscall(__NR_utimensat, fd, NULL, t, 0) != 0)
          error (1, errno, "utimensat failed");
      
        if (fstat64 (fd, &st2) != 0)
          error (1, errno, "fstat failed");
      
        if (st2.st_atim.tv_sec != 1 || st2.st_atim.tv_nsec != 0)
          {
            puts ("atim not reset to one");
            status = 1;
          }
        if (st2.st_mtim.tv_sec != 1 || st2.st_mtim.tv_nsec != 0)
          {
            puts ("mtim not reset to one");
            status = 1;
          }
      
        if (status == 0)
           puts ("all OK");
      
       out:
        close (fd);
        unlink ("ttt");
        unlink ("tttsym");
      
        return status;
      }
      
      [akpm@linux-foundation.org: add missing i386 syscall table entry]
      Signed-off-by: NUlrich Drepper <drepper@redhat.com>
      Cc: Alexey Dobriyan <adobriyan@openvz.org>
      Cc: Michael Kerrisk <mtk-manpages@gmx.net>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1c710c89
    • C
      cleanup compat ioctl handling · 6272e266
      Christoph Hellwig 提交于
      Merge all compat ioctl handling into compat_ioctl.c instead of splitting it
      over compat.c and compat_ioctl.c.  This also allows to get rid of ioctl32.h
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Looks-good-to: Andi Kleen <ak@suse.de>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6272e266
    • M
      ROUND_UP macro cleanup in fs/(select|compat|readdir).c · 022a1692
      Milind Arun Choudhary 提交于
      ROUND_UP macro cleanup use,ALIGN or DIV_ROUND_UP where ever appropriate.
      Signed-off-by: NMilind Arun Choudhary <milindchoudhary@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      022a1692
  7. 03 5月, 2007 1 次提交
  8. 08 3月, 2007 1 次提交
    • D
      [PATCH] Add epoll compat_ code to fs/compat.c · f6dfb4fd
      Davide Libenzi 提交于
      IA64 and ARM-OABI are currently using their own version of epoll compat_
      code.
      
      An architecture needs epoll_event translation if alignof(u64) in 32 bit
      mode is different from alignof(u64) in 64 bit mode.  If an architecture
      needs epoll_event translation, it must define struct compat_epoll_event in
      asm/compat.h and set CONFIG_HAVE_COMPAT_EPOLL_EVENT and use
      compat_sys_epoll_ctl and compat_sys_epoll_wait.
      
      All 64 bit architecture should use compat_sys_epoll_pwait.
      
      [sfr: restructure and move to fs/compat.c, remove MIPS version
      of compat_sys_epoll_pwait, use __put_user_unaligned]
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f6dfb4fd
  9. 11 12月, 2006 1 次提交
    • V
      [PATCH] fdtable: Make fdarray and fdsets equal in size · bbea9f69
      Vadim Lobanov 提交于
      Currently, each fdtable supports three dynamically-sized arrays of data: the
      fdarray and two fdsets.  The code allows the number of fds supported by the
      fdarray (fdtable->max_fds) to differ from the number of fds supported by each
      of the fdsets (fdtable->max_fdset).
      
      In practice, it is wasteful for these two sizes to differ: whenever we hit a
      limit on the smaller-capacity structure, we will reallocate the entire fdtable
      and all the dynamic arrays within it, so any delta in the memory used by the
      larger-capacity structure will never be touched at all.
      
      Rather than hogging this excess, we shouldn't even allocate it in the first
      place, and keep the capacities of the fdarray and the fdsets equal.  This
      patch removes fdtable->max_fdset.  As an added bonus, most of the supporting
      code becomes simpler.
      Signed-off-by: NVadim Lobanov <vlobanov@speakeasy.net>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Dipankar Sarma <dipankar@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      bbea9f69
  10. 09 12月, 2006 1 次提交
  11. 08 12月, 2006 2 次提交
  12. 04 12月, 2006 2 次提交
  13. 04 11月, 2006 1 次提交
  14. 11 10月, 2006 1 次提交
  15. 03 10月, 2006 1 次提交
    • D
      [PATCH] VFS: Make filldir_t and struct kstat deal in 64-bit inode numbers · afefdbb2
      David Howells 提交于
      These patches make the kernel pass 64-bit inode numbers internally when
      communicating to userspace, even on a 32-bit system.  They are required
      because some filesystems have intrinsic 64-bit inode numbers: NFS3+ and XFS
      for example.  The 64-bit inode numbers are then propagated to userspace
      automatically where the arch supports it.
      
      Problems have been seen with userspace (eg: ld.so) using the 64-bit inode
      number returned by stat64() or getdents64() to differentiate files, and
      failing because the 64-bit inode number space was compressed to 32-bits, and
      so overlaps occur.
      
      This patch:
      
      Make filldir_t take a 64-bit inode number and struct kstat carry a 64-bit
      inode number so that 64-bit inode numbers can be passed back to userspace.
      
      The stat functions then returns the full 64-bit inode number where
      available and where possible.  If it is not possible to represent the inode
      number supplied by the filesystem in the field provided by userspace, then
      error EOVERFLOW will be issued.
      
      Similarly, the getdents/readdir functions now pass the full 64-bit inode
      number to userspace where possible, returning EOVERFLOW instead when a
      directory entry is encountered that can't be properly represented.
      
      Note that this means that some inodes will not be stat'able on a 32-bit
      system with old libraries where they were before - but it does mean that
      there will be no ambiguity over what a 32-bit inode number refers to.
      
      Note similarly that directory scans may be cut short with an error on a
      32-bit system with old libraries where the scan would work before for the
      same reasons.
      
      It is judged unlikely that this situation will occur because modern glibc
      uses 64-bit capable versions of stat and getdents class functions
      exclusively, and that older systems are unlikely to encounter
      unrepresentable inode numbers anyway.
      
      [akpm: alpha build fix]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      afefdbb2
  16. 02 10月, 2006 1 次提交
  17. 01 10月, 2006 3 次提交
  18. 26 9月, 2006 1 次提交
    • A
      [PATCH] Check return value of copy_to_user in compat_sys_pselect7 · 75833345
      Andi Kleen 提交于
      Fix
      
      linux/fs/compat.c: In function compat_sys_pselect7
      linux/fs/compat.c:1869: warning: ignoring return value of copy_to_user, declared with attribute warn_unused_result
      
      To make it easier to handle I changed to semantics to not try to
      write out a timespec if an error occurred. I hope that's ok.
      
      Cc: dwmw2@infradead.org
      Signed-off-by: NAndi Kleen <ak@suse.de>
      75833345
  19. 27 6月, 2006 1 次提交
  20. 23 6月, 2006 1 次提交
  21. 22 5月, 2006 1 次提交
    • L
      [PATCH] NFS: fix error handling on access_ok in compat_sys_nfsservctl · d64b1c87
      Lin Feng Shen 提交于
      Functions compat_nfs_svc_trans, compat_nfs_clnt_trans,
      compat_nfs_exp_trans, compat_nfs_getfd_trans and compat_nfs_getfs_trans,
      which are called by compat_sys_nfsservctl(fs/compat.c), don't handle the
      return value of access_ok properly.  access_ok return 1 when the addr is
      valid, and 0 when it's not, but these functions have the reversed
      understanding.  When the address is valid, they always return -EFAULT to
      compat_sys_nfsservctl.
      
      An example is to run /usr/sbin/rpc.nfsd(32bit program on Power5).  It
      doesn't function as expected.  strace showes that nfsservctl returns
      -EFAULT.
      
      The patch fixes this by correcting the error handling on the return value
      of access_ok in the five functions.
      Signed-off-by: NLin Feng Shen <shenlinf@cn.ibm.com>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Acked-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d64b1c87
  22. 16 5月, 2006 1 次提交
  23. 04 5月, 2006 1 次提交
  24. 02 5月, 2006 1 次提交
  25. 26 4月, 2006 1 次提交
  26. 29 3月, 2006 1 次提交
  27. 26 3月, 2006 2 次提交
  28. 24 3月, 2006 1 次提交
  29. 18 2月, 2006 1 次提交
  30. 12 2月, 2006 1 次提交
    • A
      [PATCH] select: fix returned timeval · 643a6545
      Andrew Morton 提交于
      With David Woodhouse <dwmw2@infradead.org>
      
      select() presently has a habit of increasing the value of the user's
      `timeout' argument on return.
      
      We were writing back a timeout larger than the original.  We _deliberately_
      round up, since we know we must wait at _least_ as long as the caller asks
      us to.
      
      The patch adds a couple of helper functions for magnitude comparison of
      timespecs and of timevals, and uses them to prevent the various poll and
      select functions from returning a timeout which is larger than the one which
      was passed in.
      
      The patch also fixes a bug in compat_sys_pselect7(): it was adding the new
      timeout value to the old one and was returning that.  It should just return
      the new timeout value.
      
      (We have various handy timespec/timeval-to-from-nsec conversion functions in
      time.h.  But this code open-codes it all).
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Andi Kleen <ak@muc.de>
      Cc: Ulrich Drepper <drepper@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: george anzinger <george@mvista.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      643a6545
  31. 02 2月, 2006 2 次提交