for connected embedded systems
![]() |
![]() |
![]() |
![]() |
shm_ctl_special()
Give special attributes to a shared memory object
Synopsis:
#include <sys/mman.h>
int shm_ctl_special( int fd,
int flags,
_uint64 paddr,
_uint64 size,
unsigned special );
Arguments:
- fd
- The file descriptor that's associated with the shared memory object, as returned by shm_open().
- flags
- One or more of the following bits, defined in
<sys/mman.h>:
- SHMCTL_ANON -- allocate anonymous memory.
- SHMCTL_PHYS -- use physical address, or allocate physically contiguous memory if used with SHMCTL_ANON.
- SHMCTL_GLOBAL -- a hint that any mapping to the object could be global across all processes.
- SHMCTL_PRIV -- a hint that a mapping of this object may require privileged access.
- SHMCTL_LOWERPROT -- a hint that the system may map this object in such a way that it trades lower memory protection for better performance.
- SHMCTL_LAZYWRITE -- a hint that a mapping of this object could use lazy-writing mechanisms.

Some of the bits have specific meanings for different processors. For more information, see the documentation for shm_ctl().
- paddr
- A physical address to assign to the object, if you set SHMCTL_PHYS in flags.
- size
- The new size of the object, in bytes, regardless of ANON/PHYS flag.
- special
- Process-specific flags.
This argument is currently used only on SH4 platforms. On SH4 7760, it controls the space attribute bits of the UTLB (see section 6.3.1 of 7760 hardware manual).
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The shm_ctl_special() function modifies the attributes of the shared memory object identified by the handle, fd. This handle is the value returned by shm_open().
The shm_ctl_special() function is similar to shm_ctl(), but has an additional processor-specific argument, special. Calling shm_ctl_special() with a value of 0 for special is equivalent to calling shm_ctl().
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EINVAL
- An invalid combination of flags was specified, or the shared memory object is already "special."
Classification:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
See also:
mmap(), munmap(), mprotect(), shm_ctl(), shm_open(), shm_unlink(), ThreadCtl()
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)