-->

Previous | Table of Contents | Next

Page 760

getdomainname, setdomainname

getdomainname, setdomainname—Gets/sets domain name

SYNOPSIS


#include <unistd.h>

int getdomainname(char *name, size_t len);

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

DESCRIPTION

These functions are used to access or to change the domain name of the current processor.

RETURN VALUE

On success, 0 is returned. On error, _1 is returned and errno is set appropriately.

ERRORS

EINVAL For getdomainname, name points to NULL or name is longer than len.
EPERM For setdomainname, the caller was not the superuser.
EINVAL For setdomainname, len was too long.

CONFORMS TO

POSIX does not specify these calls.

BUGS

getdomainname is not compliant with other implementations because they always return len bytes, even if name is longer. Linux, however, returns EINVAL in this case (as of DLL 4.4.1 libraries).

NOTES

Under Linux, getdomainname is implemented at the library level by calling uname(2).

SEE ALSO


gethostname(2), sethostname(2), uname(2)

Linux 0.99.11, 22 July 1993

getdtablesize

getdtablesize—Gets descriptor table size

SYNOPSIS


#include <unistd.h>

int getdtablesize(void);

DESCRIPTION

getdtablesize returns the maximum number of files a process can have open.

NOTES

getdtablesize is implemented as a library function in DLL 4.4.1. This function returns OPEN_MAX (set to 256 in Linux 0.99.11) if OPEN_MAX was defined when the library was compiled. Otherwise, _1 is returned and errno is set to ENOSYS.

Page 761

SEE ALSO


close(2), dup(2), open(2)

Linux 0.99.11, 22 July 1993

getgid, getegid

getgid, getegid—Gets group identity

SYNOPSIS


#include <unistd.h>

gid_t getgid(void);

gid_t getegid(void);

DESCRIPTION

getgid returns the real group ID of the current process.

getegid returns the effective group ID of the current process.

The real ID corresponds to the ID of the calling process. The effective ID corresponds to the set ID bit on the file being executed.

ERRORS

These functions are always successful.

CONFORMS TO

POSIX, BSD 4.3

SEE ALSO

setregid(2), setgid(2)

Linux 0.99.11, 23 July 1993

getgroups, setgroups

getgroups, setgroups—Gets/sets group access list

SYNOPSIS


#include <unistd.h>

int getgroups(int size, gid_t list[]);

#define_USE_BSD

#include <grp.h>

int setgroups(size_t size, const gid_t *list);

DESCRIPTION

getgroups Up to size supplemental groups are returned in list. If size is 0, list is not modified, but the total number of supplemental groups for the process is returned.
setgroups Sets the supplemental groups for the process. Only the superuser may use this function.

Page 762

RETURN VALUE

getgroups On success, the number of groups stored in list is returned (if size is 0, however, the number of supplemental group IDs associated with the process is returned). On error, _1 is returned and errno is set appropriately.
setgroups On success, 0 is returned. On error, _1 is returned and errno is set appropriately.

ERRORS

EFAULT list has an invalid address.
EPERM For setgroups, the user is not the superuser.
EINVAL For setgroups, gidsetsize is greater than NGROUPS (32 for Linux 0.99.11).

CONFORMS TO

getgroups conforms to POSIX.1 (and is present in BSD 4.3). Since setgroups requires privilege, it is not covered under POSIX.1.

BUGS

The USE BSD flag probably shouldn't be required for setgroups.

SEE ALSO


initgroups(3)

Linux 0.99.11, 23 July 1993

gethostid, sethostid

gethostid, sethostid—Gets/sets the unique identifier of the current host

SYNOPSIS


#include <unistd.h>

long int gethostid(void);

int sethostid(long int hostid);

DESCRIPTION

Get or set a unique 32-bit identifier for the current machine. The 32-bit identifier is intended to be unique among all UNIX systems in existence. This normally resembles the Internet address for the local machine, as returned by gethostbyname(3), and thus usually never needs to be set.

The sethostid call is restricted to the superuser.

The hostid argument is stored in the file /etc/hostid.

RETURNS VALUES

gethostid returns the 32-bit identifier for the current host as set by sethostid(2).

CONFORMS TO

POSIX.1 does not define these functions, but ISO/IEC 9945-1:1990 mentions them in B.4.4.1.

FILES


/etc/hostid

Page 763

SEE ALSO


hostid(1), gethostbyname(3)

Linux 0.99.13, 29 November 1993

gethostname, sethostname

gethostname, sethostname—Gets/sets hostname

SYNOPSIS


#include <unistd.h>

int gethostname(char *name, size_t len);

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

DESCRIPTION

These functions are used to access or to change the hostname of the current processor.

RETURN VALUE

On success, 0 is returned. On error, _1 is returned and errno is set appropriately.

ERRORS

EINVAL len is negative or, for sethostname, larger than the maximum allowed size. For gethostname on Linux/i386, len is smaller than the actual size.
EPERM For sethostname, the caller was not the superuser.
EFAULT name is an invalid address.

CONFORMS TO

POSIX.1 does not define these functions, but ISO/IEC 9945-1:1990 mentions them in B.4.4.1.

BUGS

Some other implementations of gethostname successfully return len bytes even if name is longer. Linux/Alpha complies with this behavior. Linux/i386, however, returns EINVAL in this case (as of DLL 4.6.27 libraries).

NOTES

Under Linux/Alpha, gethostname is a system call. Under Linux/i386, gethostname is implemented at the library level by calling uname(2).

SEE ALSO


getdomainname(2), setdomainname(2), uname(2)

Linux 1.3.6, 22 July 1995

getitimer, setitimer

getitimer, setitimer—Gets/sets value of an interval timer

SYNOPSIS


#include <sys/time.h>

int getitimer(int which, struct itimerval *value);

int setitimer(int which,conststruct itimer-val *value, struct itimerval *ovalue);

Previous | Table of Contents | Next