Please check the manual page gethostname(2).