#include "20080119-1.h" extern int filldir64 (void *__buf, const char *name, int namlen, s64 offset, u64 ino, unsigned int d_type); long sys_getdents64 (unsigned int fd, struct linux_dirent64 *dirent, unsigned int count) { register struct file *file; register struct linux_dirent64 *lastdirent; struct getdents_callback64 buf; register int error; error = -14; if (!(current_thread_info ()->addr_limit == (mm_segment_t) 0xFFFFFFFF || (count <= 0x60000000UL && (unsigned long) dirent <= 0x60000000UL - count))) goto out; error = -9; file = fget (fd); if (!file) goto out; buf.current_dir = dirent; buf.previous = ((void *) 0); buf.count = count; buf.error = 0; error = vfs_readdir (file, filldir64, &buf); if (error < 0) goto out_putf; error = buf.error; lastdirent = buf.previous; if (lastdirent) { s64 d_off = file->f_pos; error = -14; { long __pu_err = 0; s64 *__pu_addr = &lastdirent->d_off; __asm__ __volatile__ ("": "=r" (__pu_err):"r" (d_off), "r" (__pu_addr), "i" (-14), "0" (__pu_err)); if ((__pu_err)) goto out_putf; } error = count - buf.count; } out_putf: fput (file); out: return (error); }