iofunc_acl()

Updated: May 06, 2022

Handle an _IO_ACL message

Synopsis:

#include <sys/iofunc.h>

int iofunc_acl( resmgr_context_t *ctp,
                io_acl_t *msg, 
                iofunc_ocb_t *ocb );
                iofunc_attr_t *attr );

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 a io_acl_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.
attr
A pointer to the iofunc_attr_t structure that describes the characteristics of the device that's associated with your resource manager.

Library:

libc

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

Description:

The iofunc_acl() helper function implements handling of _IO_ACL (access control list) messages. It's called by the default handler, iofunc_acl_default().

Note: ACLs will be supported for a device if either the attr->mount pointer is NULL, or if the IOFUNC_PC_ACL bit is set in the conf member of the iofunc_mount_t pointed to by a non-NULL attr->mount pointer.

For more information about ACLs, see Working with Access Control Lists (ACLs) in the QNX Neutrino Programmer's Guide.

io_acl_t structure

The io_acl_t structure holds the _IO_ACL message received by the resource manager:

struct _io_acl {
        uint16_t                        type;
        uint16_t                        combine_len;
        uint32_t                        subtype;
        int32_t                         zero[2];
        /* struct _acl_header           hdr; */
        /* void                         acl_data */
};

enum _io_acl_subtypes {
        _IO_ACL_GET,
        _IO_ACL_SET,
        _IO_ACL_CHK
};

struct _io_acl_reply {
        uint32_t                        zero[4];
        /* struct _acl_header           hdr; */
        /* void                         acl_data */
};

typedef union {
        struct _io_acl                  i;
        struct _io_acl_reply            o;
} io_acl_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_acl that contains the following members:

type
_IO_ACL.
combine_len
If the message is a combine message, _IO_COMBINE_FLAG is set in this member. For more information, see the Combine Messages chapter of Writing a Resource Manager.
subtype
One of the following:
  • _IO_ACL_GET — We're requesting (querying) the ACL. This setting is used by the getfacl utility.
  • _IO_ACL_SET — We're creating, modifying, or deleting the ACL. Before doing the operation, a buffer sanity check is performed. This setting is used by the setfacl utility.
  • _IO_ACL_CHK — Starts out similar to _IO_ACL_SET, but stops after performing the sanity check.

The commented-out declaration for acl_data indicates that the _io_acl structure is immediately followed by data.

The o member of the io_acl_t message is a structure of type _io_acl_reply that currently contains no useful data. The commented-out declarations for hdr and acl_data indicate that an _acl_header structure and additional data immediately follow the _io_acl_reply structure.

Returns:

EOK
Success.

Classification:

QNX Neutrino

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