Index of Section 2 Manual Pages
| Interix / SUA | getpdomain.2 | Interix / SUA |
getpdomain(2) getpdomain(2)
getpdomain()
NAME
getpdomain() - retrieve name of principal domain
SYNOPSIS
#include
int getpdomain (char * buf, int bufsize)
DESCRIPTION
The getpdomain(2) call retrieves the name of the machine's primary or
principal domain. The principal domain is used to create short forms for
user and group names.
A user's full login name consists of a domain name plus a user name. Any
user names presented without a domain name are assumed to belong to the
principal domain. For example, if the principal domain is SERVICES, the
user SERVICES+dana is displayed as dana. On input, the name dana is taken
as synonymous with SERVICES+dana.
A user named dana in a different domain is still displayed in the
canonical form, such as DEV+dana. If your principal domain is SERVICES and
you need to refer to the user DEV+dana, the canonical name still works.
The name of the primary domain is typically taken from the value of the
PrincipalDomain registry entry, which is located at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Services For Unix\PrincipalDomain. A standalone computer, one without a
primary domain controller, will not have this registry entry set, and the
getpdomain(2) call returns the name of the computer.
Caution
* Incorrectly editing the registry may severely damage your system.
Before making changes to the registry, you should back up any valued
data on the computer.
RETURN VALUE
The call can return -1, 0, or a value greater than 0.
* It returns -1 on failure, and sets errno to indicate the error.
* It returns 0 on success, and buf contains the principal domain name.
* It returns >0 if the buffer is not large enough to contain the
domain name; the value returned is the length of the Principal
Domain string in bytes, including the terminating \0 byte.
ERRORS
The getpdomain(2) call can fail for the following reasons:
[EINVAL]
The buf is NULL.
[ENOMEM]
There is not enough workspace for the call.
SEE ALSO
pdomain(1)
USAGE NOTES
The getpdomain function is thread safe.
The getpdomain function is not async-signal safe.