Print this page
10052 "dladm show-ether" should pick one kstat snapshot and stick with it
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gergo Doma <domag02@gmail.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>

*** 20,29 **** --- 20,33 ---- */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ + /* + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + */ + #include <unistd.h> #include <errno.h> #include <ctype.h> #include <fcntl.h> #include <strings.h>
*** 119,128 **** --- 123,133 ---- return (DLADM_STATUS_NOMEM); } (*handle)->dld_fd = dld_fd; (*handle)->door_fd = -1; + (*handle)->dld_kcp = NULL; return (DLADM_STATUS_OK); } void
*** 130,139 **** --- 135,146 ---- { if (handle != NULL) { (void) close(handle->dld_fd); if (handle->door_fd != -1) (void) close(handle->door_fd); + if (handle->dld_kcp != NULL) + (void) kstat_close(handle->dld_kcp); free(handle); } } int
*** 140,149 **** --- 147,164 ---- dladm_dld_fd(dladm_handle_t handle) { return (handle->dld_fd); } + kstat_ctl_t * + dladm_dld_kcp(dladm_handle_t handle) + { + if (handle->dld_kcp == NULL) + handle->dld_kcp = kstat_open(); + return (handle->dld_kcp); + } + /* * If DLMGMT_DOOR hasn't been opened in the handle yet, open it. */ dladm_status_t dladm_door_fd(dladm_handle_t handle, int *door_fd)