givedescriptor()--Pass Descriptor Access to Another Job


  Syntax
 #include <sys/types.h>
 #include <sys/socket.h>

 int givedescriptor(int descriptor,
                    char *target_job)

  Service Program Name: QSOSRV1

  Default Public Authority: *USE

  Threadsafe: Yes

The givedescriptor() function is used to pass a descriptor from one IBM® i job to another IBM i job.


Parameters

descriptor
(Input) The descriptor that is to be passed to the target job.

target_job
(Input) A pointer to the internal job identifier of the target job that is to receive the descriptor referenced by the descriptor parameter.

Authorities

To give a descriptor, the source thread must be running under one of the following user profiles:

The job user identity is the name of the user profile by which a job is known to other jobs. It is described in more detail in the Work management topic collection.


Return Value

givedescriptor() returns an integer. Possible values are:


Error Conditions

When givedescriptor() fails, errno can be set to one of the following:



Error Messages



Usage Notes

  1. The information to specify in the target_job parameter can be obtained in the actual target job by using a work management API (for example, QUSRJOBI) to retrieve the internal job identifier.

    It is the responsibility of the application programmer to privately pass this information from the target job to the job that issues the givedescriptor(). One possible method that could be used to exchange this information is to use data queues.

  2. The target_job does not have to be waiting on a takedescriptor() for the givedescriptor() to complete successfully.

  3. If both the job in which the givedescriptor() is issued and the target_job end while a descriptor is in transit, the descriptor is reclaimed by the system, and the resource that it represents is closed.

  4. For files and directories, givedescriptor() is only supported for objects in the Root, QOpenSys, User-defined file systems (UDFS), and Network File System (NFS).

Related Information



API introduced: V3R1

[ Back to top | UNIX-Type APIs | APIs by category ]