10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 54321Scasper * Common Development and Distribution License (the "License"). 64321Scasper * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*9966SMenno.Lageman@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 24*9966SMenno.Lageman@Sun.COM * 25*9966SMenno.Lageman@Sun.COM * Portions Copyright 2009 Chad Mynhier 260Sstevel@tonic-gate */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifndef _PRTABLE_H 290Sstevel@tonic-gate #define _PRTABLE_H 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <limits.h> 360Sstevel@tonic-gate #include <zone.h> 370Sstevel@tonic-gate #include "prstat.h" 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define PLWP_TBL_SZ 4096 /* hash table of plwp_t structures */ 400Sstevel@tonic-gate #define LWP_ACTIVE 1 410Sstevel@tonic-gate 420Sstevel@tonic-gate typedef struct { 430Sstevel@tonic-gate size_t t_size; 440Sstevel@tonic-gate size_t t_nent; 450Sstevel@tonic-gate long *t_list; 460Sstevel@tonic-gate } table_t; 470Sstevel@tonic-gate 480Sstevel@tonic-gate typedef struct { 490Sstevel@tonic-gate size_t n_size; 500Sstevel@tonic-gate size_t n_nent; 51*9966SMenno.Lageman@Sun.COM uid_t *n_list; 52*9966SMenno.Lageman@Sun.COM } uidtbl_t; 530Sstevel@tonic-gate 540Sstevel@tonic-gate typedef struct { 550Sstevel@tonic-gate zoneid_t z_id; 560Sstevel@tonic-gate char z_name[ZONENAME_MAX]; 570Sstevel@tonic-gate } zonename_t; 580Sstevel@tonic-gate 590Sstevel@tonic-gate typedef struct { 600Sstevel@tonic-gate size_t z_size; 610Sstevel@tonic-gate size_t z_nent; 620Sstevel@tonic-gate zonename_t *z_list; 630Sstevel@tonic-gate } zonetbl_t; 640Sstevel@tonic-gate 650Sstevel@tonic-gate typedef struct plwp { /* linked list of pointers to lwps */ 660Sstevel@tonic-gate pid_t l_pid; 670Sstevel@tonic-gate id_t l_lwpid; 680Sstevel@tonic-gate int l_active; 690Sstevel@tonic-gate lwp_info_t *l_lwp; 700Sstevel@tonic-gate struct plwp *l_next; 710Sstevel@tonic-gate } plwp_t; 720Sstevel@tonic-gate 73*9966SMenno.Lageman@Sun.COM extern void pwd_getname(uid_t, char *, int, int); 74*9966SMenno.Lageman@Sun.COM extern void add_uid(uidtbl_t *, char *); 75*9966SMenno.Lageman@Sun.COM extern int has_uid(uidtbl_t *, uid_t); 760Sstevel@tonic-gate extern void add_element(table_t *, long); 770Sstevel@tonic-gate extern int has_element(table_t *, long); 780Sstevel@tonic-gate extern void add_zone(zonetbl_t *, char *); 790Sstevel@tonic-gate extern int has_zone(zonetbl_t *, zoneid_t); 800Sstevel@tonic-gate extern void convert_zone(zonetbl_t *); 810Sstevel@tonic-gate extern int foreach_element(table_t *, void *, void (*)(long, void *)); 820Sstevel@tonic-gate extern void lwpid_init(); 830Sstevel@tonic-gate extern void lwpid_add(lwp_info_t *, pid_t, id_t); 840Sstevel@tonic-gate extern lwp_info_t *lwpid_get(pid_t, id_t); 850Sstevel@tonic-gate extern int lwpid_pidcheck(pid_t); 860Sstevel@tonic-gate extern void lwpid_del(pid_t, id_t); 870Sstevel@tonic-gate extern void lwpid_set_active(pid_t, id_t); 880Sstevel@tonic-gate extern int lwpid_is_active(pid_t, id_t); 890Sstevel@tonic-gate 900Sstevel@tonic-gate #ifdef __cplusplus 910Sstevel@tonic-gate } 920Sstevel@tonic-gate #endif 930Sstevel@tonic-gate 940Sstevel@tonic-gate #endif /* _PRTABLE_H */ 95