setdomainname Subroutine

Purpose

Sets the name of the current domain.

Library

Standard C Library (libc.a)

Syntax

int setdomainname ( Name Namelen)
char *Name;
int Namelen;

Description

The setdomainname subroutine sets the name of the domain for the host machine. It is normally used when the system is bootstrapped. You must have root user authority to run this subroutine.

The purpose of domains is to enable two distinct networks that may have host names in common to merge. Each network would be distinguished by having a different domain name. At the current time, only Network Information Service (NIS) makes use of domains set by this subroutine.

All applications containing the setdomainname subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Note: Domain names are restricted to 256 characters.

Parameters

Item Description
Name Specifies the domain name to be set.
Namelen Specifies the size of the array pointed to by the Name parameter.

Return Values

If the call succeeds, a value of 0 is returned. If the call is unsuccessful, a value of -1 is returned and an error code is placed in the errno global variable.

Error Codes

The following errors may be returned by this subroutine:

Error Description
EFAULT The Name parameter gave an invalid address.
EPERM The caller was not the root user.