aboutsummaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu-api.h
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2020-05-07 14:47:24 +0200
committerKarel Zak <kzak@redhat.com>2020-11-13 09:19:02 +0100
commit551f2b4dc9f33375a4fb95ec04654123d183a86c (patch)
treeab96f2c468be867455a5126bbeac813d9f6fd718 /sys-utils/lscpu-api.h
parentd34b7f1b8224066e380f978dbe3ab97d283fb108 (diff)
downloadutil-linux-551f2b4dc9f33375a4fb95ec04654123d183a86c.tar.gz
lscpu: add lscpu_read_cpulists()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/lscpu-api.h')
-rw-r--r--sys-utils/lscpu-api.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys-utils/lscpu-api.h b/sys-utils/lscpu-api.h
index ca4550c924..30b324cbea 100644
--- a/sys-utils/lscpu-api.h
+++ b/sys-utils/lscpu-api.h
@@ -86,7 +86,8 @@ struct lscpu_arch {
};
struct lscpu_cxt {
- const char *prefix; /* path to /sys and /proc snapshot or NULL */
+ int maxcpus; /* size in bits of kernel cpu mask */
+ const char *prefix; /* path to /sys and /proc snapshot or NULL */
struct path_cxt *syscpu; /* _PATH_SYS_CPU path handler */
struct path_cxt *procfs; /* /proc path handler */
@@ -97,6 +98,23 @@ struct lscpu_cxt {
size_t ncpus;
struct lscpu_cpu **cpus;
+ /*
+ * All maps are sequentially indexed (0..ncpuspos), the array index
+ * does not have match with cpuX number as presented by kernel. You
+ * have to use real_cpu_num() to get the real cpuX number.
+ *
+ * For example, the possible system CPUs are: 1,3,5, it means that
+ * ncpuspos=3, so all arrays are in range 0..3.
+ */
+ size_t ncpuspos; /* maximal possible CPUs */
+ int *idx2cpunum; /* mapping index to CPU num */
+
+ size_t npresents;
+ cpu_set_t *present; /* mask with present CPUs */
+
+ size_t nonlines; /* aka number of trhreads */
+ cpu_set_t *online; /* mask with online CPUs */
+
struct lscpu_arch *arch;
unsigned int noalive;
@@ -110,6 +128,7 @@ struct lscpu_cputype *lscpu_cputype_get_default(struct lscpu_cxt *cxt);
int lscpu_read_cpuinfo(struct lscpu_cxt *cxt);
int lscpu_read_architecture(struct lscpu_cxt *cxt);
+int lscpu_read_cpulists(struct lscpu_cxt *cxt);
struct lscpu_cpu *lscpu_new_cpu(void);
void lscpu_ref_cpu(struct lscpu_cpu *cpu);