Change ownership I/O function handler
QNX SDP8.0Getting Started with the QNX OSDeveloperUser
Prototype:
int (*chown)( resmgr_context_t *ctp,
io_chown_t *msg,
RESMGR_OCB_T *ocb )
Classification:
I/O functionDefault handler:
iofunc_chown_default()Helper functions:
iofunc_ability_check(), iofunc_chown()Client functions:
chown(), fchown(), fchownat()Messages:
_IO_CHOWNData structure:
struct _io_chown {
uint16_t type;
uint16_t combine_len;
int32_t gid;
int32_t uid;
};
typedef union {
struct _io_chown i;
} io_chown_t;
Description:
Responsible for changing the user ID and group ID fields for the resource identified by the passed ocb to uid and gid, respectively. Note that the mount structure flag IOFUNC_PC_CHOWN_RESTRICTED and the OCB flag field should be examined to determine whether the filesystem allows chown() to be performed by non-root users.Returns:
The status via the helper macro _RESMGR_STATUS().Referenced by:
resmgr_io_funcs_t I/O tablePermission checking:
The default implementation iofunc_chown_default() calls the helper function iofunc_chown() to check the IOFUNC_PC_CHOWN_RESTRICTED flag to determine whether the user is allowed to change the user ID on the entry. The helper function also checks whether the client has the iofunc/chown (IOFUNC_ABILITY_CHOWN) dynamic ability (using iofunc_ability_check(), which allows it to set the user ID as if it were root. Finally, the helper checks to make sure it's not a read-only filesystem.
When iofunc_chown() sets the new user ID or group ID, it removes the set user ID and set group ID bits if they were set on the file. A value of -1 for the user or group ID means that the caller does not want to change that ID.
Page updated: