HPlogo Berkeley Sockets/iX Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 2 Socket System Calls

GETHOSTNAME

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

C Interface

        #include <unistd.h>



        int gethostname(hostname, size);

        char *hostname;

        size_t size;

Description

The gethostname system call returns the standard host name for the current processor as set by sethostname. The size parameter specifies the length of the hostname array. The hostname is null-terminated unless insufficient space is provided.

Return Value

If the call is successful, a 0 is returned. If it fails, a -1 is returned, and an error code is stored in errno.

Errors

The following error is returned by gethostname:

[EFAULT]

The hostname points to an illegal address. The reliable detection of this error is implementation dependent.

MPE/iX Specific

This call returns the node name configured in the local domain name field in NMMGR.

Author

UCB (University of California at Berkeley)

Feedback to webmaster