lkml.org 
[lkml]   [1999]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: sed not working on /proc files
Hi,

On Tue, 4 May 1999 16:45:53 +0100 (BST), alan@lxorguk.ukuu.org.uk (Alan
Cox) said:

> To save a thousand follow ups - the glibc code does do the right thing but
> the kernel thinks any 0 length mmap succeeds and doesnt error it. So its
> a kernel funny

Given that we perform both the 0-length check and the file operations
check for every successful mmap(), changing the order of the two tests
shouldn't have any performance impact. All it does is guarantee that
the error returned for mmap on an invalid fd is ENODEV regardless of the
other parameters passed in, which seems a perfectly sane thing to do
anyway.

--Stephen

----------------------------------------------------------------
--- mm/mmap.c~ Tue Apr 20 22:33:37 1999
+++ mm/mmap.c Tue May 4 21:26:31 1999
@@ -176,6 +176,9 @@
struct vm_area_struct * vma;
int error;

+ if (file && (!file->f_op || !file->f_op->mmap))
+ return -ENODEV;
+
if ((len = PAGE_ALIGN(len)) == 0)
return addr;

@@ -244,9 +247,6 @@
* specific mapper. the address has already been validated, but
* not unmapped, but the maps are removed from the list.
*/
- if (file && (!file->f_op || !file->f_op->mmap))
- return -ENODEV;
-
vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!vma)
return -ENOMEM;
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.090 / U:1.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site