Re: Why I can't map memory with mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 18 Aug 2014 16:42:33 -0000, Jeff Haran said:

> I'm pretty sure you need to pass the file descriptor of an open file or
> device as the fd (second parameter from the end). -1 is not a valid fd.

Good catch.  But that should throw a different error than "resource
unavailable" - I'd expect to get EBADF back for that and it sounds like
he's getting EAGAIN back...

But yeah, that needs fixing too.

A common trick is to   fd = open("/dev/zero",.... to get an fd that can
be used for mmap of anonymous space.  Linux old-timers will remember
that /lib/ld-linux.so does this - with the non-obvious result that trying to
run a program that was linked against shared libraries would fail in a chroot
even if all the libraries were present, if /dev/zero wasn't in the chroot
as well....)

Attachment: pgppU_MoYb8Ir.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux