getexecname(3C)
NAME
getexecname − return pathname of executable
SYNOPSIS
#include <stdlib.h>
const char ∗ getexecname(void);
DESCRIPTION
The getexecname() function returns the pathname of the executable that started the process as passed as the first argument to execve(char ∗ file, ...).
Normally this is an absolute pathname, as the majority of commands are executed by the shells who append the command name to the users PATH components. If this is not an absolute path, getcwd(3C) can be prepended to it to create an absolute path.
RETURN VALUES
If successful, getexecname() returns a pointer to the executables pathname; otherwise, it returns 0.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
| MT-Level | Safe |
SEE ALSO
exec(2), getcwd(3C), attributes(5)
NOTES
The getexecname() function obtains the executable pathname from the AT_SUN_EXECNAME aux vector. These vectors are made available to dynamically linked processes only.
A successful call to one of the exec family of functions will always have in the aux vector. The associate pathname is guaranteed to be less than, or equal, to PATH_MAX, not counting the trailing null byte, which is always present.
SunOS 5.6 — Last change: 12 May 1997