1gethostname(3XNET)X/Open Networking Services Library Functionsgethostname(3XNET)
2
3
4

NAME

6       gethostname - get name of current host
7

SYNOPSIS

9       cc [ flag ... ] file ... -lxnet [ library ... ]
10       #include <unistd.h>
11
12       int gethostname(char *name, size_t namelen);
13
14

DESCRIPTION

16       The  gethostname() function returns the standard host name for the cur‐
17       rent machine.  The namelen argument specifies the  size  of  the  array
18       pointed to by the name argument.  The returned name is null-terminated,
19       except that if namelen is an insufficient length to hold the host name,
20       then  the  returned name is truncated and it is unspecified whether the
21       returned name is null-terminated.
22
23
24       Host names are limited to 255 bytes.
25

RETURN VALUES

27       On successful completion, 0 is returned.  Otherwise, -1 is returned.
28

ERRORS

30       No errors are defined.
31

ATTRIBUTES

33       See attributes(5) for descriptions of the following attributes:
34
35
36
37
38       ┌─────────────────────────────┬─────────────────────────────┐
39       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
40       ├─────────────────────────────┼─────────────────────────────┤
41       │Interface Stability          │Standard                     │
42       ├─────────────────────────────┼─────────────────────────────┤
43       │MT-Level                     │MT-Safe                      │
44       └─────────────────────────────┴─────────────────────────────┘
45

SEE ALSO

47       uname(1), gethostid(3C), attributes(5), standards(5)
48
49
50
51SunOS 5.11                        10 Jun 2002               gethostname(3XNET)
Impressum