iofunc_space_verify()

Do permission checks for the _IO_SPACE message

Synopsis:

#include <sys/iofunc.h>

int iofunc_space_verify( resmgr_context_t *ctp, 
                         io_space_t *msg, 
                         iofunc_ocb_t *ocb, 
                         int *nonblock ); 

Arguments:

ctp
A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
msg
A pointer to the io_space_t structure that contains the message that the resource manager received; see below.
ocb
A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.
nonblock
NULL, or a pointer to a location where the function can store a value that indicates whether or not the device is nonblocking:
  • Zero — the client doesn't want to be blocked (i.e. O_NONBLOCK was set).
  • Nonzero — the client wants to be blocked.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The iofunc_space_verify() helper function checks the client's permission for an _IO_SPACE message.

io_space_t structure

The io_space_t structure holds the _IO_SPACE message received by the resource manager:

struct _io_space {
    uint16_t                    type;
    uint16_t                    combine_len;
    uint16_t                    subtype;
    short                       whence;
    uint64_t                    start;
    uint64_t                    len;
};

typedef union {
    struct _io_space            i;
    uint64_t                    o;
} io_space_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_space that contains the following members:

type
_IO_SPACE.
combine_len
If the message is a combine message, _IO_COMBINE_FLAG is set in this member.
subtype
F_ALLOCSP or F_FREESP.
whence
The position in the file. The possible values (defined in <unistd.h>) are:
SEEK_CUR
The new file position is computed relative to the current file position. The value of start may be positive, negative or zero.
SEEK_END
The new file position is computed relative to the end of the file.
SEEK_SET
The new file position is computed relative to the start of the file. The value of start must not be negative.
start
The relative offset from the file position determined by the whence member.
len
The relative size by which to increase the file.

A value of zero means to end of file.

The o member is the file size.

Returns:

EBADF
The client doesn't have read access to this resource.
EISDIR
The resource is a directory.
EOK
The client has read access to this resource.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Last modified: 2013-12-23

comments powered by Disqus