[2.4] 64-bit write system call patch
Subsystems (2)
PATCH 1/1 [2.4] 64-bit write system call patch
Hi Marcello,
The following patch (the BK Linux 2.4 tree) is needed to fix some 32/64-bit issues with the write system call. There are a number of places in the VFS stack (and in ext2/3 filesystem --- possibly others, but I haven't had the time to audit them yet) where the number of bytes written assigned to an integer instead of a ssize_t. This causes the top 32-bits of the returned value to get lopped off, so that a write() of 4 gigabytes returns 0 instead of 4GB.
The patch is fairly straightforward, and obvious(tm). Please apply.
- Ted
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1052 -> 1.1053 # mm/filemap.c 1.85 -> 1.86 # fs/ext3/file.c 1.3 -> 1.4
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/03 [email protected] 1.1053
# Fix 32/64 bit issues.
# --------------------------------------------
#
fs/ext3/file.c +2 -1
@@ -61,7 +61,8 @@static ssize_t ext3_file_write (struct file *file,const char *buf,size_t count,loff_t *ppos) { -int ret, err; +ssize_t ret; +int err;struct inode *inode = file->f_dentry->d_inode; ret =generic_file_write (file, buf, count, ppos);
mm/filemap.c +5 -4
@@ -3108,7 +3108,7 @@struct page *page, *cached_page;ssize_t written;long status =0 ; -int err; +ssize_t err;unsigned bytes; cached_page =NULL ;
@@ -3229,7 +3229,7 @@loff_t pos;ssize_t written;long status =0 ; -int err; +ssize_t err; pos = *ppos; written =0 ;
@@ -3270,7 +3270,8 @@static int do_odirect_fallback (struct file *file,struct inode *inode,const char *buf,size_t count,loff_t *ppos) { -int ret, err; +ssize_t ret; +int err;down (&inode->i_sem); ret =do_generic_file_write (file, buf, count, ppos);
@@ -3287,7 +3288,7 @@ generic_file_write(struct file *file,const char *buf,size_t count, loff_t *ppos) { struct inode *inode = file->f_dentry->d_inode->i_mapping->host; -int err; +ssize_t err;if ((ssize_t ) count <0 )return -EINVAL ;