REALHOSTNAME_SA(3) BSD Library Functions Manual REALHOSTNAME_SA(3)NAME
realhostname_sa -- convert a struct sockaddr to the real host name
LIBRARY
System Utilities Library (libutil, -lutil)
SYNOPSIS
#include <sys/types.h>
#include <netinet/in.h>
#include <libutil.h>
int
realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen);
DESCRIPTION
The function realhostname_sa() converts addr to the corresponding host name. This is done by resolving addr to a host name and then ensuring
that the host name resolves back to addr.
host must point to a buffer of at least hsize bytes, and will always be written to by this function.
If the name resolution does not work both ways or if the host name is longer than hsize bytes, getnameinfo(3) with NI_NUMERICHOST specified,
is used to convert addr to an ASCII form.
If the string written to host is hsize bytes long, host will not be NUL terminated.
RETURN VALUES
The realhostname_sa() function will return one of the following constants which are defined in <libutil.h>:
HOSTNAME_FOUND
A valid host name was found.
HOSTNAME_INCORRECTNAME
A host name was found, but it did not resolve back to the passed ip. host now contains the numeric value of ip.
HOSTNAME_INVALIDADDR
ip could not be resolved. host now contains the numeric value of ip.
HOSTNAME_INVALIDNAME
A host name was found, but it could not be resolved back to any ip number. host now contains the numeric value of ip.
SEE ALSO getaddrinfo(3), getnameinfo(3), realhostname(3)BSD January 11, 2000 BSD
Check Out this Related Man Page
TRIMDOMAIN(3) BSD Library Functions Manual TRIMDOMAIN(3)NAME
trimdomain -- trim the current domain name from a host name
LIBRARY
System Utilities Library (libutil, -lutil)
SYNOPSIS
#include <sys/types.h>
#include <libutil.h>
void
trimdomain(char *fullhost, int hostsize);
DESCRIPTION
The function trimdomain() removes the current domain name from the passed fullhost name by writing a NUL character over the first period of
the passed name. The current domain name is determined by calling gethostname(3) and removing everything up to the first period. The name
is determined the first time this function is called and is cached for future use.
The trimdomain() function will only trim the domain name if the passed fullname ends with the current domain name and if the length of the
resulting host name does not exceed hostsize.
If the passed fullname is actually a DISPLAY specification of the form host.domain:nn[.nn] and the domain name is the same as the local
domain name, trimdomain() will remove the embedded domain name, copying the screen and display numbers to the end of the base host name and
resulting in host:nn[.nn].
RETURN VALUES
The trimdomain() function does not return a value.
SEE ALSO gethostname(3)BSD April 7, 1999 BSD
On AIX 5.3 host, the lvm_queryvg call does not work properly and results in a sudden memory rise. This is happening on one particular host and the call works fine on another host.
Is this a known issue and is there any patch available for this? (0 Replies)
Hi experts . . .
host name: prd47e
Sunsolaris 9 version
My mails are not going and am gettin regular messages like:
* My unqualified host name (prd47e) unknown; sleeping for retry
* unable to qualify my own domain name (prd47e) -- using short name
my /etc/hosts file contnets are... (6 Replies)
I'm trying to write a function to get the host name of any given IP address.
I'm trying to follow this manual but I'm stuck. I'm using gcc and Linux. Any ideas?
getnameinfo()
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>
char... (6 Replies)