̾??
gethostname
,
sethostname
—
???ߤΥۥ??Ȥ?̾???μ???
/ ????
Standard C Library (libc, -lc)
<unistd.h>
int
gethostname
(char
*name, int namelen) int
sethostname
(const char *name,
int namelen)
gethostname
() ??
sethostname
()
?ˤ??ä????????ꤵ?줿?????ߤΥץ????å???ɸ???Υۥ???̾???֤??ޤ????ѥ????
namelen ?? name
?????Υ??????????ꤷ?ޤ???
???ѤǤ??????֤??Խ?ʬ?ʾ??????????ơ??֤?????̾???ϥ̥??ǽ??????ޤ???
sethostname
()
?ϡ?Ĺ?? namelen ??
name
?Ȥ??????ۥ??ȥޥ???̾?????ꤷ?ޤ???
???θƤӽФ??ϥ????ѥ桼???˸??ꤵ?졢
?̾??ϥ????ƥ??Υ֡??ȥ??ȥ??å??ˤ????¹Ԥ????ޤ???
Upon successful completion, the value 0 is returned;
otherwise the value -1 is returned and the global variable
errno is set to indicate the error.
???????θƤӽФ??ˤ??äơ????Υ??顼???֤????礬?????ޤ???
- [
EFAULT
]
- name ?ޤ??? namelen
?ѥ????????̵???ʥ??ɥ쥹??Ϳ???ޤ?????
- [
EPERM
]
- ?ƤӽФ??????ۥ???̾?????ꤷ?褦?Ȥ??ޤ???????
?????ѥ桼???ǤϤ????ޤ????Ǥ?????
?ۥ???̾??Ĺ???? MAXHOSTNAMELEN (
⟨sys/param.h⟩ ????????)
ʸ???????¤????Ƥ??ꡢ ???ߤ??????? 256
ʸ???Ǥ??? ????ʸ???ˤ???????
?̥?
???ޤߤޤ???
gethostname
() ?ؿ??ϡ?
4.2BSD
?ǤϤ??????о줷?ޤ?????