Skip to content

Commit

Permalink
OS-1704 add a time field with ISO time or unix timestamp to zoneevent…
Browse files Browse the repository at this point in the history
… output
  • Loading branch information
jjelinek committed Nov 28, 2012
1 parent b8582a6 commit ced3e32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion usr/src/uts/common/os/zone.c
Expand Up @@ -2760,20 +2760,26 @@ zone_free(zone_t *zone)
static void
zone_status_set(zone_t *zone, zone_status_t status)
{
timestruc_t now;
uint64_t t;

nvlist_t *nvl = NULL;
ASSERT(MUTEX_HELD(&zone_status_lock));
ASSERT(status > ZONE_MIN_STATE && status <= ZONE_MAX_STATE &&
status >= zone_status_get(zone));

/* Current time since Jan 1 1970 but consumers expect NS */
gethrestime(&now);
t = (now.tv_sec * NANOSEC) + now.tv_nsec;

if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP) ||
nvlist_add_string(nvl, ZONE_CB_NAME, zone->zone_name) ||
nvlist_add_string(nvl, ZONE_CB_NEWSTATE,
zone_status_table[status]) ||
nvlist_add_string(nvl, ZONE_CB_OLDSTATE,
zone_status_table[zone->zone_status]) ||
nvlist_add_int32(nvl, ZONE_CB_ZONEID, zone->zone_id) ||
nvlist_add_uint64(nvl, ZONE_CB_TIMESTAMP, (uint64_t)gethrtime()) ||
nvlist_add_uint64(nvl, ZONE_CB_TIMESTAMP, t) ||
sysevent_evc_publish(zone_event_chan, ZONE_EVENT_STATUS_CLASS,
ZONE_EVENT_STATUS_SUBCLASS, "sun.com", "kernel", nvl, EVCH_SLEEP)) {
#ifdef DEBUG
Expand Down

0 comments on commit ced3e32

Please sign in to comment.