setdomainname()

Updated: April 19, 2023

Set the domain name of the current host

Synopsis:

#include <unistd.h>

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

Arguments:

name
The domain name.
namelen
The length of the name.

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The setdomainname() function sets the domain name of the host machine. Only the superuser (root) can use this function and even then, the function is normally used only when bootstrapping a system.

Returns:

0
Success.
-1
Failure; errno is set.

Errors:

EFAULT
The name or namelen parameters gave an invalid address.
EPERM
The caller tried to set the domain name without being the superuser.

Classification:

Unix

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes