HP DCE/9000 Version 1.7 Application Development Tools for HP-UX 11.0 Release Note
40 HP DCE 1.7 Application Development Tools Release Note
Developing DCE Applications with HP DCE/ 9000
Notes on Programming with HP DCE
Calling exec() from a DCE Application
Care must be used when calling exec() from a DCE application. HP DCE
Threads sometimes sets open file descriptors to non-blocking mode, so
that I/O calls block only the calling thread, not the entire process. This
occurs unbeknownst to the application itself. HP provides wrappers for
the exec() family of calls that, among other things, resets file descriptors
to blocking mode if they were set non-blocking by HP DCE Threads and
not the application.
For file descriptors that were inherited across fork(), this also has the
effect of resetting the file descriptor to blocking mode in the parent as
well as the child. If the parent is a threaded program, it can cause the
parent to hang due to a blocking I/O call.
There are two possible work-arounds:
• If the process will not need the open file descriptor, set the
close-on-exec flag for the file prior to calling exec(). The file descriptor
will not be reset in this case.
• Avoid using the exec() wrapper; call exec() directly instead. This is
accomplished by undefining the appropriate macro, for example:
#undef execle.
Note that if the exec() wrapper is circumvented, the new process may
inherit file descriptors that are unexpectedly set non-blocking; some
signals may be unexpectedly ignored or not ignored; and, if exec() is
called without first calling fork(), the new process will probably be killed
by SIGVTALRM as soon as it begins execution.
Process Forking
Process forking from within RPC applications that use the
connection-oriented (TCP/IP) RPC protocol is not supported.
While it is generally safe for an application to perform a fork followed
immediately by an exec(), the following sequence may not work for
TCP/IP RPC programs:
• The TCP/IP RPC process forks.
• The child process tries to use RPC over the TCP/IP protocol before the
exec().