[Previous] [Contents] [Next]

resmgr_detach()

Remove a pathname from the pathname space

Synopsis:

#include <sys/dispatch.h>

int resmgr_detach( dispatch_t * dpp,
                   int id,
                   unsigned flags );

Library:

libc

Description:

The resmgr_detach() function removes pathname id from the pathname space of context dpp. The pathname id is the return value from resmgr_attach().

flags

The possible flags (defined in <sys/dispatch.h> and <sys/resmgr.h>) are:

_RESMGR_DETACH_ALL
Detach the name from the namespace and invalidate all open bindings.
_RESMGR_DETACH_PATHNAME
Only detach the name from the namespace, leaving existing bindings intact. This option is useful when a file or device is unlinked and you wish the name removed but you want processes with open files to continue to use it until they close.

Blocking states

The resmgr_detach() function blocks until the RESMGR_HANDLE_T, that's passed to the corresponding resmgr_attach(), isn't being used in any connection function.

The effect that this has on servers is generally minimal. You should follow the following precautions to prevent potential deadlock situations:

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EINVAL
The id was never attached with resmgr_attach().
ENOENT
A previous detach request is in progress, or the id has already been detached.

Examples:

#include <sys/dispatch.h>
#include <stdio.h>
#include <stdlib.h>

int main( int argc, char **argv ) {
   dispatch_t  *dpp;
   int         id;

   if ( (dpp = dispatch_create()) == NULL ) {
      fprintf( stderr, "%s: Unable to allocate \
               dispatch handle.\n",argv[0] );
      return EXIT_FAILURE;
   }

   id = resmgr_attach ( ... );

   ...

   if ( resmgr_detach( dpp, id, 0) == -1 ) {
      fprintf( stderr, "Failed to remove pathname \
               from the pathname space.\n" );
      return EXIT_FAILURE;
}

For examples using the dispatch interface, see dispatch_create(), message_attach(), resmgr_attach(), and thread_pool_create(). For more information on writing a resource manager, see the "Writing a Resource Manager" chapter in the Programmer's Guide.

Classification:

QNX 6

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

See also:

resmgr_attach()


[Previous] [Contents] [Next]