lua-users home
lua-l archive

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


Am 27.08.2014 um 23:58 schröbte Sean Conner:
It was thus said that the Great Coroutines once stated:

I was off-base when I said mmap() -- I haven't used mmap() often and for
some reason I thought I could take a [page-sized] block of memory and get
an fd from it.  WRONG.  I was really thinking of shm_open().

shm_open() doesn't do what you think it does.

	int shm_open(const char *name, int oflag, mode_t mode);

   That "name" there is the name of a file; if the name doesn't exist, a file
is created with that name (and I'm checking the man pages of three different
systems here).

   No, what you want is open_memstream().  It's a POSIX function, so it'll
exist on Linux and Mac.

Actually, `open_memstream` (re-)allocates its own memory buffer and only does output. What you probably mean is `fmemopen` (also POSIX).


   -spc


Philipp