Re: [2.3.51pre2] wrong shm_statfs in ipc/shm.c

From: David S. Miller (davem@redhat.com)
Date: Fri Mar 10 2000 - 08:30:36 EST


   Date: Fri, 10 Mar 2000 08:19:26 -0500
   From: Rui Sousa <rsousa@grad.physics.sunysb.edu>

   It gives a compiler warning about wrong pointer assignment

Try the patch at the end of this email

   and
   when running a number of applications fail with the following message
   in /var/log/messages:

   Mar 10 08:16:48 localhost kernel: shmget: shm filesystem not mounted

"mkdir /var/shm" and add a line like the following to /etc/fstab if
you want to run 2.3.x and have working sysv SHM:

none /var/shm shm defaults 0 0

Here is the patch for the statfs problem.

diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore vanilla/linux/ipc/shm.c linux/ipc/shm.c
--- vanilla/linux/ipc/shm.c Fri Mar 10 01:02:53 2000
+++ linux/ipc/shm.c Thu Mar 9 23:22:54 2000
@@ -48,7 +48,7 @@
 static int shm_remount_fs (struct super_block *, int *, char *);
 static void shm_read_inode (struct inode *);
 static void shm_write_inode(struct inode *);
-static int shm_statfs (struct super_block *, struct statfs *, int);
+static int shm_statfs (struct super_block *, struct statfs *);
 static int shm_create (struct inode *,struct dentry *,int);
 static struct dentry *shm_lookup (struct inode *,struct dentry *);
 static int shm_unlink (struct inode *,struct dentry *);
@@ -347,18 +347,16 @@
         up(&shm_ids.sem);
 }
 
-static int shm_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
+static int shm_statfs(struct super_block *sb, struct statfs *buf)
 {
- struct statfs tmp;
-
- tmp.f_type = 0;
- tmp.f_bsize = PAGE_SIZE;
- tmp.f_blocks = shm_ctlall;
- tmp.f_bavail = tmp.f_bfree = shm_ctlall - shm_tot;
- tmp.f_files = shm_ctlmni;
- tmp.f_ffree = shm_ctlmni - used_segs;
- tmp.f_namelen = SHM_NAME_LEN;
- return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
+ buf->f_type = 0;
+ buf->f_bsize = PAGE_SIZE;
+ buf->f_blocks = shm_ctlall;
+ buf->f_bavail = buf->f_bfree = shm_ctlall - shm_tot;
+ buf->f_files = shm_ctlmni;
+ buf->f_ffree = shm_ctlmni - used_segs;
+ buf->f_namelen = SHM_NAME_LEN;
+ return 0;
 }
 
 static void shm_write_inode(struct inode * inode)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:17 EST