Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../data-lst1/../../usr/include/zonestat_impl.h
Real path: /usr/include/zonestat_impl.h
Zurück
/* * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. */ #ifndef _ZONESTAT_IMPL_H #define _ZONESTAT_IMPL_H #include <zonestat.h> #include <sys/list.h> #include <paths.h> #include <libdllink.h> #include <net/if.h> #ifdef __cplusplus extern "C" { #endif /* * INTERFACES DEFINED IN THIS FILE DO NOT CONSTITUTE A PUBLIC INTERFACE. * * Do not consume these interfaces; your program will break in the future * (even in a patch) if you do. */ /* * This file defines the private interface used between zonestatd and * libzonestat. */ #define ZS_VERSION 1 #define ZS_PSET_DEFAULT PS_NONE #define ZS_PSET_MULTI PS_MYID #define ZS_PSET_ERROR PS_QUERY #define ZS_DOOR_PATH _PATH_SYSVOL "/zonestat_door" #define ZSD_CMD_READ 1 #define ZSD_CMD_CONNECT 2 #define ZSD_CMD_NEW_ZONE 3 /* The following read commands are unimplemented */ #define ZSD_CMD_READ_TIME 3 #define ZSD_CMD_READ_SET 4 #define ZSD_CMD_READ_SET_TIME 5 #define ZSD_STATUS_OK 0 #define ZSD_STATUS_VERSION_MISMATCH 1 #define ZSD_STATUS_PERMISSION 2 #define ZSD_STATUS_INTERNAL_ERROR 3 #define TIMESTRUC_IS_NAN(ts) \ ((ts).tv_sec == (time_t)UINT64_MAX && (ts).tv_nsec == (long)UINT64_MAX) #define TIMESTRUC_ADD_NANOSEC(ts, nsec) \ { \ (ts).tv_sec += (time_t)((nsec) / NANOSEC); \ (ts).tv_nsec += (long)((nsec) % NANOSEC); \ if ((ts).tv_nsec > NANOSEC) { \ (ts).tv_sec += (ts).tv_nsec / NANOSEC; \ (ts).tv_nsec = (ts).tv_nsec % NANOSEC; \ } \ } #define TIMESTRUC_ADD_TIMESTRUC(ts, add) \ { \ if (TIMESTRUC_IS_NAN(add)) { \ (ts) = (add); \ } else { \ (ts).tv_sec += (add).tv_sec; \ (ts).tv_nsec += (add).tv_nsec; \ if ((ts).tv_nsec > NANOSEC) { \ (ts).tv_sec += (ts).tv_nsec / NANOSEC; \ (ts).tv_nsec = (ts).tv_nsec % NANOSEC; \ } \ } \ } #define TIMESTRUC_DELTA(delta, new, old) \ { \ if (TIMESTRUC_IS_NAN(new)) { \ (delta) = (new); \ } else { \ (delta).tv_sec = (new).tv_sec - (old).tv_sec; \ (delta).tv_nsec = (new).tv_nsec - (old).tv_nsec;\ if ((delta).tv_nsec < 0) { \ delta.tv_nsec += NANOSEC; \ delta.tv_sec -= 1; \ } \ if ((delta).tv_sec < 0) { \ delta.tv_sec = 0; \ delta.tv_nsec = 0; \ } \ } \ } #define TIMESTRUC_INIT(ts) \ { \ (ts).tv_sec = 0; \ (ts).tv_nsec = 0; \ } #define TIMESTRUC_GREATER_OR_EQUAL(ts1, ts2) \ ((ts1).tv_sec > (ts2).tv_sec || \ ((ts1).tv_sec == (ts2).tv_sec && (ts1).tv_nsec >= (ts2).tv_nsec)) /* * Compute number of bytes necessary to round up to the next 64 bit * alignment. */ #define PAD_64BIT(n) \ (sizeof (uint64_t) - ((n) % sizeof (uint64_t))) /* * Convert a 64/32 bit agnostic struct timestruc64 to the 64 or 32 bit * struct timestruc of the current compilation environment. */ #if defined(_LP64) #define TIMESTRUC64_TO_TIMESTRUC(t, t64) \ (t).tv_sec = (time_t)(t64).tv_sec; \ assert((t64).tv_nsec <= NANOSEC); \ (t).tv_nsec = (long)(t64).tv_nsec; #else #define TIMESTRUC64_TO_TIMESTRUC(t, t64) \ if ((t64).tv_sec >= INT32_MAX) { \ (t).tv_sec = INT32_MAX; \ (t).tv_nsec = 0; \ } else { \ (t).tv_sec = (time_t)((t64).tv_sec); \ assert((t64).tv_nsec <= NANOSEC); \ (t).tv_nsec = (long)((t64).tv_nsec); \ } #endif /* * 64/32 bit agnostic time_t and struct timestruc for passing times between * zonestatd and libzonestat. */ typedef int64_t time64_t; typedef struct timestruc64 { time64_t tv_sec; time64_t tv_nsec; } timestruc64_t; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_property { data_type_t zsp_type; uint_t zsp_pad; union zsp_value_union { char *zsv_string; double zsv_double; uint64_t zsv_uint64; int64_t zsv_int64; uint_t zsv_uint; int zsv_int; } zsp_v; }; /* Array indices for zs_kstat_aggr_t objects. */ typedef enum { ZS_KSTAT_INDEX_INVALID = -1, ZS_KSTAT_INDEX_SYSCALL, ZS_KSTAT_INDEX_SYSREAD, ZS_KSTAT_INDEX_SYSWRITE, ZS_KSTAT_INDEX_SYSFORK, ZS_KSTAT_INDEX_SYSVFORK, ZS_KSTAT_INDEX_SYSEXEC, ZS_KSTAT_INDEX_SYSSPAWN, ZS_KSTAT_INDEX_READCH, ZS_KSTAT_INDEX_WRITECH, ZS_KSTAT_INDEX_SEMA, ZS_KSTAT_INDEX_NAMEI, ZS_KSTAT_INDEX_PROCOVF, /* number of failed forks. */ ZS_KSTAT_INDEX_MAX } zs_kstat_index_t; /* * For a zs_kstat_aggr_t object x, x[ZS_KSTAT_INDEX_<name>] stores data for * <name> we get from sys_zone_* kstats. * * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ typedef uint64_t zs_kstat_aggr_t[ZS_KSTAT_INDEX_MAX]; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_system { uint64_t zss_ram_total; uint64_t zss_ram_kern; uint64_t zss_ram_zones; uint64_t zss_locked_kern; uint64_t zss_locked_zones; uint64_t zss_vm_total; uint64_t zss_vm_kern; uint64_t zss_vm_zones; uint64_t zss_swap_total; uint64_t zss_swap_used; timestruc64_t zss_cpu_total_time; timestruc64_t zss_cpu_usage_kern; timestruc64_t zss_cpu_usage_zones; timestruc64_t zss_cpu_stolen_system; timestruc64_t zss_cpu_stolen_zones; uint64_t zss_processes_max; uint64_t zss_lwps_max; uint64_t zss_shm_max; uint64_t zss_shmids_max; uint64_t zss_semids_max; uint64_t zss_msgids_max; uint64_t zss_lofi_max; uint64_t zss_processes; uint64_t zss_lwps; uint64_t zss_shm; uint64_t zss_shmids; uint64_t zss_semids; uint64_t zss_msgids; uint64_t zss_lofi; uint64_t zss_ncpus; uint64_t zss_ncpus_online; double zss_load_avg[3]; uint64_t zss_net_speed; uint64_t zss_net_bytes; uint64_t zss_net_rbytes; uint64_t zss_net_obytes; uint64_t zss_net_pbytes; uint64_t zss_net_prbytes; uint64_t zss_net_pobytes; uint64_t zss_net_pused; /* kstat data for ZS_USER_ALL and ZS_USER_ZONES. */ zs_kstat_aggr_t zss_kstat_aggr_all; zs_kstat_aggr_t zss_kstat_aggr_zones; /* The following provide space for the given properties */ /* ZS_RESOURCE_PROP_CPU_TOTAL */ struct zs_property zss_prop_cpu_total; /* ZS_RESOURCE_PROP_CPU_ONLINE */ struct zs_property zss_prop_cpu_online; /* ZS_RESOURCE_PROP_CPU_LOAD_1MIN */ struct zs_property zss_prop_cpu_1min; /* ZS_RESOURCE_PROP_CPU_LOAD_5MIN */ struct zs_property zss_prop_cpu_5min; /* ZS_RESOURCE_PROP_CPU_LOAD_15MIN */ struct zs_property zss_prop_cpu_15min; }; struct zs_pset; struct zs_zone; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_pset_zone { list_node_t zspz_next; #if !defined(_LP64) uintptr_t zspz_pad1; uintptr_t zspz_pad2; #endif struct zs_pset *zspz_pset; #if !defined(_LP64) uintptr_t zspz_pad3; #endif struct zs_zone *zspz_zone; #if !defined(_LP64) uintptr_t zspz_pad4; #endif zoneid_t zspz_zoneid; uint_t zspz_pad5; time64_t zspz_start; hrtime_t zspz_hrstart; uint64_t zspz_intervals; uint64_t zspz_cpu_shares; uint_t zspz_sched_classes; uint_t zspz_pad6; timestruc64_t zspz_cpu_usage; /* The following provide space for the given properties */ /* ZS_PZ_PROP_SCHEDULERS */ struct zs_property zspz_prop_schedulers; /* ZS_PZ_PROP_CPU_SHARES */ struct zs_property zspz_prop_cpushares; /* ZS_PZ_PROP_CPU_CAP */ struct zs_property zspz_prop_cpucap; }; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_link_zone { list_node_t zlz_next; #if !defined(_LP64) uintptr_t zlz_pad1; uintptr_t zlz_pad2; #endif uint64_t zlz_total_bw; uint64_t zlz_total_bytes; uint64_t zlz_total_rbytes; uint64_t zlz_total_obytes; uint64_t zlz_total_prbytes; uint64_t zlz_total_pobytes; uint64_t zlz_partial_bw; /* The following provide space for the given properties */ /* ZLZ_PROP_NAME */ struct zs_property zlz_prop_name; /* ZLZ_PROP_BW */ struct zs_property zlz_prop_bw; /* ZLZ_PROP_BYTES */ struct zs_property zlz_prop_bytes; /* ZLZ_PROP_RBYTES */ struct zs_property zlz_prop_rbytes; /* ZLZ_PROP_OBYTES */ struct zs_property zlz_prop_obytes; /* ZLZ_PROP_PRBYTES */ struct zs_property zlz_prop_prbytes; /* ZLZ_PROP_POBYTES */ struct zs_property zlz_prop_pobytes; /* ZLZ_PROP_PARTBW */ struct zs_property zlz_prop_partbw; char zlz_name[ZONENAME_MAX]; char zlz_pad3[PAD_64BIT(ZONENAME_MAX)]; }; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_datalink { list_node_t zsl_next; #if !defined(_LP64) uintptr_t zsl_pad1; uintptr_t zsl_pad2; #endif list_t zsl_vlink_list; #if !defined(_LP64) uintptr_t zsl_pad3; uintptr_t zsl_pad4; uintptr_t zsl_pad5; uintptr_t zsl_pad6; #endif list_t zsl_zone_list; #if !defined(_LP64) uintptr_t zsl_pad7; uintptr_t zsl_pad8; uintptr_t zsl_pad9; uintptr_t zsl_pad10; #endif uint64_t zsl_rbytes; uint64_t zsl_obytes; uint64_t zsl_prbytes; uint64_t zsl_pobytes; uint64_t zsl_speed; uint64_t zsl_maxbw; uint64_t zsl_total_rbytes; uint64_t zsl_total_obytes; uint64_t zsl_total_prbytes; uint64_t zsl_total_pobytes; hrtime_t zsl_hrtime; datalink_id_t zsl_linkid; datalink_class_t zsl_class; zoneid_t zsl_zoneid; uint_t zsl_nclients; uint_t zsl_nlinkzones; uint_t zsl_intervals; boolean_t zsl_mmap; uint_t zsl_pad11; /* The following provide space for the given properties */ /* ZSL_PROP_LINKNAME */ struct zs_property zsl_prop_linkname; /* ZSL_PROP_DEVNAME */ struct zs_property zsl_prop_devname; /* ZSL_PROP_ZONENAME */ struct zs_property zsl_prop_zonename; /* ZSL_PROP_STATE */ struct zs_property zsl_prop_state; /* ZSL_PROP_CLASS */ struct zs_property zsl_prop_class; /* ZSL_PROP_RBYTES */ struct zs_property zsl_prop_rbytes; /* ZSL_PROP_OBYTES */ struct zs_property zsl_prop_obytes; /* ZSL_PROP_PRBYTES */ struct zs_property zsl_prop_prbytes; /* ZSL_PROP_POBYTES */ struct zs_property zsl_prop_pobytes; /* ZSL_PROP_SPEED */ struct zs_property zsl_prop_speed; /* ZSL_PROP_TOT_BYTES */ struct zs_property zsl_prop_tot_bytes; /* ZSL_PROP_TOT_RBYTES */ struct zs_property zsl_prop_tot_rbytes; /* ZSL_PROP_TOT_OBYTES */ struct zs_property zsl_prop_tot_obytes; /* ZSL_PROP_TOT_PRBYTES */ struct zs_property zsl_prop_tot_prbytes; /* ZSL_PROP_TOT_POBYTES */ struct zs_property zsl_prop_tot_pobytes; /* ZSL_PROP_MAXBW */ struct zs_property zsl_prop_maxbw; char zsl_linkname[MAXLINKNAMESPECIFIER]; char zsl_devname[MAXLINKNAMESPECIFIER]; char zsl_zonename[ZONENAME_MAX]; char zsl_state[10]; /* "up", "down", or "unknown" */ char zsl_pad12[PAD_64BIT(MAXLINKNAMESPECIFIER + MAXLINKNAMESPECIFIER + ZONENAME_MAX + 10)]; }; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_zone { list_node_t zsz_next; #if !defined(_LP64) uintptr_t zsz_pad1; uintptr_t zsz_pad2; #endif struct zs_system *zsz_system; #if !defined(_LP64) uintptr_t zsz_pad3; #endif hrtime_t zsz_hrstart; uint64_t zsz_cpu_shares; uint64_t zsz_cpu_cap; uint64_t zsz_ram_cap; uint64_t zsz_vm_cap; uint64_t zsz_locked_cap; uint64_t zsz_cpus_online; timestruc64_t zsz_cpu_usage; timestruc64_t zsz_pset_time; timestruc64_t zsz_cap_time; timestruc64_t zsz_share_time; timestruc64_t zsz_cpu_stolen; /* Time stolen from this zone */ uint64_t zsz_usage_ram; uint64_t zsz_usage_locked; uint64_t zsz_usage_vm; uint64_t zsz_processes_cap; uint64_t zsz_lwps_cap; uint64_t zsz_shm_cap; uint64_t zsz_shmids_cap; uint64_t zsz_semids_cap; uint64_t zsz_msgids_cap; uint64_t zsz_lofi_cap; uint64_t zsz_processes; uint64_t zsz_lwps; uint64_t zsz_shm; uint64_t zsz_shmids; uint64_t zsz_semids; uint64_t zsz_msgids; uint64_t zsz_lofi; uint64_t zsz_tot_pbytes; zoneid_t zsz_id; int zsz_default_sched_class; uint_t zsz_cputype; uint_t zsz_iptype; uint_t zsz_intervals; int zsz_vcpu_num; uint_t zsz_sched_classes; uint_t zsz_pad4; zs_kstat_aggr_t zsz_kstat_aggr; /* The following provide space for the given properties */ /* ZS_ZONE_PROP_NAME */ struct zs_property zsz_prop_name; /* ZS_ZONE_PROP_ID */ struct zs_property zsz_prop_id; /* ZS_ZONE_PROP_IPTYPE */ struct zs_property zsz_prop_iptype; /* ZS_ZONE_PROP_CPUTYPE */ struct zs_property zsz_prop_cputype; /* ZS_ZONE_PROP_DEFAULT_SCHED */ struct zs_property zsz_prop_defsched; /* ZS_ZONE_PROP_SCHEDULERS */ struct zs_property zsz_prop_schedulers; /* ZS_ZONE_PROP_CPU_SHARES */ struct zs_property zsz_prop_cpushares; /* ZS_ZONE_PROP_POOLNAME */ struct zs_property zsz_prop_poolname; /* ZS_ZONE_PROP_PSETNAME */ struct zs_property zsz_prop_psetname; char zsz_name[ZS_ZONENAME_MAX]; char zsz_pool[ZS_POOLNAME_MAX]; char zsz_pset[ZS_PSETNAME_MAX]; char zsz_pad5[PAD_64BIT(ZS_ZONENAME_MAX + ZS_POOLNAME_MAX + ZS_PSETNAME_MAX)]; }; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_pset { list_node_t zsp_next; #if !defined(_LP64) uintptr_t zsp_pad1; uintptr_t zsp_pad2; #endif list_t zsp_usage_list; #if !defined(_LP64) uintptr_t zsp_pad3; uintptr_t zsp_pad4; uintptr_t zsp_pad5; uintptr_t zsp_pad6; #endif hrtime_t zsp_hrstart; uint64_t zsp_online; uint64_t zsp_size; uint64_t zsp_min; uint64_t zsp_max; double zsp_load_avg[3]; uint64_t zsp_cpu_shares; timestruc64_t zsp_total_time; timestruc64_t zsp_usage_kern; timestruc64_t zsp_usage_zones; timestruc64_t zsp_cpu_stolen; /* Time stolen from this pset */ timestruc64_t zsp_stolen_zones; /* Time stolen from zones */ uint_t zsp_intervals; psetid_t zsp_id; uint_t zsp_cputype; uint_t zsp_sched_classes; uint_t zsp_nusage; uint_t zsp_pad7; /* The following provide space for the given propeties */ /* ZS_PSET_PROP_NAME */ struct zs_property zsp_prop_name; /* ZS_PSET_PROP_ID */ struct zs_property zsp_prop_id; /* ZS_PSET_PROP_CPUTYPE */ struct zs_property zsp_prop_cputype; /* ZS_PSET_PROP_SIZE */ struct zs_property zsp_prop_size; /* ZS_PSET_PROP_ONLINE */ struct zs_property zsp_prop_online; /* ZS_PSET_PROP_MIN */ struct zs_property zsp_prop_min; /* ZS_PSET_PROP_MAX */ struct zs_property zsp_prop_max; /* ZS_PSET_PROP_CPU_SHARES */ struct zs_property zsp_prop_cpushares; /* ZS_PSET_PROP_SCHEDULERS */ struct zs_property zsp_prop_schedulers; /* ZS_PSET_PROP_LOAD_1MIN */ struct zs_property zsp_prop_1min; /* ZS_PSET_PROP_LOAD_5MIN */ struct zs_property zsp_prop_5min; /* ZS_PSET_PROP_LOAD_15MIN */ struct zs_property zsp_prop_15min; char zsp_name[ZS_PSETNAME_MAX]; char zsp_pad8[PAD_64BIT(ZS_PSETNAME_MAX)]; }; /* * This data structure is passed between the 64 bit zonestatd and the 32 and * 64 bit versions of libzonestat. The structure size and member offsets * must match for both 64 and 32 bit. */ struct zs_usage { list_t zsu_zone_list; #if !defined(_LP64) uintptr_t zsu_pad1; uintptr_t zsu_pad2; uintptr_t zsu_pad3; uintptr_t zsu_pad4; #endif list_t zsu_pset_list; #if !defined(_LP64) uintptr_t zsu_pad5; uintptr_t zsu_pad6; uintptr_t zsu_pad7; uintptr_t zsu_pad8; #endif list_t zsu_datalink_list; #if !defined(_LP64) uintptr_t zsu_pad9; uintptr_t zsu_pad10; uintptr_t zsu_pad11; uintptr_t zsu_pad12; #endif struct zs_system *zsu_system; #if !defined(_LP64) uintptr_t zsu_pad13; #endif char *zsu_rbuf; #if !defined(_LP64) uintptr_t zsu_pad14; #endif size_t zsu_rsize; #if !defined(_LP64) uintptr_t zsu_pad15; #endif time64_t zsu_start; hrtime_t zsu_hrstart; hrtime_t zsu_hrtime; uint64_t zsu_size; uint64_t zsu_intervals; hrtime_t zsu_hrintervaltime; uint64_t zsu_gen; /* information in the structure invalid if false. */ boolean_t zsu_valid; boolean_t zsu_mmap; uint_t zsu_nzones; uint_t zsu_npsets; uint_t zsu_ndatalinks; uint_t zsu_nvlinks; }; struct zs_ctl { int zsctl_door; struct zs_usage *zsctl_start; }; struct zs_usage_set { struct zs_usage *zsus_total; struct zs_usage *zsus_avg; struct zs_usage *zsus_high; uint_t zsus_count; }; struct zs_usage_cache { int zsuc_ref; struct zs_usage *zsuc_usage; }; /* Among functions for zs_kstat_aggr_t, following are used in zonestatd. */ extern void zs_kstat_aggr_init(zs_kstat_aggr_t *); extern void zs_kstat_aggr_cp(zs_kstat_aggr_t *, zs_kstat_aggr_t *); extern void zs_kstat_aggr_diff(zs_kstat_aggr_t *, zs_kstat_aggr_t *, zs_kstat_aggr_t *); extern void zs_kstat_aggr_update(zs_kstat_aggr_t *, zs_kstat_aggr_t *); #ifdef __cplusplus } #endif #endif /* _ZONESTAT_IMPL_H */