text
stringlengths 0
234
|
---|
.b o_rdonly |
open the object for read access. |
a shared memory object opened in this way can be |
.br mmap (2)ed |
only for read |
.rb ( prot_read ) |
access. |
.tp |
.b o_rdwr |
open the object for read-write access. |
.tp |
.b o_creat |
create the shared memory object if it does not exist. |
the user and group ownership of the object are taken |
from the corresponding effective ids of the calling process, |
.\" in truth it is actually the filesystem ids on linux, but these |
.\" are nearly always the same as the effective ids. (mtk, jul 05) |
and the object's |
permission bits are set according to the low-order 9 bits of |
.ir mode , |
except that those bits set in the process file mode |
creation mask (see |
.br umask (2)) |
are cleared for the new object. |
a set of macro constants which can be used to define |
.i mode |
is listed in |
.br open (2). |
(symbolic definitions of these constants can be obtained by including |
.ir <sys/stat.h> .) |
.ip |
a new shared memory object initially has zero length\(emthe size of the |
object can be set using |
.br ftruncate (2). |
the newly allocated bytes of a shared memory |
object are automatically initialized to 0. |
.tp |
.b o_excl |
if |
.b o_creat |
was also specified, and a shared memory object with the given |
.i name |
already exists, return an error. |
the check for the existence of the object, and its creation if it |
does not exist, are performed atomically. |
.tp |
.b o_trunc |
if the shared memory object already exists, truncate it to zero bytes. |
.pp |
definitions of these flag values can be obtained by including |
.ir <fcntl.h> . |
.pp |
on successful completion |
.br shm_open () |
returns a new file descriptor referring to the shared memory object. |
this file descriptor is guaranteed to be the lowest-numbered file descriptor |
not previously opened within the process. |
the |
.b fd_cloexec |
flag (see |
.br fcntl (2)) |
is set for the file descriptor. |
.pp |
the file descriptor is normally used in subsequent calls |
to |
.br ftruncate (2) |
(for a newly created object) and |
.br mmap (2). |
after a call to |
.br mmap (2) |
the file descriptor may be closed without affecting the memory mapping. |
.pp |
the operation |
of |
.br shm_unlink () |
is analogous to |
.br unlink (2): |
it removes a shared memory object name, and, once all processes |
have unmapped the object, deallocates and |
destroys the contents of the associated memory region. |
after a successful |
.br shm_unlink (), |
attempts to |
.br shm_open () |
an object with the same |
.i name |
fail (unless |
.b o_creat |
was specified, in which case a new, distinct object is created). |
.sh return value |
on success, |
.br shm_open () |
returns a file descriptor (a nonnegative integer). |
on success, |
.br shm_unlink () |
returns 0. |
on failure, both functions return \-1 and set |
.i errno |
to indicate the error. |
.sh errors |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.