Re: sed not working on /proc files

David Woodhouse (David.Woodhouse@mvhi.com)
Tue, 04 May 1999 16:00:06 +0100


alan@lxorguk.ukuu.org.uk said:
> So fix the buggy libc. Relying on mmap() being available is broken

It only assumes that mmap is available if the mmap() call returns success.
That's not _too_ unreasonable an assumption.

mmap.c has an optimisation - if it's a zero-length map that's requested,
return success immediately.

Perhaps if we checked that the filedescriptor has mmap() capability _first_,
rather than later, the desired effect would be achieved...

Index: mmap.c
===================================================================
RCS file: /cvs/linux/mm/mmap.c,v
retrieving revision 1.2
diff -u -w -r1.2 mmap.c
--- mmap.c 1999/04/20 11:03:16 1.2
+++ mmap.c 1999/05/04 14:57:43
@@ -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,8 +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)

---- ---- ----
David Woodhouse David.Woodhouse@mvhi.com Office: (+44) 1223 810302
Project Leader, Process Information Systems Mobile: (+44) 976 658355
Axiom (Cambridge) Ltd., Swaffham Bulbeck, Cambridge, CB5 0NA, UK.
finger dwmw2@ferret.lmh.ox.ac.uk for PGP key.

-
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/