1f08c3bdfSopenharmony_ci/* 2f08c3bdfSopenharmony_ci * cpuset header file 3f08c3bdfSopenharmony_ci * 4f08c3bdfSopenharmony_ci * Copyright (c) 2004-2006 Silicon Graphics, Inc. All rights reserved. 5f08c3bdfSopenharmony_ci * 6f08c3bdfSopenharmony_ci * Paul Jackson <pj@sgi.com> 7f08c3bdfSopenharmony_ci */ 8f08c3bdfSopenharmony_ci 9f08c3bdfSopenharmony_ci/* 10f08c3bdfSopenharmony_ci * This program is free software; you can redistribute it and/or modify 11f08c3bdfSopenharmony_ci * it under the terms of the GNU Lesser General Public License as published by 12f08c3bdfSopenharmony_ci * the Free Software Foundation; either version 2.1 of the License, or 13f08c3bdfSopenharmony_ci * (at your option) any later version. 14f08c3bdfSopenharmony_ci * 15f08c3bdfSopenharmony_ci * This program is distributed in the hope that it will be useful, 16f08c3bdfSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 17f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18f08c3bdfSopenharmony_ci * GNU Lesser General Public License for more details. 19f08c3bdfSopenharmony_ci * 20f08c3bdfSopenharmony_ci * You should have received a copy of the GNU Lesser General Public License 21f08c3bdfSopenharmony_ci * along with this program; if not, write to the Free Software 22f08c3bdfSopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23f08c3bdfSopenharmony_ci */ 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_ci/* 26f08c3bdfSopenharmony_ci * cpusets - basic routines (use cpuset relative numbering of CPUs) 27f08c3bdfSopenharmony_ci * 28f08c3bdfSopenharmony_ci * link with -lbitmask -lcpuset 29f08c3bdfSopenharmony_ci * 30f08c3bdfSopenharmony_ci * cpuset_pin(int relcpu) - Pin current task to one CPU in its cpuset. 31f08c3bdfSopenharmony_ci * cpuset_size() - How many CPUs are in current tasks cpuset? 32f08c3bdfSopenharmony_ci * cpuset_where() - Most recent CPU in current tasks cpuset that task ran on. 33f08c3bdfSopenharmony_ci * cpuset_unpin() - Undo cpuset_pin(), let task run anywhere in its cpuset. 34f08c3bdfSopenharmony_ci */ 35f08c3bdfSopenharmony_ci 36f08c3bdfSopenharmony_ci/* 37f08c3bdfSopenharmony_ci * cpusets - sets of CPUs and Memory Nodes - advanced routines (use system 38f08c3bdfSopenharmony_ci * wide numbering of CPUs and Memory Nodes, except as noted) 39f08c3bdfSopenharmony_ci * 40f08c3bdfSopenharmony_ci * link with -lbitmask -lcpuset 41f08c3bdfSopenharmony_ci * 42f08c3bdfSopenharmony_ci * cpuset_version() - [optional] Version (simple integer) of the library. 43f08c3bdfSopenharmony_ci * 44f08c3bdfSopenharmony_ci * ==== Allocate and free struct cpuset ==== 45f08c3bdfSopenharmony_ci * 46f08c3bdfSopenharmony_ci * cpuset_alloc() - Allocate a new struct cpuset 47f08c3bdfSopenharmony_ci * cpuset_free(struct cpuset *cp) - Free struct cpuset *cp 48f08c3bdfSopenharmony_ci * 49f08c3bdfSopenharmony_ci * ==== Lengths of CPUs and Memory Nodes bitmasks - use to alloc them ==== 50f08c3bdfSopenharmony_ci * 51f08c3bdfSopenharmony_ci * cpuset_cpus_nbits() - Number of bits in a CPU bitmask on current system 52f08c3bdfSopenharmony_ci * cpuset_mems_nbits() - Number of bits in a Memory bitmask on current system 53f08c3bdfSopenharmony_ci * 54f08c3bdfSopenharmony_ci * ==== Set various attributes of a struct cpuset ==== 55f08c3bdfSopenharmony_ci * 56f08c3bdfSopenharmony_ci * cpuset_setcpus(cp, cpus) - Set CPUs in cpuset cp to bitmask cpus 57f08c3bdfSopenharmony_ci * cpuset_setmems(cp, mems) - Set Memory Nodes in cpuset cp to bitmask mems 58f08c3bdfSopenharmony_ci * cpuset_set_iopt(cp, optname, val) - Set integer value optname of cpuset cp 59f08c3bdfSopenharmony_ci * cpuset_set_sopt(cp, optname, val) - [optional] Set string value optname 60f08c3bdfSopenharmony_ci * 61f08c3bdfSopenharmony_ci * ==== Query various attributes of a struct cpuset ==== 62f08c3bdfSopenharmony_ci * 63f08c3bdfSopenharmony_ci * cpuset_getcpus(cp, cpus) - Write CPUs in cpuset cp to bitmask cpus 64f08c3bdfSopenharmony_ci * cpuset_getmems(cp, mems) - Write Memory Nodes in cpuset cp to bitmask mems 65f08c3bdfSopenharmony_ci * cpuset_cpus_weight(cp) - Number of CPUs in a cpuset 66f08c3bdfSopenharmony_ci * cpuset_mems_weight(cp) - Number of Memory Nodes in a cpuset 67f08c3bdfSopenharmony_ci * cpuset_get_iopt(cp, optname) - Return integer value of option optname in cp 68f08c3bdfSopenharmony_ci * cpuset_get_sopt(cp, optname) - [optional] Return string value of optname 69f08c3bdfSopenharmony_ci * 70f08c3bdfSopenharmony_ci * ==== Local CPUs and Memory Nodes ==== 71f08c3bdfSopenharmony_ci * 72f08c3bdfSopenharmony_ci * cpuset_localcpus(mems, cpus) - Set cpus to those local to Memory Nodes mems 73f08c3bdfSopenharmony_ci * cpuset_localmems(cpus, mems) - Set mems to those local to CPUs cpus 74f08c3bdfSopenharmony_ci * cpuset_cpumemdist(cpu, mem) - [optional] Hardware distance from CPU to Memory Node 75f08c3bdfSopenharmony_ci * cpuset_cpu2node(cpu) - [optional] Return Memory Node closest to cpu 76f08c3bdfSopenharmony_ci * cpuset_addr2node(addr) - [optional] Return Memory Node holding page at specified addr 77f08c3bdfSopenharmony_ci * 78f08c3bdfSopenharmony_ci * ==== Create, delete, query, modify, list and examine cpusets ==== 79f08c3bdfSopenharmony_ci * 80f08c3bdfSopenharmony_ci * cpuset_create(path, cp) - Create cpuset 'cp' at location 'path' 81f08c3bdfSopenharmony_ci * cpuset_delete(path) - Delete cpuset at location 'path' (if empty) 82f08c3bdfSopenharmony_ci * cpuset_query(cp, path) - Set cpuset cp to the cpuset at location 'path' 83f08c3bdfSopenharmony_ci * cpuset_modify(path, cp) - Change cpuset at location 'path' to values of 'cp' 84f08c3bdfSopenharmony_ci * cpuset_getcpusetpath(pid, buf, buflen) - Get cpuset path of pid into buf 85f08c3bdfSopenharmony_ci * cpuset_cpusetofpid(cp, pid) - Get cpuset 'cp' of pid 86f08c3bdfSopenharmony_ci * cpuset_mountpoint() - [optional] Cpuset filesystem mount point 87f08c3bdfSopenharmony_ci * cpuset_collides_exclusive - [optional] True if would collide exclusive 88f08c3bdfSopenharmony_ci * cpuset_nuke(path, unsigned int seconds) - [optional] Remove cpuset anyway possible 89f08c3bdfSopenharmony_ci * 90f08c3bdfSopenharmony_ci * ==== List tasks (pids) currently attached to a cpuset ==== 91f08c3bdfSopenharmony_ci * 92f08c3bdfSopenharmony_ci * cpuset_init_pidlist(path, recurseflag) - Return list pids in cpuset 'path' 93f08c3bdfSopenharmony_ci * cpuset_pidlist_length(pidlist) - Return number of elements in pidlist 94f08c3bdfSopenharmony_ci * cpuset_get_pidlist(pidlist, i) - Return i'th element of pidlist 95f08c3bdfSopenharmony_ci * cpuset_freepidlist(pidlist) - Free pidlist 96f08c3bdfSopenharmony_ci * 97f08c3bdfSopenharmony_ci * ==== Attach tasks to cpusets ==== 98f08c3bdfSopenharmony_ci * 99f08c3bdfSopenharmony_ci * cpuset_move(pid, path) - Move task (pid == 0 for current) to a cpuset 100f08c3bdfSopenharmony_ci * cpuset_move_all(pidlist, path) - Move all tasks in pidlist to a cpuset 101f08c3bdfSopenharmony_ci * cpuset_move_cpuset_tasks(fromrelpath, torelpath) - [optional] 102f08c3bdfSopenharmony_ci * Move all tasks in cpuset 'fromrelpath' to cpuset 'torelpath' 103f08c3bdfSopenharmony_ci * cpuset_migrate(pid, path) - [optional] Like cpuset_move - plus migrate memory 104f08c3bdfSopenharmony_ci * cpuset_migrate_all(pidlist, path) - [optional] cpuset_move_all plus migrate 105f08c3bdfSopenharmony_ci * cpuset_reattach(path) - Rebind cpus_allowed of each task in cpuset 'path' 106f08c3bdfSopenharmony_ci * 107f08c3bdfSopenharmony_ci * ==== Determine memory pressure ==== 108f08c3bdfSopenharmony_ci * 109f08c3bdfSopenharmony_ci * cpuset_open_memory_pressure(path) - [optional] Open handle to read memory_pressure 110f08c3bdfSopenharmony_ci * cpuset_read_memory_pressure(han) - [optional] Read cpuset current memory_pressure 111f08c3bdfSopenharmony_ci * cpuset_close_memory_pressure(han) - [optional] Close handle to read memory pressure 112f08c3bdfSopenharmony_ci * 113f08c3bdfSopenharmony_ci * ==== Map between relative and system-wide CPU and Memory Node numbers ==== 114f08c3bdfSopenharmony_ci * 115f08c3bdfSopenharmony_ci * cpuset_c_rel_to_sys_cpu(cp, cpu) - Map cpuset relative cpu to system wide 116f08c3bdfSopenharmony_ci * cpuset_c_sys_to_rel_cpu(cp, cpu) - Map system wide cpu to cpuset relative 117f08c3bdfSopenharmony_ci * cpuset_c_rel_to_sys_mem(cp, mem) - Map cpuset relative mem to system wide 118f08c3bdfSopenharmony_ci * cpuset_c_sys_to_rel_mem(cp, mem) - Map system wide mem to cpuset relative 119f08c3bdfSopenharmony_ci * cpuset_p_rel_to_sys_cpu(pid, cpu) - Map cpuset relative cpu to system wide 120f08c3bdfSopenharmony_ci * cpuset_p_sys_to_rel_cpu(pid, cpu) - Map system wide cpu to cpuset relative 121f08c3bdfSopenharmony_ci * cpuset_p_rel_to_sys_mem(pid, mem) - Map cpuset relative mem to system wide 122f08c3bdfSopenharmony_ci * cpuset_p_sys_to_rel_mem(pid, mem) - Map system wide mem to cpuset relative 123f08c3bdfSopenharmony_ci * 124f08c3bdfSopenharmony_ci * ==== Placement operations - for detecting cpuset migration ==== 125f08c3bdfSopenharmony_ci * 126f08c3bdfSopenharmony_ci * cpuset_get_placement(pid) - [optional] Return current placement of task pid 127f08c3bdfSopenharmony_ci * cpuset_equal_placement(plc1, plc2) - [optional] True if two placements equal 128f08c3bdfSopenharmony_ci * cpuset_free_placement(plc) - [optional] Free placement 129f08c3bdfSopenharmony_ci * 130f08c3bdfSopenharmony_ci * ==== Traverse a cpuset hierarchy ==== 131f08c3bdfSopenharmony_ci * 132f08c3bdfSopenharmony_ci * cpuset_fts_open(path) - [optional] Open cpuset hierarchy ==> cs_tree 133f08c3bdfSopenharmony_ci * cpuset_fts_read(cs_tree) - [optional] Next entry in tree ==> cs_entry 134f08c3bdfSopenharmony_ci * cpuset_fts_reverse(cs_tree) - [optional] Reverse order of entries in cs_tree 135f08c3bdfSopenharmony_ci * cpuset_fts_rewind(cs_tree) - [optional] Rewind cs_tree to beginning 136f08c3bdfSopenharmony_ci * cpuset_fts_get_path(cs_entry) - [optional] Get entry's cpuset path 137f08c3bdfSopenharmony_ci * cpuset_fts_get_stat(cs_entry) - [optional] Get entry's stat(2) pointer 138f08c3bdfSopenharmony_ci * cpuset_fts_get_cpuset(cs_entry) - [optional] Get entry's cpuset pointer 139f08c3bdfSopenharmony_ci * cpuset_fts_get_errno(cs_entry) - [optional] Get entry's errno 140f08c3bdfSopenharmony_ci * cpuset_fts_get_info(cs_entry) - [optional] Get operation causing error 141f08c3bdfSopenharmony_ci * cpuset_fts_close(cs_tree) - [optional] Close cpuset hierarchy 142f08c3bdfSopenharmony_ci * 143f08c3bdfSopenharmony_ci * ==== Bind to a CPU or Memory Node within the current cpuset ==== 144f08c3bdfSopenharmony_ci * 145f08c3bdfSopenharmony_ci * cpuset_cpubind(cpu) - Bind current task to cpu (uses sched_setaffinity(2)) 146f08c3bdfSopenharmony_ci * cpuset_latestcpu(pid) - Return most recent CPU on which task pid executed 147f08c3bdfSopenharmony_ci * cpuset_membind(mem) - Bind current task to memory (uses set_mempolicy(2)) 148f08c3bdfSopenharmony_ci * 149f08c3bdfSopenharmony_ci * ==== Export cpuset settings to, and import from, a regular file ==== 150f08c3bdfSopenharmony_ci * 151f08c3bdfSopenharmony_ci * cpuset_export(cp, file) - Export cpuset settings to a regular file 152f08c3bdfSopenharmony_ci * cpuset_import(cp, file) - Import cpuset settings from a regular file 153f08c3bdfSopenharmony_ci * 154f08c3bdfSopenharmony_ci * ==== Support calls to [optional] cpuset_* API routines ==== 155f08c3bdfSopenharmony_ci * 156f08c3bdfSopenharmony_ci * cpuset_function - Return pointer to a libcpuset.so function, or NULL 157f08c3bdfSopenharmony_ci * 158f08c3bdfSopenharmony_ci */ 159f08c3bdfSopenharmony_ci 160f08c3bdfSopenharmony_ci#include <sys/types.h> 161f08c3bdfSopenharmony_ci#include <sys/stat.h> 162f08c3bdfSopenharmony_ci#include <unistd.h> 163f08c3bdfSopenharmony_ci 164f08c3bdfSopenharmony_ci#ifndef _CPUSET_H 165f08c3bdfSopenharmony_ci#define _CPUSET_H 166f08c3bdfSopenharmony_ci 167f08c3bdfSopenharmony_ci#ifdef __cplusplus 168f08c3bdfSopenharmony_ciextern "C" { 169f08c3bdfSopenharmony_ci#endif 170f08c3bdfSopenharmony_ci 171f08c3bdfSopenharmony_ciint cpuset_version(void); 172f08c3bdfSopenharmony_ci 173f08c3bdfSopenharmony_ciint cpuset_pin(int relcpu); 174f08c3bdfSopenharmony_ciint cpuset_size(void); 175f08c3bdfSopenharmony_ciint cpuset_where(void); 176f08c3bdfSopenharmony_ciint cpuset_unpin(void); 177f08c3bdfSopenharmony_ci 178f08c3bdfSopenharmony_cistruct bitmask; 179f08c3bdfSopenharmony_cistruct cpuset; 180f08c3bdfSopenharmony_cistruct cpuset_pidlist; 181f08c3bdfSopenharmony_cistruct cpuset_placement; 182f08c3bdfSopenharmony_cistruct cpuset_fts_tree; 183f08c3bdfSopenharmony_cistruct cpuset_fts_entry; 184f08c3bdfSopenharmony_ci 185f08c3bdfSopenharmony_cistruct cpuset *cpuset_alloc(void); 186f08c3bdfSopenharmony_civoid cpuset_free(struct cpuset *cp); 187f08c3bdfSopenharmony_ci 188f08c3bdfSopenharmony_ciint cpuset_cpus_nbits(void); 189f08c3bdfSopenharmony_ciint cpuset_mems_nbits(void); 190f08c3bdfSopenharmony_ci 191f08c3bdfSopenharmony_ciint cpuset_setcpus(struct cpuset *cp, const struct bitmask *cpus); 192f08c3bdfSopenharmony_ciint cpuset_setmems(struct cpuset *cp, const struct bitmask *mems); 193f08c3bdfSopenharmony_ciint cpuset_set_iopt(struct cpuset *cp, const char *optionname, int value); 194f08c3bdfSopenharmony_ciint cpuset_set_sopt(struct cpuset *cp, const char *optionname, 195f08c3bdfSopenharmony_ci const char *value); 196f08c3bdfSopenharmony_ci 197f08c3bdfSopenharmony_ciint cpuset_open_memory_pressure(const char *cpusetpath); 198f08c3bdfSopenharmony_ciint cpuset_read_memory_pressure(int han); 199f08c3bdfSopenharmony_civoid cpuset_close_memory_pressure(int han); 200f08c3bdfSopenharmony_ci 201f08c3bdfSopenharmony_ciint cpuset_getcpus(const struct cpuset *cp, struct bitmask *cpus); 202f08c3bdfSopenharmony_ciint cpuset_getmems(const struct cpuset *cp, struct bitmask *mems); 203f08c3bdfSopenharmony_ciint cpuset_cpus_weight(const struct cpuset *cp); 204f08c3bdfSopenharmony_ciint cpuset_mems_weight(const struct cpuset *cp); 205f08c3bdfSopenharmony_ciint cpuset_get_iopt(const struct cpuset *cp, const char *optionname); 206f08c3bdfSopenharmony_ciconst char *cpuset_get_sopt(const struct cpuset *cp, const char *optionname); 207f08c3bdfSopenharmony_ci 208f08c3bdfSopenharmony_ciint cpuset_localcpus(const struct bitmask *mems, struct bitmask *cpus); 209f08c3bdfSopenharmony_ciint cpuset_localmems(const struct bitmask *cpus, struct bitmask *mems); 210f08c3bdfSopenharmony_ciunsigned int cpuset_cpumemdist(int cpu, int mem); 211f08c3bdfSopenharmony_ciint cpuset_cpu2node(int cpu); 212f08c3bdfSopenharmony_ciint cpuset_addr2node(void *addr); 213f08c3bdfSopenharmony_ci 214f08c3bdfSopenharmony_ciint cpuset_create(const char *cpusetpath, const struct cpuset *cp); 215f08c3bdfSopenharmony_ciint cpuset_delete(const char *cpusetpath); 216f08c3bdfSopenharmony_ciint cpuset_query(struct cpuset *cp, const char *cpusetpath); 217f08c3bdfSopenharmony_ciint cpuset_modify(const char *cpusetpath, const struct cpuset *cp); 218f08c3bdfSopenharmony_cichar *cpuset_getcpusetpath(pid_t pid, char *buf, size_t size); 219f08c3bdfSopenharmony_ciint cpuset_cpusetofpid(struct cpuset *cp, pid_t pid); 220f08c3bdfSopenharmony_ciconst char *cpuset_mountpoint(void); 221f08c3bdfSopenharmony_ciint cpuset_collides_exclusive(const char *cpusetpath, const struct cpuset *cp); 222f08c3bdfSopenharmony_ciint cpuset_nuke(const char *cpusetpath, unsigned int seconds); 223f08c3bdfSopenharmony_ci 224f08c3bdfSopenharmony_cistruct cpuset_pidlist *cpuset_init_pidlist(const char *cpusetpath, 225f08c3bdfSopenharmony_ci int recursiveflag); 226f08c3bdfSopenharmony_ciint cpuset_pidlist_length(const struct cpuset_pidlist *pl); 227f08c3bdfSopenharmony_cipid_t cpuset_get_pidlist(const struct cpuset_pidlist *pl, int i); 228f08c3bdfSopenharmony_civoid cpuset_freepidlist(struct cpuset_pidlist *pl); 229f08c3bdfSopenharmony_ci 230f08c3bdfSopenharmony_ciint cpuset_move(pid_t pid, const char *cpusetpath); 231f08c3bdfSopenharmony_ciint cpuset_move_all(struct cpuset_pidlist *pl, const char *cpusetpath); 232f08c3bdfSopenharmony_ciint cpuset_move_cpuset_tasks(const char *fromrelpath, const char *torelpath); 233f08c3bdfSopenharmony_ciint cpuset_migrate(pid_t pid, const char *cpusetpath); 234f08c3bdfSopenharmony_ciint cpuset_migrate_all(struct cpuset_pidlist *pl, const char *cpusetpath); 235f08c3bdfSopenharmony_ciint cpuset_reattach(const char *cpusetpath); 236f08c3bdfSopenharmony_ci 237f08c3bdfSopenharmony_ciint cpuset_c_rel_to_sys_cpu(const struct cpuset *cp, int cpu); 238f08c3bdfSopenharmony_ciint cpuset_c_sys_to_rel_cpu(const struct cpuset *cp, int cpu); 239f08c3bdfSopenharmony_ciint cpuset_c_rel_to_sys_mem(const struct cpuset *cp, int mem); 240f08c3bdfSopenharmony_ciint cpuset_c_sys_to_rel_mem(const struct cpuset *cp, int mem); 241f08c3bdfSopenharmony_ci 242f08c3bdfSopenharmony_ciint cpuset_p_rel_to_sys_cpu(pid_t pid, int cpu); 243f08c3bdfSopenharmony_ciint cpuset_p_sys_to_rel_cpu(pid_t pid, int cpu); 244f08c3bdfSopenharmony_ciint cpuset_p_rel_to_sys_mem(pid_t pid, int mem); 245f08c3bdfSopenharmony_ciint cpuset_p_sys_to_rel_mem(pid_t pid, int mem); 246f08c3bdfSopenharmony_ci 247f08c3bdfSopenharmony_cistruct cpuset_placement *cpuset_get_placement(pid_t pid); 248f08c3bdfSopenharmony_ciint cpuset_equal_placement(const struct cpuset_placement *plc1, 249f08c3bdfSopenharmony_ci const struct cpuset_placement *plc2); 250f08c3bdfSopenharmony_civoid cpuset_free_placement(struct cpuset_placement *plc); 251f08c3bdfSopenharmony_ci 252f08c3bdfSopenharmony_cistruct cpuset_fts_tree *cpuset_fts_open(const char *cpusetpath); 253f08c3bdfSopenharmony_ciconst struct cpuset_fts_entry *cpuset_fts_read( 254f08c3bdfSopenharmony_ci struct cpuset_fts_tree *cs_tree); 255f08c3bdfSopenharmony_civoid cpuset_fts_reverse(struct cpuset_fts_tree *cs_tree); 256f08c3bdfSopenharmony_civoid cpuset_fts_rewind(struct cpuset_fts_tree *cs_tree); 257f08c3bdfSopenharmony_ciconst char *cpuset_fts_get_path( 258f08c3bdfSopenharmony_ci const struct cpuset_fts_entry *cs_entry); 259f08c3bdfSopenharmony_ciconst struct stat *cpuset_fts_get_stat( 260f08c3bdfSopenharmony_ci const struct cpuset_fts_entry *cs_entry); 261f08c3bdfSopenharmony_ciconst struct cpuset *cpuset_fts_get_cpuset( 262f08c3bdfSopenharmony_ci const struct cpuset_fts_entry *cs_entry); 263f08c3bdfSopenharmony_ciint cpuset_fts_get_errno(const struct cpuset_fts_entry *cs_entry); 264f08c3bdfSopenharmony_ciint cpuset_fts_get_info(const struct cpuset_fts_entry *cs_entry); 265f08c3bdfSopenharmony_civoid cpuset_fts_close(struct cpuset_fts_tree *cs_tree); 266f08c3bdfSopenharmony_ci 267f08c3bdfSopenharmony_ciint cpuset_cpubind(int cpu); 268f08c3bdfSopenharmony_ciint cpuset_latestcpu(pid_t pid); 269f08c3bdfSopenharmony_ciint cpuset_membind(int mem); 270f08c3bdfSopenharmony_ci 271f08c3bdfSopenharmony_ciint cpuset_export(const struct cpuset *cp, char *buf, int buflen); 272f08c3bdfSopenharmony_ciint cpuset_import(struct cpuset *cp, const char *buf, int *elinenum, 273f08c3bdfSopenharmony_ci char *emsg, int elen); 274f08c3bdfSopenharmony_ci 275f08c3bdfSopenharmony_civoid *cpuset_function(const char * function_name); 276f08c3bdfSopenharmony_ci 277f08c3bdfSopenharmony_ci/* 278f08c3bdfSopenharmony_ci * cpuset_fts_entry.info values. 279f08c3bdfSopenharmony_ci * 280f08c3bdfSopenharmony_ci * Because the cpuset_fts_open() call collects all the information 281f08c3bdfSopenharmony_ci * at once from an entire cpuset subtree, a simple error return would 282f08c3bdfSopenharmony_ci * not provide sufficient information as to what failed, and on what 283f08c3bdfSopenharmony_ci * cpuset in the subtree. So, except for malloc(3) failures, errors 284f08c3bdfSopenharmony_ci * are captured in the list of entries. If an entry has one of the 285f08c3bdfSopenharmony_ci * following CPUSET_FTS_ERR_* values in the "info" field, then the "info" 286f08c3bdfSopenharmony_ci * field indicates which operation failed, the "err" field captures the 287f08c3bdfSopenharmony_ci * failing errno value for that operation, and the other entry fields 288f08c3bdfSopenharmony_ci * might not be valid. If an entry has the value "CPUSET_FTS_CPUSET" for its 289f08c3bdfSopenharmony_ci * "info" field, then the err field will have the value "0", and the 290f08c3bdfSopenharmony_ci * other fields will be contain valid information about that cpuset. 291f08c3bdfSopenharmony_ci * 292f08c3bdfSopenharmony_ci */ 293f08c3bdfSopenharmony_cienum { 294f08c3bdfSopenharmony_ci CPUSET_FTS_CPUSET = 0, /* valid cpuset */ 295f08c3bdfSopenharmony_ci CPUSET_FTS_ERR_DNR = 1, /* error - couldn't read directory */ 296f08c3bdfSopenharmony_ci CPUSET_FTS_ERR_STAT = 2, /* error - couldn't stat directory */ 297f08c3bdfSopenharmony_ci CPUSET_FTS_ERR_CPUSET = 3, /* error - cpuset_query() failed */ 298f08c3bdfSopenharmony_ci}; 299f08c3bdfSopenharmony_ci 300f08c3bdfSopenharmony_ci/* 301f08c3bdfSopenharmony_ci * If it necessary to maintain source code compatibility with earlier 302f08c3bdfSopenharmony_ci * versions of this header file lacking the above CPUSET_FTS_* values, 303f08c3bdfSopenharmony_ci * one can conditionally check that the C preprocessor symbol 304f08c3bdfSopenharmony_ci * CPUSET_FTS_INFO_VALUES_DEFINED symbol is not defined and provide 305f08c3bdfSopenharmony_ci * alternative coding for that case. 306f08c3bdfSopenharmony_ci */ 307f08c3bdfSopenharmony_ci#define CPUSET_FTS_INFO_VALUES_DEFINED 1 308f08c3bdfSopenharmony_ci 309f08c3bdfSopenharmony_ci#ifdef __cplusplus 310f08c3bdfSopenharmony_ci} 311f08c3bdfSopenharmony_ci#endif 312f08c3bdfSopenharmony_ci 313f08c3bdfSopenharmony_ci#endif 314