1getexecname(3C)          Standard C Library Functions          getexecname(3C)
2
3
4

NAME

6       getexecname - return pathname of executable
7

SYNOPSIS

9       #include <stdlib.h>
10
11       const char *getexecname(void);
12
13

DESCRIPTION

15       The  getexecname() function returns the pathname (the first argument of
16       one of the exec family of functions; see  exec(2))  of  the  executable
17       that started the process.
18
19
20       Normally  this is an absolute pathname, as the majority of commands are
21       executed by the shells that append the command name to the user's  PATH
22       components.   If this is not an absolute path, the output of getcwd(3C)
23       can be prepended to it to create an absolute path, unless  the  process
24       or one of its ancestors has changed its root directory or current work‐
25       ing directory since the last successful call to one of the exec  family
26       of functions.
27

RETURN VALUES

29       If successful, getexecname() returns a pointer to the executables path‐
30       name; otherwise, it returns 0.
31

USAGE

33       The getexecname() function obtains the  executable  pathname  from  the
34       AT_SUN_EXECNAME aux vector.  These vectors are made available to dynam‐
35       ically linked processes only.
36
37
38       A successful call to one of the exec family of  functions  will  always
39       have  AT_SUN_EXECNAME  in  the  aux  vector. The associated pathname is
40       guaranteed to be less than or  equal  to  PATH_MAX,  not  counting  the
41       trailing null byte that is always present.
42

ATTRIBUTES

44       See attributes(5) for descriptions of the following attributes:
45
46
47
48
49       ┌─────────────────────────────┬─────────────────────────────┐
50       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
51       ├─────────────────────────────┼─────────────────────────────┤
52       │MT-Level                     │Safe                         │
53       └─────────────────────────────┴─────────────────────────────┘
54

SEE ALSO

56       exec(2), getcwd(3C), attributes(5)
57
58
59
60SunOS 5.11                        17 Dec 1997                  getexecname(3C)
Impressum