X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fkernel%2Fsysirix.c;fp=arch%2Fmips%2Fkernel%2Fsysirix.c;h=fc36083fa2dcfc3c44813b7ea097328c8354dc0f;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=3371005ba268445d286865f3ed565835115ddb1d;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 3371005ba..fc36083fa 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -237,6 +236,7 @@ asmlinkage int irix_prctl(unsigned option, ...) #undef DEBUG_PROCGRPS extern unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt); +extern int getrusage(struct task_struct *p, int who, struct rusage __user *ru); extern char *prom_getenv(char *name); extern long prom_setenv(char *name, char *value); @@ -646,7 +646,27 @@ static inline void getitimer_real(struct itimerval *value) asmlinkage unsigned int irix_alarm(unsigned int seconds) { - return alarm_setitimer(seconds); + struct itimerval it_new, it_old; + unsigned int oldalarm; + + if (!seconds) { + getitimer_real(&it_old); + del_timer(¤t->real_timer); + } else { + it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; + it_new.it_value.tv_sec = seconds; + it_new.it_value.tv_usec = 0; + do_setitimer(ITIMER_REAL, &it_new, &it_old); + } + oldalarm = it_old.it_value.tv_sec; + /* + * ehhh.. We can't return 0 if we have an alarm pending ... + * And we'd better return too much than too little anyway + */ + if (it_old.it_value.tv_usec) + oldalarm++; + + return oldalarm; } asmlinkage int irix_pause(void) @@ -695,7 +715,7 @@ asmlinkage int irix_statfs(const char __user *path, if (error) goto out; - error = vfs_statfs(nd.dentry, &kbuf); + error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); if (error) goto dput_and_out; @@ -733,7 +753,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf) goto out; } - error = vfs_statfs(file->f_dentry, &kbuf); + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); if (error) goto out_f; @@ -1361,7 +1381,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf) error = user_path_walk(fname, &nd); if (error) goto out; - error = vfs_statfs(nd.dentry, &kbuf); + error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); if (error) goto dput_and_out; @@ -1407,7 +1427,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf) error = -EBADF; goto out; } - error = vfs_statfs(file->f_dentry, &kbuf); + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); if (error) goto out_f; @@ -1612,7 +1632,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user * error = user_path_walk(fname, &nd); if (error) goto out; - error = vfs_statfs(nd.dentry, &kbuf); + error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf); if (error) goto dput_and_out; @@ -1659,7 +1679,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf) error = -EBADF; goto out; } - error = vfs_statfs(file->f_dentry, &kbuf); + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf); if (error) goto out_f; @@ -1740,13 +1760,12 @@ struct irix_dirent32_callback { #define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) static int irix_filldir32(void *__buf, const char *name, - int namlen, loff_t offset, u64 ino, unsigned int d_type) + int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct irix_dirent32 __user *dirent; struct irix_dirent32_callback *buf = __buf; unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1); int err = 0; - u32 d_ino; #ifdef DEBUG_GETDENTS printk("\nirix_filldir32[reclen<%d>namlen<%d>count<%d>]", @@ -1755,15 +1774,12 @@ static int irix_filldir32(void *__buf, const char *name, buf->error = -EINVAL; /* only used if we fail.. */ if (reclen > buf->count) return -EINVAL; - d_ino = ino; - if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) - return -EOVERFLOW; dirent = buf->previous; if (dirent) err = __put_user(offset, &dirent->d_off); dirent = buf->current_dir; err |= __put_user(dirent, &buf->previous); - err |= __put_user(d_ino, &dirent->d_ino); + err |= __put_user(ino, &dirent->d_ino); err |= __put_user(reclen, &dirent->d_reclen); err |= copy_to_user((char __user *)dirent->d_name, name, namlen) ? -EFAULT : 0; err |= __put_user(0, &dirent->d_name[namlen]); @@ -1842,7 +1858,7 @@ struct irix_dirent64_callback { #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) static int irix_filldir64(void *__buf, const char *name, - int namlen, loff_t offset, u64 ino, unsigned int d_type) + int namlen, loff_t offset, ino_t ino, unsigned int d_type) { struct irix_dirent64 __user *dirent; struct irix_dirent64_callback * buf = __buf;