utmp

package
v0.0.0-...-d5ef96b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty        Utype = iota // Record does not contain valid info (formerly known as UT_UNKNOWN on Linux)
	RunLevel           = iota // Change in system run-level (see init(8))
	BootTime           = iota // Time of system boot (in ut_tv)
	NewTime            = iota // Time after system clock change (in ut_tv)
	OldTime            = iota // Time before system clock change (in ut_tv)
	InitProcess        = iota // Process spawned by init(8)
	LoginProcess       = iota // Session leader process for user login
	UserProcess        = iota // Normal process
	DeadProcess        = iota // Terminated process
	Accounting         = iota // Not implemented

	LineSize = 32
	NameSize = 32
	HostSize = 256
)

Type for ut_exit, below

Variables

This section is empty.

Functions

func AddrToString

func AddrToString(a [4]int32) string

AddrToString only handles IPv4 strings right now

Types

type TimeVal

type TimeVal struct {
	Sec  int32 `json:"seconds"`
	Usec int32 `json:"microseconds"`
}

func (TimeVal) MarshalJSON

func (t TimeVal) MarshalJSON() ([]byte, error)

Correctly marshal unix times to human readable timestamps

type Utmp

type Utmp struct {
	Type Utype `json:"type"` // Type of record

	Pid     int32          `json:"pid"`     // PID of login process
	Device  [LineSize]byte `json:"device"`  // Device name of tty - "/dev/"
	Id      [4]byte        `json:"id"`      // Terminal name suffix or inittab(5) ID
	User    [NameSize]byte `json:"user"`    // Username
	Host    [HostSize]byte `json:"host"`    // Hostname for remote login or kernel version for run-level messages
	Exit    exit_status    `json:"exit"`    // Exit status of a process marked as DeadProcess; not used by Linux init(1)
	Session int32          `json:"session"` // Session ID (getsid(2)), used for windowing
	Time    TimeVal        `json:"time"`    // Time entry was made
	Addr    [4]int32       `json:"address"` // Internet address of remote host; IPv4 address uses just Addr[0]
	Unused  [20]byte       `json:"-"`       // Reserved for future use
	// contains filtered or unexported fields
}

func (Utmp) MarshalJSON

func (u Utmp) MarshalJSON() ([]byte, error)

Overrides the default Marshal method for Utmp

MarshalJSON correctly interprets the address field and byte arrays into properly formatted strings stripped of empty padding

type Utype

type Utype int16

Values for Utmp.Type field

func (Utype) MarshalJSON

func (u Utype) MarshalJSON() ([]byte, error)

MarshalJSON correctly marshals the constants for the utmp "type" field

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL