Back to index

glibc  2.9
Functions
utsname.h File Reference
#include <posix/sys/utsname.h>

Go to the source code of this file.

Functions

int __uname (struct utsname *__name)

Function Documentation

int __uname ( struct utsname __name)

Definition at line 29 of file uname.c.

{
  int save;

  if (name == NULL)
    {
      __set_errno (EINVAL);
      return -1;
    }

  save = errno;
  if (__gethostname (name->nodename, sizeof (name->nodename)) < 0)
    {
      if (errno == ENOSYS)
       {
         /* Hostname is meaningless for this machine.  */
         name->nodename[0] = '\0';
         __set_errno (save);
       }
#ifdef ENAMETOOLONG
      else if (errno == ENAMETOOLONG)
       /* The name was truncated.  */
       __set_errno (save);
#endif
      else
       return -1;
    }
  strncpy (name->sysname, UNAME_SYSNAME, sizeof (name->sysname));
  strncpy (name->release, UNAME_RELEASE, sizeof (name->release));
  strncpy (name->version, UNAME_VERSION, sizeof (name->version));
  strncpy (name->machine, UNAME_MACHINE, sizeof (name->machine));

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: