Home arrow BrainDump arrow Page 3 - The MMAP System Call in Linux

Return values and error codes - BrainDump

In this third part of a seven-part series on Linux I/O file system calls, you'll learn how to use the mmap() system call, which will give you some flexibility when handling files. This article is excerpted from chapter four of the book Linux System Programming: Talking Directly to the Kernel and C Library, written by Robert Love (O'Reilly, 2007; ISBN: 0596009585). Copyright 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

TABLE OF CONTENTS:
  1. The MMAP System Call in Linux
  2. The page size
  3. Return values and error codes
  4. Associated signals
By: O'Reilly Media
Rating: starstarstarstarstar / 5
December 11, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

On success, a call to mmap() returns the location of the mapping. On failure, the call returns MAP_FAILED, and setserrnoappropriately. A call tommap()never returns0.

Possibleerrnovalues include:

EACCESS
   The given file descriptor is not a regular file, or the
   mode with which it was opened conflicts withprot
   orflags.

EAGAIN
   The file has been locked via a file lock.

EBADF
   The given file descriptor is not valid.

EINVAL
   One or more of the parametersaddr,len, oroff
   are invalid.

ENFILE
   The system-wide limit on open files has been
   reached.

ENODEV
   The filesystem on which the file to map resides does
   not support memory mapping.

ENOMEM
   The process does not have enough memory.

EOVERFLOW
   The result ofaddr+lenexceeds the size of the
   address space.

EPERM 
   PROT_EXECwas given, but the filesystem is mounted 
 noexec
.



 
 
>>> More BrainDump Articles          >>> More By O'Reilly Media
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

BRAINDUMP ARTICLES

- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: