4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
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.
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]
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #include <sys/types.h>
31 #include <sys/nvpair.h>
32 #include <sys/procset.h>
39 #define POOL_DEFAULT 0 /* default pool's ID */
40 #define POOL_MAXID 999999 /* maximum possible pool ID */
41 #define POOL_INVALID -1
44 #define POOL_DISABLED 0 /* pools enabled */
45 #define POOL_ENABLED 1 /* pools disabled */
52 poolid_t pool_id
; /* pool ID */
53 uint32_t pool_ref
; /* # of procs in this pool */
54 list_node_t pool_link
; /* links to next/prev pools */
55 nvlist_t
*pool_props
; /* pool properties */
56 struct pool_pset
*pool_pset
; /* pool's pset */
60 * Flags for pool_do_bind
62 #define POOL_BIND_PSET 0x00000001
63 #define POOL_BIND_ALL POOL_BIND_PSET
66 * Result codes for pool_get_class()
68 #define POOL_CLASS_UNSET -1 /* no scheduling class set */
69 #define POOL_CLASS_INVAL -2 /* class is invalid */
71 extern int pool_count
; /* current number of pools */
72 extern pool_t
*pool_default
; /* default pool pointer */
73 extern int pool_state
; /* pools state -- enabled/disabled */
74 extern void *pool_buf
; /* last state snapshot */
75 extern size_t pool_bufsz
; /* size of pool_buf */
80 extern pool_t
*pool_lookup_pool_by_id(poolid_t
);
81 extern pool_t
*pool_lookup_pool_by_name(char *);
82 extern pool_t
*pool_lookup_pool_by_pset(int);
85 * Configuration routines
87 extern void pool_init(void);
88 extern int pool_status(int);
89 extern int pool_create(int, int, id_t
*);
90 extern int pool_destroy(int, int, id_t
);
91 extern int pool_transfer(int, id_t
, id_t
, uint64_t);
92 extern int pool_assoc(poolid_t
, int, id_t
);
93 extern int pool_dissoc(poolid_t
, int);
94 extern int pool_bind(poolid_t
, idtype_t
, id_t
);
95 extern id_t
pool_get_class(pool_t
*);
96 extern int pool_do_bind(pool_t
*, idtype_t
, id_t
, int);
97 extern int pool_query_binding(idtype_t
, id_t
, id_t
*);
98 extern int pool_xtransfer(int, id_t
, id_t
, uint_t
, id_t
*);
99 extern int pool_pack_conf(void *, size_t, size_t *);
100 extern int pool_propput(int, int, id_t
, nvpair_t
*);
101 extern int pool_proprm(int, int, id_t
, char *);
102 extern int pool_propget(char *, int, int, id_t
, nvlist_t
**);
103 extern int pool_commit(int);
104 extern void pool_get_name(pool_t
*, char **);
107 * Synchronization routines
109 extern void pool_lock(void);
110 extern int pool_lock_intr(void);
111 extern int pool_lock_held(void);
112 extern void pool_unlock(void);
113 extern void pool_barrier_enter(void);
114 extern void pool_barrier_exit(void);
122 typedef void pool_event_cb_func_t(pool_event_t
, poolid_t
, void *);
124 typedef struct pool_event_cb
{
125 pool_event_cb_func_t
*pec_func
;
127 list_node_t pec_list
;
131 * Routines used to register interest in changes in cpu pools.
133 extern void pool_event_cb_register(pool_event_cb_t
*);
134 extern void pool_event_cb_unregister(pool_event_cb_t
*);
141 #endif /* _SYS_POOL_H */