Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
popen(3) OSS Library Calls Reference Manual
Use From the Guardian Environment
If called from a Guardian process, a null pointer is returned and errno is set to [ENOTOSS].
NOTES
Programs using the popen( ) function to invoke an output filter should beware of possible
deadlock caused by output data remaining in the program’s buffer. This can be avoided either by
using the setbuf( ) function to ensure that the output stream is unbuffered or by using the fflush( )
function to ensure that all buffered data is flushed before you call the pclose( ) function.
CAUTIONS
If the original processes and the process started with the popen( ) function concurrently read or
write a common file, neither should use buffered I/O. If they do, the results are unpredictable.
RETURN VALUES
Upon successful completion, the popen( ) function returns a pointer to the FILE structure for the
opened stream. If files or processes could not be created, the popen( ) function returns a null
pointer. If the mode parameter is invalid, the popen( ) function returns a null string and sets
errno to [EINVAL].
ERRORS
If any of the following conditions occurs, the popen( ) function sets errno to the corresponding
value:
[EINVAL] The mode parameter is invalid.
[ENOMEM] The system has insufficient resources.
[ENOTOSS] The calling process was not an OSS process.
The popen( ) function can also return errors from its calls to the fork( ) and pipe( ) functions.
RELATED INFORMATION
Functions: exec(2), fclose(3), fopen(3), fork(2), pclose(3), pipe(2), setbuf(3).
STANDARDS CONFORMANCE
The following are HP extensions to the XPG4 Version 2 specification:
• The function can return the errno value [ENOTOSS].
5−56 Hewlett-Packard Company 527187-017