Please check the manual page getdomainname(2).