dg_attach_to_shared_descriptors(2)
DG/UX 5.4.
d2
g_attach_to_shared_descriptors(2)
NAME
dg_attach_to_shared_descriptors - attach another process's shared
descriptor array
SYNOPSIS
#include <sys/types.h>
int dg_attach_to_shared_descriptors (pid_t pid)
where:
pid The process identifier of the process whose shared
descriptor array is to be attached.
DESCRIPTION
File descriptors fall into two classes based on their process access
and permanence semantics. The first class of file descriptor is a
per-process file descriptor. A per-process descriptor is accessible
only from the current process. A per-process descriptor is closed
only as a by-product of some action taken by the current process.
This class of file descriptor is never shared by other processes.
The second class of file descriptor is a shared descriptor. Shared
descriptors are collected into a shared descriptor array, which is
the granularity upon which any process sharing of descriptors is
done. The shared descriptor array and all shared descriptors in that
array persist only as long as the shared descriptor array is attached
to at least one process. If a shared descriptor array is no longer
referenced by any process then it will be destroyed and all remaining
descriptors in the array will be closed. References to the shared
descriptor array are lost either when a process exits or when it
attaches to another shared descriptor array.
A shared descriptor is accessible from all processes that have
attached to the same descriptor array. A shared descriptor may be
closed by any process to which it is attached.
Dg_attach_to_shared_descriptors(2) attaches the shared process array
of process pid to the calling process. The attach operation will
fail if the attach would cause the per-process soft limit on the
maximum number of descriptors to be exceeded. When the attach is
completed, the shared descriptor array (if any) previously attached
to the calling process is no longer attached (the individual
descriptors may or may not be closed) and the shared descriptor array
of pid is now attached to the calling process.
Shared descriptors should be used only by processes that are prepared
to cooperate in their use. Since shared descriptors may be closed by
any process that have access to it, process must be prepared to lose
access to a descriptor because of the action of another process.
ACCESS CONTROL
The process identified by pid must have previously issued a
successful dg_allow_shared_descriptor_attach(2) on the pid of the
calling process for this call to be successful.
Licensed material--property of copyright holder(s) 1
dg_attach_to_shared_descriptors(2)
DG/UX 5.4.
d2
g_attach_to_shared_descriptors(2)
RETURN VALUE
0 All descriptors in the shared descriptor array of process pid
may now be accessed by the calling process.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
ESRCH pid does not exist.
EMFILE The attach operation would exceed the soft limit on
the number of descriptors per process.
EPERM The calling process does not have permission to attach
to the shared descriptor array of process pid.
SEE ALSO
open(2), dg_allow_shared_descriptor_attach(2).
Licensed material--property of copyright holder(s) 2