Back to index

glibc  2.9
logwtmp.c File Reference
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <utmp.h>

Go to the source code of this file.


void logwtmp (const char *line, const char *name, const char *host)

Function Documentation

void logwtmp ( const char *  line,
const char *  name,
const char *  host 

Definition at line 28 of file logwtmp.c.

  struct utmp ut;

  /* Set information in new entry.  */
  memset (&ut, 0, sizeof (ut));
#if _HAVE_UT_PID - 0
  ut.ut_pid = getpid ();
#if _HAVE_UT_TYPE - 0
  ut.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
  strncpy (ut.ut_line, line, sizeof ut.ut_line);
  strncpy (ut.ut_name, name, sizeof ut.ut_name);
#if _HAVE_UT_HOST - 0
  strncpy (ut.ut_host, host, sizeof ut.ut_host);

#if _HAVE_UT_TV - 0
  struct timeval tv;
  __gettimeofday (&tv, NULL);
  ut.ut_tv.tv_sec = tv.tv_sec;
  ut.ut_tv.tv_usec = tv.tv_usec;
  ut.ut_time = time (NULL);

  updwtmp (_PATH_WTMP, &ut);

Here is the call graph for this function: