| Updated: October 28, 2024 | 
Handle an _IO_MMAP message
#include <sys/iofunc.h>
int iofunc_mmap ( resmgr_context_t * ctp,
                  io_mmap_t * msg,
                  iofunc_ocb_t * ocb,
                  iofunc_attr_t * attr );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The iofunc_mmap() helper function provides functionality for the _IO_MMAP message. The _IO_MMAP message is an outcall from the memory manager (a part of the microkernel's procnto).
(QNX Neutrino 7.1 or later) The iofunc_mmap_ext() function is an extended version of iofunc_mmap() that can pass addition information back to the memory manager.
This helper function checks that the requested mapping permissions don't conflict with the open mode for the file descriptor and that the mountpoint isn't read only. It also checks that the file is executable before setting PROT_EXEC in allowed_prot. The helper obtains an exclusive write lock on the file if it's being mapped with execute permissions.
Note that if you write your own handler for _IO_MMAP messages, and you want the process manager to be able to execute binaries from the resource, then your handler must use the iofunc_mmap() or iofunc_mmap_ext() function.
io_mmap_t structure
The io_mmap_t structure holds the _IO_MMAP message received by the resource manager:
struct _io_mmap {
    uint16_t                    type;
    uint16_t                    combine_len;
    uint32_t                    prot;
    uint64_t                    offset;
    struct _msg_info32          info;
    uint32_t                    required_prot;
    uint32_t                    zero[3];
    uint64_t                    requested_len;
};
struct _io_mmap_reply {
    uint32_t                    zero;
    uint32_t                    allowed_prot;
    uint64_t                    offset;
    int32_t                     coid;
    int32_t                     fd;
};
typedef union {
    struct _io_mmap             i;
    struct _io_mmap_reply       o;
} io_mmap_t;
The I/O message structures are unions of an input message (coming to the resource manager) and an output or reply message (going back to the client).
The i member is a structure of type _io_mmap that contains the following members:
See the required_prot field, below.
To determine whether the version of procnto your resource manager is talking to supports this field, look at the prot field:
The o member of the io_mmap_t structure is a structure of type _io_mmap_reply that contains the following members:
| Safety: | |
|---|---|
| Cancellation point | No | 
| Interrupt handler | No | 
| Signal handler | Yes | 
| Thread | Yes |