_NutDupProcessFd()

duplicate process file descriptor 

Function


SYNOPSIS

#include <nutc.h>

int _NutDupProcessFd(pid_t pidSource, int fdSource, pid_t pidTarget);


DESCRIPTION

The _NutDupProcessFd() function duplicates the file descriptor fdSource in the process pidSource into a target process pidTarget and returns the value of the descriptor in the target process. It can be called from any process provided that the file descriptor being duplicated is accessible and resource limitations are not exceeded.


PARAMETERS

pidSource 

Specifies the ID of the source process. This must be a NuTCRACKER Platform application.

fdSource 

Specifies the source file descriptor.

pidTarget 

Specifies the ID of the target process. This must be a NuTCRACKER Platform application.


RETURN VALUES

On success, _NutDupProcessFd() returns 0. On error, it returns -1 and sets errno to the following:

EAGAIN 

The source file descriptor was being manipulated by another process and was inaccessible.

EBADF 

fdSource is not a valid file descriptor for the source process.

EINVAL 

The value of fdSource is not valid for file descriptors.

EPERM 

The process exists but does not allow its descriptor to be duplicated.

EMFILE 

Target process has too many files open.

ESRCH 

pidSource is not a valid process id.


CONFORMANCE

PTC MKS Toolkit UNIX APIs extension.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
dup(), dup2(), fcntl()


PTC MKS Toolkit 10.4 Documentation Build 39.