Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > s

sethostname(2)

HP-UX 11i Version 1.6: June 2002
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

sethostname — set name of host cpu

SYNOPSIS

#include <unistd.h>

int sethostname(const char *name, size_t namelen);

DESCRIPTION

The sethostname() system call sets the name of the host processor to name, which has a length of namelen characters. At system boot time sethostname() is normally executed by the hostname command (see hostname(1)) in the /sbin/init.d/hostname script. Host names are limited to MAXHOSTNAMELEN characters, as defined in <sys/param.h>.

RETURN VALUE

sethostname() returns the following values:

0

Successful completion.

-1

Failure. errno is set to indicate the error.

ERRORS

If sethostname() fails, errno is set to one of the following values.

[EFAULT]

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

[EPERM]

The user does not have appropriate privileges.

AUTHOR

sethostname() was developed by the University of California, Berkeley.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2002 Hewlett-Packard Development Company, L.P.