You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Garey Smiley <ga...@main.slink.com> on 1996/02/08 06:49:16 UTC
mmap alt?
Does any other platform besides OS/2 support the following function? It might
be used instead of mmap() for a faster scoreboard.
Prototype:
FILE *_mfopen (char *buf, const char *mode, size_t size, int inc);
Description:
Open a memory file. All output to a memory file goes to a buffer in memory.
The stream returned by _mfopen() can be used with fprintf(), fputc(),
ftell() and fwrite(). If buf is non-NULL, output goes to the array of size
bytes pointed to by buf. inc must be zero. If buf is NULL, output goes to a
buffer allocated with malloc() and resized with realloc(). The initial size
of the buffer is size bytes (which can be zero). inc must be non-zero. If
inc is positive, the buffer size is increased by inc bytes whenever it is
full. If inc is -2, the buffer size is doubled whenever the buffer is full.
If size is 0 and inc is -2, the initial buffer size is 512 bytes, the buffer
will be allocated on the first output to the stream. Currently, mode must
point to "wb". On error, _mfopen() returns NULL. Do not use fclose() on a
stream created by _mfopen(), use _mfclose() instead. Do not read from a
stream created by _mfopen().
Return value:
_mfopen() returns a new stream. On error, _mfopen() returns NULL.
Restrictions:
_fsetmode() doesn't work, newline characters written to the stream are not
expanded to CR/LF.
See also: fopen(), _mfclose(), sprintf()
Example: See /emx/test/mftest.c
Garey Smiley
SoftLink Services
garey@slink.com
http://www.slink.com/
(216)848-1312 FAX/Data(216)699-4474
Re: mmap alt?
Posted by Cliff Skolnick <cl...@organic.com>.
Some systems have a tmpfs (memory filesystem, or ramdisk) and do not have
mmap(), if that is the case, open a file on the ram disk/memory filesystem.
Cliff
On Thu, 8 Feb 1996, Garey Smiley wrote:
> Does any other platform besides OS/2 support the following function? It might
> be used instead of mmap() for a faster scoreboard.
>
> Prototype:
>
> FILE *_mfopen (char *buf, const char *mode, size_t size, int inc);
>
> Description:
>
> Open a memory file. All output to a memory file goes to a buffer in memory.
> The stream returned by _mfopen() can be used with fprintf(), fputc(),
> ftell() and fwrite(). If buf is non-NULL, output goes to the array of size
> bytes pointed to by buf. inc must be zero. If buf is NULL, output goes to a
> buffer allocated with malloc() and resized with realloc(). The initial size
> of the buffer is size bytes (which can be zero). inc must be non-zero. If
> inc is positive, the buffer size is increased by inc bytes whenever it is
> full. If inc is -2, the buffer size is doubled whenever the buffer is full.
> If size is 0 and inc is -2, the initial buffer size is 512 bytes, the buffer
> will be allocated on the first output to the stream. Currently, mode must
> point to "wb". On error, _mfopen() returns NULL. Do not use fclose() on a
> stream created by _mfopen(), use _mfclose() instead. Do not read from a
> stream created by _mfopen().
>
> Return value:
>
> _mfopen() returns a new stream. On error, _mfopen() returns NULL.
>
> Restrictions:
>
> _fsetmode() doesn't work, newline characters written to the stream are not
> expanded to CR/LF.
>
> See also: fopen(), _mfclose(), sprintf()
>
> Example: See /emx/test/mftest.c
>
>
>
> Garey Smiley
> SoftLink Services
> garey@slink.com
> http://www.slink.com/
> (216)848-1312 FAX/Data(216)699-4474
>
>
--
Cliff Skolnick cliff@organic.com
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Benjamin Franklin, 1759