Provides the calling process's base program name.
#include <sys/encap.h>
int kgetpname (char * Buffer, size_t *BufferSize);
The kgetpname kernel service copies the program name of the calling process into the buffer specified by Buffer. Including the null terminator, the service copies no more than the lesser of *BufferSize, MAXCOMLEN, or the actual size of the program name in bytes into the buffer. If Buffer is NULL, or *BufferSize is 0, no copy is performed. If the full program name is copied into the buffer, the total number of bytes copied is written to *BufferSize. If kgetpname cannot copy the full program name into the buffer, the size in bytes of the full program name is written to *BufferSize, and ENAMETOOLONG is returned.
The kgetpname kernel service can only be called from the process environment.
Item | Description |
---|---|
0 | The full program name was successfully written to the buffer. |
ENAMETOOLONG | Only part of the full program name was written to the buffer, and kgetpname stored the (positive) length in bytes (including the null character) of the full program name into *BufferSize. |
EINVAL | Buffer is Null, BufferSize is NULL, or *BufferSize is 0. |
ENOTSUP | The kgetpname kernel service was called from inside an interrupt context. |