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>


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 




  25 #ifndef _LIBDLADM_IMPL_H
  26 #define _LIBDLADM_IMPL_H
  27 
  28 #include <sys/types.h>
  29 #include <sys/mac.h>
  30 #include <sys/mac_flow.h>
  31 #include <libdladm.h>
  32 #include <stdio.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 #define MAXLINELEN              1024
  39 #define BUFLEN(lim, ptr)        (((lim) > (ptr)) ? ((lim) - (ptr)) : 0)
  40 #define V4_PART_OF_V6(v6)       ((v6)._S6_un._S6_u32[3])
  41 
  42 /*
  43  * The handle contains file descriptors to DLD_CONTROL_DEV and
  44  * DLMGMT_DOOR.  Rather than opening the file descriptor each time
  45  * it is required, the handle is opened by consumers of libdladm
  46  * (e.g., dladm) and then passed to libdladm.
  47  */
  48 struct dladm_handle {
  49         int dld_fd;     /* file descriptor to DLD_CONTROL_DEV */
  50         int door_fd;    /* file descriptor to DLMGMT_DOOR */

  51 };
  52 
  53 /* DLMGMT_DOOR can only be accessed by libdladm and dlmgmtd */
  54 extern dladm_status_t   dladm_door_fd(dladm_handle_t, int *);
  55 
  56 extern dladm_status_t   dladm_errno2status(int);
  57 extern dladm_status_t   i_dladm_rw_db(dladm_handle_t, const char *, mode_t,
  58                             dladm_status_t (*)(dladm_handle_t, void *, FILE *,
  59                             FILE *), void *, boolean_t);
  60 extern dladm_status_t   dladm_get_state(dladm_handle_t, datalink_id_t,
  61                             link_state_t *);
  62 extern void             dladm_find_setbits32(uint32_t, uint32_t *, uint32_t *);
  63 extern dladm_status_t   dladm_parse_args(char *, dladm_arg_list_t **,
  64                             boolean_t);
  65 extern void             dladm_free_args(dladm_arg_list_t *);
  66 
  67 /*
  68  * Link attributes persisted by dlmgmtd.
  69  */
  70 /*




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 
  25 /*
  26  * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
  27  */
  28 
  29 #ifndef _LIBDLADM_IMPL_H
  30 #define _LIBDLADM_IMPL_H
  31 
  32 #include <sys/types.h>
  33 #include <sys/mac.h>
  34 #include <sys/mac_flow.h>
  35 #include <libdladm.h>
  36 #include <stdio.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 #define MAXLINELEN              1024
  43 #define BUFLEN(lim, ptr)        (((lim) > (ptr)) ? ((lim) - (ptr)) : 0)
  44 #define V4_PART_OF_V6(v6)       ((v6)._S6_un._S6_u32[3])
  45 
  46 /*
  47  * The handle contains file descriptors to DLD_CONTROL_DEV and
  48  * DLMGMT_DOOR.  Rather than opening the file descriptor each time
  49  * it is required, the handle is opened by consumers of libdladm
  50  * (e.g., dladm) and then passed to libdladm.
  51  */
  52 struct dladm_handle {
  53         int dld_fd;     /* file descriptor to DLD_CONTROL_DEV */
  54         int door_fd;    /* file descriptor to DLMGMT_DOOR */
  55         kstat_ctl_t *dld_kcp;   /* for kstat consumers */
  56 };
  57 
  58 /* DLMGMT_DOOR can only be accessed by libdladm and dlmgmtd */
  59 extern dladm_status_t   dladm_door_fd(dladm_handle_t, int *);
  60 
  61 extern dladm_status_t   dladm_errno2status(int);
  62 extern dladm_status_t   i_dladm_rw_db(dladm_handle_t, const char *, mode_t,
  63                             dladm_status_t (*)(dladm_handle_t, void *, FILE *,
  64                             FILE *), void *, boolean_t);
  65 extern dladm_status_t   dladm_get_state(dladm_handle_t, datalink_id_t,
  66                             link_state_t *);
  67 extern void             dladm_find_setbits32(uint32_t, uint32_t *, uint32_t *);
  68 extern dladm_status_t   dladm_parse_args(char *, dladm_arg_list_t **,
  69                             boolean_t);
  70 extern void             dladm_free_args(dladm_arg_list_t *);
  71 
  72 /*
  73  * Link attributes persisted by dlmgmtd.
  74  */
  75 /*