[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

iofunc_rename()

Do permission checks for a _IO_CONNECT_RENAME message

Synopsis:

#include <sys/iofunc.h>

int iofunc_rename( resmgr_context_t* ctp,
                   io_rename_t* msg,
                   iofunc_attr_t* oldattr,
                   iofunc_attr_t* olddattr,
                   iofunc_attr_t* newattr,
                   iofunc_attr_t* newdattr,
                   struct _client_info* info );

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_rename_t structure that contains the message that the resource manager received; see below.
oldattr
A pointer to the iofunc_attr_t structure that describes the characteristics of the resource.
olddattr
NULL, or a pointer to the iofunc_attr_t structure that describes the characteristics of the parent directory.
newattr
A pointer to the iofunc_attr_t structure that describes the characteristics of the target, if it exists.
newdattr
NULL, or a pointer to the iofunc_attr_t structure that describes the characteristics of the parent directory of the target.
info
NULL, or a pointer to a _client_info structure that contains the information about a client connection. For information about this structure, see ConnectClientInfo().

Library:

libc

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

Description:

The function iofunc_rename() does permission checks for the _IO_CONNECT message (subtype _IO_CONNECT_RENAME) for context ctp. The newattr argument is the attribute of the target if it already exists.

This function is similar to iofunc_open(). The iofunc_rename() function checks to see if the client (described by the optional info structure) has access to open the resource (name passed in the msg structure). The attr structure describes the resource's attributes.

The info argument can be passed as NULL, in which case iofunc_rename() obtains the client information itself via a call to iofunc_client_info(). It is, of course, more efficient to get the client information once, rather than call this function with NULL every time.

io_rename_t structure

The io_rename_t structure holds the _IO_CONNECT message received by the resource manager:

typedef union {
    struct _io_connect                  connect;
    struct _io_connect_link_reply       link_reply;
    struct _io_connect_ftype_reply      ftype_reply;
} io_rename_t;

This message structure is a union of an input message (coming to the resource manager), _io_connect, and two possible output or reply messages (going back to the client):

The reply includes the following extra information:

typedef union _io_rename_extra {
    char                                path[1];
} io_rename_extra_t;

Returns:

EACCES
The client doesn't have permissions to do the operation.
EBADFSYS
NULL was passed in oldattr, olddattr, or newdattr.
EFAULT
A fault occurred when the kernel tried to access the info buffer.
EINVAL
The oldattr and newdattr have identical values, the client process is no longer valid, or attempt to remove the parent (".") directory.
EISDIR
The old link is a directory but the new link isn't a directory.
ENOTDIR
Attempt to unlink a nondirectory entry using directory semantics (e.g. rmdir file).
ENOTEMPTY
Attempt to remove a directory that isn't empty.
EOK
Successful completion or there was already a newattr entry.
EPERM
The group ID or owner ID didn't match.
EROFS
Attempt to remove an entry on a read-only filesystem.

Classification:

QNX Neutrino

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

See also:

_io_connect, _io_connect_link_reply, _io_connect_ftype_reply, iofunc_client_info(), iofunc_open()

Writing a Resource Manager chapter of the Programmer's Guide.


[Previous] [Contents] [Index] [Next]