VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / fs / proc / base.c
index 353407b..e1c3a5d 100644 (file)
@@ -32,7 +32,8 @@
 #include <linux/mount.h>
 #include <linux/security.h>
 #include <linux/ptrace.h>
-#include <linux/ninline.h>
+#include <linux/vs_network.h>
+#include <linux/vs_cvirt.h>
 
 /*
  * For hysterical raisins we keep the same inumbers as in the old procfs.
@@ -520,7 +521,7 @@ static struct file_operations proc_mounts_operations = {
 
 #define PROC_BLOCK_SIZE        (3*1024)                /* 4K page size but our output routines use some slack for overruns */
 
-static ssize_t proc_info_read(struct file * file, char * buf,
+static ssize_t proc_info_read(struct file * file, char __user * buf,
                          size_t count, loff_t *ppos)
 {
        struct inode * inode = file->f_dentry->d_inode;
@@ -566,7 +567,7 @@ static int mem_open(struct inode* inode, struct file* file)
        return 0;
 }
 
-static ssize_t mem_read(struct file * file, char * buf,
+static ssize_t mem_read(struct file * file, char __user * buf,
                        size_t count, loff_t *ppos)
 {
        struct task_struct *task = proc_task(file->f_dentry->d_inode);
@@ -719,7 +720,7 @@ out:
 }
 
 static int do_proc_readlink(struct dentry *dentry, struct vfsmount *mnt,
-                           char *buffer, int buflen)
+                           char __user *buffer, int buflen)
 {
        struct inode * inode;
        char *tmp = (char*)__get_free_page(GFP_KERNEL), *path;
@@ -744,7 +745,7 @@ static int do_proc_readlink(struct dentry *dentry, struct vfsmount *mnt,
        return len;
 }
 
-static int proc_pid_readlink(struct dentry * dentry, char * buffer, int buflen)
+static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen)
 {
        int error = -EACCES;
        struct inode *inode = dentry->d_inode;
@@ -1178,7 +1179,7 @@ static struct inode_operations proc_task_inode_operations = {
 };
 
 #ifdef CONFIG_SECURITY
-static ssize_t proc_pid_attr_read(struct file * file, char * buf,
+static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
                                  size_t count, loff_t *ppos)
 {
        struct inode * inode = file->f_dentry->d_inode;
@@ -1215,7 +1216,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char * buf,
        return count;
 }
 
-static ssize_t proc_pid_attr_write(struct file * file, const char * buf,
+static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
                                   size_t count, loff_t *ppos)
 { 
        struct inode * inode = file->f_dentry->d_inode;
@@ -1489,7 +1490,8 @@ static struct inode_operations proc_tid_attr_inode_operations = {
 /*
  * /proc/self:
  */
-static int proc_self_readlink(struct dentry *dentry, char *buffer, int buflen)
+static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
+                             int buflen)
 {
        char tmp[30];
        sprintf(tmp, "%d", current->tgid);
@@ -1782,7 +1784,9 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
                ino_t ino = fake_ino(tgid,PROC_TGID_INO);
                unsigned long j = PROC_NUMBUF;
 
-               do buf[--j] = '0' + (tgid % 10); while (tgid/=10);
+               do
+                       buf[--j] = '0' + (tgid % 10);
+               while ((tgid /= 10) != 0);
 
                if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0) {
                        filp->f_version = tgid;
@@ -1837,7 +1841,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
 
                do
                        buf[--j] = '0' + (tid % 10);
-               while (tid /= 10);
+               while ((tid /= 10) != 0);
 
                if (filldir(dirent, buf+j, PROC_NUMBUF-j, pos, ino, DT_DIR) < 0)
                        break;