delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/26/12:06:08

Newsgroups: comp.os.msdos.djgpp
From: davehurt AT flash DOT net (David Hurt)
Subject: Re: mmap() in DJGPP
References: <390689C2 DOT 22B4233E AT home DOT com> <8e6ao8$7jj$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3906F9B2 DOT 17C6C4F5 AT home DOT com>
X-Newsreader: News Xpress 2.01
Lines: 100
Message-ID: <mkDN4.2411$X55.302826@news.flash.net>
Date: Wed, 26 Apr 2000 14:47:46 GMT
NNTP-Posting-Host: 170.49.32.8
X-Complaints-To: abuse AT flash DOT net
X-Trace: news.flash.net 956760466 170.49.32.8 (Wed, 26 Apr 2000 09:47:46 CDT)
NNTP-Posting-Date: Wed, 26 Apr 2000 09:47:46 CDT
Organization: FlashNet Communications, http://www.flash.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

From DG-UX man page
                                                                            
mmap(2)                        DG/UX R4.20MU03                       mmap(2)
                                                                            
                                                                            
NAME                                                                        
       mmap - map pages of memory                                           
                                                                            
SYNOPSIS                                                                    
       #include <sys/types.h>                                               
       #include <sys/mman.h>                                                
                                                                            
       void * mmap (addr, len, prot, flags, fd, off)                        
       void *  addr;                                                        
       size_t  len;                                                         
       int     prot;                                                        
       int     flags;                                                       
       int     fd;                                                          
       off_t   off;                                                         
                                                                            
DESCRIPTION                                                                 
       The mmap(2) call maps a memory object into the caller's address
       space, based on the supplied parameters:

       addr           is the optional starting address for the new memory
                      region to map.

       len            is the length in bytes of the region to map.

       prot           assigns the access attribute for the mapped region:
                      read, write, execute, a combination, or no access.

       flags          specify the mapping mode (shared or private), and
                      whether the requested address must be used exactly.

       fd             is the file descriptor of the memory object to be
                      mapped into the region.

       off            is the offset into the file to be mapped into the
                      region.

       The format of the call is:

                  pa = mmap(addr, len, prot, flags, fd, off);

       The file fd, starting at offset off, is mapped into the caller's
       address space. The mapping begins at address pa and extends for len
       bytes. Argument prot specifies how the region may be accessed, and
       flags whether changes to the file should be shared with other
       processes (and other attributes).

       Once a file is mapped, a process may access it using the mapped
       address instead of the read/write interface. Consider the following
       pseudo-code, where off is assumed to be page aligned:

                fd = open(...);
                lseek(fd, off, SEEK_SET);
                read(fd, buf, len);
                /* use data in buf */

             Here is a rewrite using mmap(2):

                fd = open(...);
                pa = mmap((void *) 0, len, (PROT_READ | PROT_WRITE),
                             MAP_PRIVATE, fd, off);
                /* use data at address pa */

/* ... Rest of man page omitted ... */

This is a rather common way in Unix-ish systems to share data between two or 
more processes.  I sincerely doubt that there is a similar facility in DOS

Hope this helps 
David Hurt



In article <3906F9B2 DOT 17C6C4F5 AT home DOT com>, Robin Johnson <robbat2 AT home DOT com> 
wrote:
>Could somebody at least get me some docs on what mmap() does?
>
>Hans-Bernhard Broeker wrote:
>> 
>> Robin Johnson <robbat2 AT home DOT com> wrote:
>> 
>> > I'm trying to port some linux stuff over to DJGPP, but all the
>> > configure scripts keep asking for mmap(), and I can't for the life
>> > of me find it.
>> 
>> mmap() is not available in DJGPP. Period.
>> 
>> Those Linux-borne programs will either have to get along without it,
>> or they can't be ported. Note: just because the script *checks* for
>> mmap() usually doesn't mean that the programs won't work without it,
>> yet. If it really must have mmap(), the configure script will
>> terminate with an appropriate message.
>> --
>> Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
>> Even if all the snow were burnt, ashes would remain.
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019