Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package numactl for openSUSE:Factory checked in at 2022-09-10 20:17:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/numactl (Old) and /work/SRC/openSUSE:Factory/.numactl.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "numactl" Sat Sep 10 20:17:05 2022 rev:69 rq:1002285 version:2.0.15.0.g01a39cb Changes: -------- --- /work/SRC/openSUSE:Factory/numactl/numactl.changes 2022-05-14 22:54:41.455180533 +0200 +++ /work/SRC/openSUSE:Factory/.numactl.new.2083/numactl.changes 2022-09-10 20:17:09.708808989 +0200 @@ -1,0 +2,16 @@ +Fri Sep 09 10:16:30 UTC 2022 - [email protected] + +- Update to version 2.0.15.0.g01a39cb: + * Create codeql.yml + * Create makefile.yml + * Fix crash when memhog uses local policy + * Fix memhog uses the wrong policy but still works properly + * Fix the example usage in the man manual. + * fix memory and file handle leaks + * Do not reuse variable names in subscopes and delete useless blank lines + * Delete unused header files + * Limit the scope of function + * avoid declaring a global variable + * Fix build error on riscv64 by linking libatomic + +------------------------------------------------------------------- Old: ---- numactl-2.0.14.39.g8b18345.obscpio New: ---- _servicedata numactl-2.0.15.0.g01a39cb.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ numactl.spec ++++++ --- /var/tmp/diff_new_pack.ylQarB/_old 2022-09-10 20:17:10.268810428 +0200 +++ /var/tmp/diff_new_pack.ylQarB/_new 2022-09-10 20:17:10.272810439 +0200 @@ -17,7 +17,7 @@ Name: numactl -Version: 2.0.14.39.g8b18345 +Version: 2.0.15.0.g01a39cb Release: 0 Summary: NUMA Policy Control License: GPL-2.0-only ++++++ _servicedata ++++++ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/numactl/numactl</param> <param name="changesrevision">01a39cb4edc0dd0f4151b7ad11e0c56d2e612a02</param></service></servicedata> (No newline at EOF) ++++++ numactl-2.0.14.39.g8b18345.obscpio -> numactl-2.0.15.0.g01a39cb.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/.github/workflows/codeql.yml new/numactl-2.0.15.0.g01a39cb/.github/workflows/codeql.yml --- old/numactl-2.0.14.39.g8b18345/.github/workflows/codeql.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/.github/workflows/codeql.yml 2022-09-07 23:43:06.000000000 +0200 @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '25 18 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ?????? Command-line programs to run using the OS shell. + # ???? See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/.github/workflows/makefile.yml new/numactl-2.0.15.0.g01a39cb/.github/workflows/makefile.yml --- old/numactl-2.0.14.39.g8b18345/.github/workflows/makefile.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/.github/workflows/makefile.yml 2022-09-07 23:43:06.000000000 +0200 @@ -0,0 +1,33 @@ +name: Makefile CI + +on: + push: + branches: [ "master", "action-1" ] + pull_request: + branches: [ "master", "action-1" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: configure + run: ./autogen.sh && ./configure + + - name: Install dependencies + run: make + + - name: Werror run + run: make clean ; CFLAGS="-O2 -Wall -Werror" make + + - name: clang run + run: make clean ; CFLAGS="-O2 -Wall -Werror" CC=clang make + + - name: Run check + run: make check + + - name: Run distcheck + run: make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/Makefile.am new/numactl-2.0.15.0.g01a39cb/Makefile.am --- old/numactl-2.0.14.39.g8b18345/Makefile.am 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/Makefile.am 2022-09-07 23:43:06.000000000 +0200 @@ -41,6 +41,9 @@ libnuma_la_SOURCES = libnuma.c syscall.c distance.c affinity.c affinity.h sysfs.c sysfs.h rtnetlink.c rtnetlink.h versions.ldscript libnuma_la_LDFLAGS = -version-info 1:0:0 -Wl,--version-script,$(srcdir)/versions.ldscript -Wl,-init,numa_init -Wl,-fini,numa_fini +if RISCV64 +libnuma_la_LDFLAGS += -latomic +endif check_PROGRAMS = \ test/distance \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/clearcache.c new/numactl-2.0.15.0.g01a39cb/clearcache.c --- old/numactl-2.0.14.39.g8b18345/clearcache.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/clearcache.c 2022-09-07 23:43:06.000000000 +0200 @@ -8,7 +8,7 @@ #include <stdlib.h> #include "clearcache.h" -unsigned cache_size(void) +static unsigned cache_size(void) { unsigned cs = 0; #ifdef _SC_LEVEL1_DCACHE_SIZE @@ -36,7 +36,7 @@ return cs; } -void fallback_clearcache(void) +static void fallback_clearcache(void) { static unsigned char *clearmem; unsigned cs = cache_size(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/configure.ac new/numactl-2.0.15.0.g01a39cb/configure.ac --- old/numactl-2.0.14.39.g8b18345/configure.ac 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/configure.ac 2022-09-07 23:43:06.000000000 +0200 @@ -17,14 +17,15 @@ # Override CFLAGS so that we can specify custom CFLAGS for numademo. AX_AM_OVERRIDE_VAR([CFLAGS]) -AX_TLS([:],[:]) +AX_TLS AX_CHECK_COMPILE_FLAG([-ftree-vectorize], [tree_vectorize="true"]) AM_CONDITIONAL([HAVE_TREE_VECTORIZE], [test x"${tree_vectorize}" = x"true"]) -AC_CONFIG_FILES([Makefile]) +AC_CANONICAL_TARGET +AM_CONDITIONAL([RISCV64], [test x"${target_cpu}" = x"riscv64"]) -AC_SEARCH_LIBS([__atomic_fetch_and_1], [atomic]) +AC_CONFIG_FILES([Makefile]) # GCC tries to be "helpful" and only issue a warning for unrecognized # attributes. So we compile the test with Werror, so that if the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/libnuma.c new/numactl-2.0.15.0.g01a39cb/libnuma.c --- old/numactl-2.0.14.39.g8b18345/libnuma.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/libnuma.c 2022-09-07 23:43:06.000000000 +0200 @@ -2061,6 +2061,7 @@ int conf_cpus = numa_num_configured_cpus(); char *end; struct bitmask *mask; + int i; mask = numa_allocate_cpumask(); @@ -2076,7 +2077,6 @@ } do { unsigned long arg; - int i; if (!strcmp(s,"all")) { copy_bitmask_to_bitmask(allowed_cpus_ptr, mask); @@ -2098,7 +2098,6 @@ if (*s == '-') { char *end2; unsigned long arg2; - int i; arg2 = get_nr(++s, &end2, allowed_cpus_ptr, relative); if (end2 == s) { numa_warn(W_cpuparse, "missing cpu argument %s\n", s); @@ -2120,7 +2119,6 @@ if (s[-1] != '\0') goto err; if (invert) { - int i; for (i = 0; i < conf_cpus; i++) { if (numa_bitmask_isbitset(mask, i)) numa_bitmask_clearbit(mask, i); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/memhog.c new/numactl-2.0.15.0.g01a39cb/memhog.c --- old/numactl-2.0.14.39.g8b18345/memhog.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/memhog.c 2022-09-07 23:43:06.000000000 +0200 @@ -35,9 +35,8 @@ #define MADV_NOHUGEPAGE 15 #endif -int repeat = 1; -void usage(void) +static void usage(void) { printf("memhog [-fFILE] [-rNUM] size[kmg] [policy [nodeset]]\n"); printf("-f mmap is backed by FILE\n"); @@ -49,7 +48,7 @@ long length; -void hog(void *map) +static void hog(void *map) { long i; for (i = 0; i < length; i += UNIT) { @@ -73,6 +72,7 @@ int i; int fd = -1; bool disable_hugepage = false; + int repeat = 1; nodes = numa_allocate_nodemask(); gnodes = numa_allocate_nodemask(); @@ -104,7 +104,10 @@ } else loose = 1; policy = parse_policy(av[2], av[3]); - if (policy != MPOL_DEFAULT) + if (policy == MPOL_MAX) + usage(); + + if (policy != MPOL_DEFAULT && policy != MPOL_LOCAL) nodes = numa_parse_nodestring(av[3]); if (!nodes) { printf ("<%s> is invalid\n", av[3]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/migratepages.c new/numactl-2.0.15.0.g01a39cb/migratepages.c --- old/numactl-2.0.14.39.g8b18345/migratepages.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/migratepages.c 2022-09-07 23:43:06.000000000 +0200 @@ -20,23 +20,19 @@ #define _GNU_SOURCE #include <getopt.h> -#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <stdarg.h> #include "numa.h" -#include "numaif.h" -#include "numaint.h" #include "util.h" -struct option opts[] = { +static struct option opts[] = { {"help", 0, 0, 'h' }, { 0 } }; -void usage(void) +static void usage(void) { fprintf(stderr, "usage: migratepages pid from-nodes to-nodes\n" @@ -46,7 +42,7 @@ exit(1); } -void checknuma(void) +static void checknuma(void) { static int numa = -1; if (numa < 0) { @@ -96,7 +92,6 @@ } rc = numa_migrate_pages(pid, fromnodes, tonodes); - if (rc < 0) { perror("migrate_pages"); return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/migspeed.c new/numactl-2.0.15.0.g01a39cb/migspeed.c --- old/numactl-2.0.14.39.g8b18345/migspeed.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/migspeed.c 2022-09-07 23:43:06.000000000 +0200 @@ -14,20 +14,12 @@ #include <unistd.h> #include "util.h" -char *memory; +static const char *optstr = "hvp:"; +static char *cmd; +static int verbose; +static unsigned long pages = 1000; -unsigned long pages = 1000; - -unsigned long pagesize; - -const char *optstr = "hvp:"; - -char *cmd; - -int verbose; -struct timespec start,end; - -void usage(void) +static void usage(void) { printf("usage %s [-p pages] [-h] [-v] from-nodes to-nodes\n", cmd); printf(" from and to nodes may specified in form N or N-N\n"); @@ -38,7 +30,7 @@ exit(1); } -void displaymap(void) +static void displaymap(void) { FILE *f = fopen("/proc/self/numa_maps","r"); @@ -56,7 +48,6 @@ if (!strstr(buffer, "bind")) continue ; printf("%s", buffer); - } fclose(f); } @@ -70,6 +61,9 @@ double duration, mbytes; struct bitmask *from; struct bitmask *to; + char *memory = NULL; + unsigned long pagesize; + struct timespec start,end; pagesize = getpagesize(); @@ -136,7 +130,6 @@ pages, pagesize); memory = memalign(pagesize, bytes); - if (!memory) { printf("Out of Memory\n"); exit(2); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/numactl.c new/numactl-2.0.15.0.g01a39cb/numactl.c --- old/numactl-2.0.14.39.g8b18345/numactl.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/numactl.c 2022-09-07 23:43:06.000000000 +0200 @@ -23,7 +23,6 @@ #include <unistd.h> #include <stdarg.h> #include <ctype.h> -#include <assert.h> #include "numa.h" #include "numaif.h" #include "numaint.h" @@ -35,7 +34,7 @@ int exitcode; -struct option opts[] = { +static struct option opts[] = { {"all", 0, 0, 'a'}, {"interleave", 1, 0, 'i' }, {"preferred", 1, 0, 'p' }, @@ -64,7 +63,7 @@ { 0 } }; -void usage(void) +static void usage(void) { fprintf(stderr, "usage: numactl [--all | -a] [--balancing | -b] [--interleave= | -i <nodes>]\n" @@ -100,7 +99,7 @@ exit(1); } -void usage_msg(char *msg, ...) +static void usage_msg(char *msg, ...) { va_list ap; va_start(ap,msg); @@ -111,7 +110,7 @@ va_end(ap); } -void show_physcpubind(void) +static void show_physcpubind(void) { int ncpus = numa_num_configured_cpus(); @@ -132,7 +131,7 @@ } } -void show(void) +static void show(void) { struct bitmask *membind, *interleave, *cpubind, *preferred; unsigned long cur; @@ -189,7 +188,7 @@ printmask("preferred", preferred); } -char *fmt_mem(unsigned long long mem, char *buf) +static char *fmt_mem(unsigned long long mem, char *buf) { if (mem == -1L) sprintf(buf, "<not available>"); @@ -230,7 +229,7 @@ } } -void print_node_cpus(int node) +static void print_node_cpus(int node) { int i, err; struct bitmask *cpus; @@ -245,7 +244,7 @@ putchar('\n'); } -void hardware(void) +static void hardware(void) { int i; int numnodes=0; @@ -309,7 +308,7 @@ print_distances(maxnode); } -void checkerror(char *s) +static void checkerror(char *s) { if (errno) { perror(s); @@ -317,7 +316,7 @@ } } -void checknuma(void) +static void checknuma(void) { static int numa = -1; if (numa < 0) { @@ -329,61 +328,56 @@ int set_policy = -1; -void setpolicy(int pol) +static inline void setpolicy(int pol) { if (set_policy != -1) usage_msg("Conflicting policies"); set_policy = pol; } -void nopolicy(void) +static inline void nopolicy(void) { if (set_policy >= 0) usage_msg("specify policy after --shm/--file"); } -int did_cpubind = 0; -int did_strict = 0; -int do_shm = 0; -int do_dump = 0; -int shmattached = 0; -int did_node_cpu_parse = 0; -int parse_all = 0; -int numa_balancing = 0; -char *shmoption; -void check_cpubind(int flag) +static int shmattached = 0; +static int did_node_cpu_parse = 0; +static char *shmoption; + +static inline void check_cpubind(int flag) { if (flag) usage_msg("cannot do --cpubind on shared memory\n"); } -void noshm(char *opt) +static inline void noshm(char *opt) { if (shmattached) usage_msg("%s must be before shared memory specification", opt); shmoption = opt; } -void dontshm(char *opt) +static inline void dontshm(char *opt) { if (shmoption) usage_msg("%s shm option is not allowed before %s", shmoption, opt); } -void needshm(char *opt) +static inline void needshm(char *opt) { if (!shmattached) usage_msg("%s must be after shared memory specification", opt); } -void check_all_parse(int flag) +static inline void check_all_parse(int flag) { if (did_node_cpu_parse) usage_msg("--all/-a option must be before all cpu/node specifications"); } -void get_short_opts(struct option *o, char *s) +static void get_short_opts(struct option *o, char *s) { *s++ = '+'; while (o->name) { @@ -397,7 +391,7 @@ *s = '\0'; } -void check_shmbeyond(char *msg) +static void check_shmbeyond(char *msg) { if (shmoffset >= shmlen) { fprintf(stderr, @@ -432,6 +426,12 @@ char *end; char shortopts[array_len(opts)*2 + 1]; struct bitmask *mask = NULL; + int did_cpubind = 0; + int did_strict = 0; + int do_shm = 0; + int do_dump = 0; + int parse_all = 0; + int numa_balancing = 0; get_short_opts(opts,shortopts); while ((c = getopt_long(ac, av, shortopts, opts, NULL)) != -1) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/numademo.c new/numactl-2.0.15.0.g01a39cb/numademo.c --- old/numactl-2.0.14.39.g8b18345/numademo.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/numademo.c 2022-09-07 23:43:06.000000000 +0200 @@ -38,9 +38,9 @@ #endif #define FRACT_NODES 8 #define FRACT_MASKS 32 -int fract_nodes; -int *node_to_use; -unsigned long msize; +static int fract_nodes; +static int *node_to_use; +static unsigned long msize; /* Should get this from cpuinfo, but on !x86 it's not there */ enum { @@ -57,11 +57,10 @@ PTRCHASE, } thistest; -char *delim = " "; -int force; -int regression_testing=0; +static char *delim = " "; +static int regression_testing=0; -char *testname[] = { +static char *testname[] = { "memset", "memcpy", "forward", @@ -76,7 +75,7 @@ NULL, }; -void output(char *title, char *result) +static void output(char *title, char *result) { if (!isspace(delim[0])) printf("%s%s%s\n", title,delim, result); @@ -85,7 +84,7 @@ } #ifdef HAVE_STREAM_LIB -void do_stream(char *name, unsigned char *mem) +static void do_stream(char *name, unsigned char *mem) { int i; char title[100], buf[100]; @@ -123,7 +122,7 @@ return a->val - b->val; } -void **ptrchase_init(unsigned char *mem) +static void **ptrchase_init(unsigned char *mem) { long i; union node *nodes = (union node *)mem; @@ -148,7 +147,7 @@ #define LOOPS 10 -void memtest(char *name, unsigned char *mem) +static void memtest(char *name, unsigned char *mem) { long k; struct timeval start, end, res; @@ -286,7 +285,7 @@ numa_free(mem, msize); } -int popcnt(unsigned long val) +static int popcnt(unsigned long val) { int i = 0, cnt = 0; while (val >> i) { @@ -297,12 +296,13 @@ return cnt; } -int max_node, numnodes; +static int numnodes; -int get_node_list(void) +static int get_node_list(void) { int a, got_nodes = 0; long long free_node_sizes; + int max_node; numnodes = numa_num_configured_nodes(); node_to_use = (int *)malloc(numnodes * sizeof(int)); @@ -316,7 +316,7 @@ return got_nodes; } -void test(enum test type) +static void test(enum test type) { unsigned long mask; int i, k; @@ -482,7 +482,7 @@ /* numa_run_on_node_mask is not tested */ } -void usage(void) +static void usage(void) { int i; printf("usage: numademo [-S] [-f] [-c] [-e] [-t] msize[kmg] {tests}\nNo tests means run all.\n"); @@ -499,6 +499,7 @@ { int simple_tests = 0; int nr_nodes; + int force = 0; while (av[1] && av[1][0] == '-') { ac--; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/numamon.c new/numactl-2.0.15.0.g01a39cb/numamon.c --- old/numactl-2.0.14.39.g8b18345/numamon.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/numamon.c 2022-09-07 23:43:06.000000000 +0200 @@ -63,9 +63,9 @@ char *cfilter; int verbose; -void usage(void); +static void usage(void); -void Vprintf(char *fmt, ...) +static void Vprintf(char *fmt, ...) { va_list ap; va_start(ap,fmt); @@ -74,7 +74,7 @@ va_end(ap); } -unsigned long long rdmsr(int cpu, unsigned long msr) +static unsigned long long rdmsr(int cpu, unsigned long msr) { unsigned long long val; if (pread(msrfd[cpu], &val, 8, msr) != 8) { @@ -84,7 +84,7 @@ return val; } -void wrmsr(int cpu, unsigned long msr, unsigned long long value) +static void wrmsr(int cpu, unsigned long msr, unsigned long long value) { if (pwrite(msrfd[cpu], &value, 8, msr) != 8) { fprintf(stderr, "wdmsr of %lx failed: %s\n", msr, strerror(errno)); @@ -92,7 +92,7 @@ } } -int cpufilter(int cpu) +static int cpufilter(int cpu) { long num; char *end; @@ -116,7 +116,7 @@ return 0; } -void checkcounter(int cpu, int clear) +static void checkcounter(int cpu, int clear) { int i; for (i = 1; i < 4; i++) { @@ -146,7 +146,7 @@ } } -void setup(int clear) +static void setup(int clear) { DIR *dir; struct dirent *d; @@ -182,7 +182,7 @@ } } -void printf_padded(int pad, char *fmt, ...) +static void printf_padded(int pad, char *fmt, ...) { char buf[pad + 1]; va_list ap; @@ -192,7 +192,7 @@ va_end(ap); } -void print_header(void) +static void print_header(void) { printf_padded(4, "CPU "); printf_padded(16, "LOCAL"); @@ -201,7 +201,7 @@ putchar('\n'); } -void print_cpu(int cpu) +static void print_cpu(int cpu) { int i; static unsigned long long lastval[4]; @@ -217,7 +217,7 @@ putchar('\n'); } -void dumpall(void) +static void dumpall(void) { int cnt = 0; int cpu; @@ -238,7 +238,7 @@ } } -void checkk8(void) +static void checkk8(void) { char *line = NULL; size_t size = 0; @@ -268,7 +268,7 @@ fclose(f); } -void usage(void) +static void usage(void) { fprintf(stderr, "usage: numamon [args] [delay]\n"); fprintf(stderr, " -f forcibly overwrite counters\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/numastat.c new/numactl-2.0.15.0.g01a39cb/numastat.c --- old/numactl-2.0.14.39.g8b18345/numastat.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/numastat.c 2022-09-07 23:43:06.000000000 +0200 @@ -34,7 +34,6 @@ #define __USE_MISC #include <ctype.h> #include <dirent.h> -#include <errno.h> #include <getopt.h> #include <stdint.h> #include <stdio.h> @@ -71,7 +70,7 @@ #define PROCESS_HUGE_INDEX 0 #define PROCESS_PRIVATE_INDEX 3 -meminfo_t process_meminfo[] = { +static meminfo_t process_meminfo[] = { { PROCESS_HUGE_INDEX, "huge", "Huge" }, { 1, "heap", "Heap" }, { 2, "stack", "Stack" }, @@ -80,7 +79,7 @@ #define PROCESS_MEMINFO_ROWS (sizeof(process_meminfo) / sizeof(process_meminfo[0])) -meminfo_t numastat_meminfo[] = { +static meminfo_t numastat_meminfo[] = { { 0, "numa_hit", "Numa_Hit" }, { 1, "numa_miss", "Numa_Miss" }, { 2, "numa_foreign", "Numa_Foreign" }, @@ -91,7 +90,7 @@ #define NUMASTAT_MEMINFO_ROWS (sizeof(numastat_meminfo) / sizeof(numastat_meminfo[0])) -meminfo_t system_meminfo[] = { +static meminfo_t system_meminfo[] = { { 0, "MemTotal", "MemTotal" }, { 1, "MemFree", "MemFree" }, { 2, "MemUsed", "MemUsed" }, @@ -139,19 +138,19 @@ // hash algorithms depend on having some unused buckets. #define HASH_TABLE_SIZE 151 -int hash_collisions = 0; +static int hash_collisions = 0; struct hash_entry { char *name; int index; } hash_table[HASH_TABLE_SIZE]; -void init_hash_table(void) +static void init_hash_table(void) { memset(hash_table, 0, sizeof(hash_table)); } -int hash_ix(char *s) +static int hash_ix(char *s) { unsigned int h = 17; while (*s) { @@ -161,7 +160,7 @@ return (h % HASH_TABLE_SIZE); } -int hash_lookup(char *s) +static int hash_lookup(char *s) { int ix = hash_ix(s); while (hash_table[ix].name) { // Assumes big table with blank entries @@ -176,7 +175,7 @@ return -1; } -int hash_insert(char *s, int i) +static int hash_insert(char *s, int i) { int ix = hash_ix(s); while (hash_table[ix].name) { // assumes no duplicate entries @@ -250,43 +249,43 @@ #define USUAL_GUTTER_WIDTH 1 -void set_row_flag(vtab_p table, int row, int flag) +static inline void set_row_flag(vtab_p table, int row, int flag) { table->row_flags[row] |= (uint8_t)flag; } -void set_col_flag(vtab_p table, int col, int flag) +static inline void set_col_flag(vtab_p table, int col, int flag) { table->col_flags[col] |= (uint8_t)flag; } -void clear_row_flag(vtab_p table, int row, int flag) +static inline void clear_row_flag(vtab_p table, int row, int flag) { table->row_flags[row] &= (uint8_t)~flag; } -void clear_col_flag(vtab_p table, int col, int flag) +static inline void clear_col_flag(vtab_p table, int col, int flag) { table->col_flags[col] &= (uint8_t)~flag; } -int test_row_flag(vtab_p table, int row, int flag) +static inline int test_row_flag(vtab_p table, int row, int flag) { return ((table->row_flags[row] & (uint8_t)flag) != 0); } -int test_col_flag(vtab_p table, int col, int flag) +static inline int test_col_flag(vtab_p table, int col, int flag) { return ((table->col_flags[col] & (uint8_t)flag) != 0); } -void set_col_justification(vtab_p table, int col, int justify) +static inline void set_col_justification(vtab_p table, int col, int justify) { table->col_flags[col] &= (uint8_t)~COL_JUSTIFY_MASK; table->col_flags[col] |= (uint8_t)(justify & COL_JUSTIFY_MASK); } -void set_col_width(vtab_p table, int col, uint8_t width) +static inline void set_col_width(vtab_p table, int col, uint8_t width) { if (width >= SMALL_BUF_SIZE) { width = SMALL_BUF_SIZE - 1; @@ -294,78 +293,78 @@ table->col_width[col] = width; } -void set_col_decimal_places(vtab_p table, int col, uint8_t places) +static inline void set_col_decimal_places(vtab_p table, int col, uint8_t places) { table->col_decimal_places[col] = places; } -void set_cell_flag(vtab_p table, int row, int col, int flag) +static inline void set_cell_flag(vtab_p table, int row, int col, int flag) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->flags |= (uint32_t)flag; } -void clear_cell_flag(vtab_p table, int row, int col, int flag) +static inline void clear_cell_flag(vtab_p table, int row, int col, int flag) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->flags &= (uint32_t)~flag; } -int test_cell_flag(vtab_p table, int row, int col, int flag) +static inline int test_cell_flag(vtab_p table, int row, int col, int flag) { cell_p c_ptr = GET_CELL_PTR(row, col); return ((c_ptr->flags & (uint32_t)flag) != 0); } -void string_assign(vtab_p table, int row, int col, char *s) +static inline void string_assign(vtab_p table, int row, int col, char *s) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->type = CELL_TYPE_STRING; c_ptr->s = s; } -void repchar_assign(vtab_p table, int row, int col, char c) +static inline void repchar_assign(vtab_p table, int row, int col, char c) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->type = CELL_TYPE_REPCHAR; c_ptr->c[0] = c; } -void double_assign(vtab_p table, int row, int col, double d) +static inline void double_assign(vtab_p table, int row, int col, double d) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->type = CELL_TYPE_DOUBLE; c_ptr->d = d; } -void long_assign(vtab_p table, int row, int col, int64_t l) +static inline void long_assign(vtab_p table, int row, int col, int64_t l) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->type = CELL_TYPE_LONG; c_ptr->l = l; } -void double_addto(vtab_p table, int row, int col, double d) +static inline void double_addto(vtab_p table, int row, int col, double d) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->type = CELL_TYPE_DOUBLE; c_ptr->d += d; } -void long_addto(vtab_p table, int row, int col, int64_t l) +static inline void long_addto(vtab_p table, int row, int col, int64_t l) { cell_p c_ptr = GET_CELL_PTR(row, col); c_ptr->type = CELL_TYPE_LONG; c_ptr->l += l; } -void clear_assign(vtab_p table, int row, int col) +static inline void clear_assign(vtab_p table, int row, int col) { cell_p c_ptr = GET_CELL_PTR(row, col); memset(c_ptr, 0, sizeof(cell_t)); } -void zero_table_data(vtab_p table, int type) +static void zero_table_data(vtab_p table, int type) { // Sets data area of table to zeros of specified type for (int row = table->header_rows; (row < ALL_TABLE_ROWS); row++) { @@ -377,7 +376,7 @@ } } -void sort_rows_descending_by_col(vtab_p table, int start_row, int stop_row, int col) +static void sort_rows_descending_by_col(vtab_p table, int start_row, int stop_row, int col) { // Rearrange row_ix_map[] indices so the rows will be in // descending order by the value in the specified column @@ -399,12 +398,7 @@ } } -void span(vtab_p table, int first_row, int first_col, int last_row, int last_col) -{ - // FIXME: implement row / col spannnig someday? -} - -void init_table(vtab_p table, int header_rows, int header_cols, int data_rows, int data_cols) +static void init_table(vtab_p table, int header_rows, int header_cols, int data_rows, int data_cols) { // init table sizes table->header_rows = header_rows; @@ -463,7 +457,7 @@ memset(table->col_decimal_places, 0, alloc_size); } -void free_cell(vtab_p table, int row, int col) +static void free_cell(vtab_p table, int row, int col) { cell_p c_ptr = GET_CELL_PTR(row, col); if ((c_ptr->type == CELL_TYPE_STRING) @@ -474,7 +468,7 @@ memset(c_ptr, 0, sizeof(cell_t)); } -void free_table(vtab_p table) +static void free_table(vtab_p table) { if (table->cell != NULL) { for (int row = 0; (row < ALL_TABLE_ROWS); row++) { @@ -501,7 +495,7 @@ } } -char *fmt_cell_data(cell_p c_ptr, int max_width, int decimal_places) +static char *fmt_cell_data(cell_p c_ptr, int max_width, int decimal_places) { // Returns pointer to a static buffer, expecting caller to // immediately use or copy the contents before calling again. @@ -536,7 +530,7 @@ return buf; } -void auto_set_col_width(vtab_p table, int col, int min_width, int max_width) +static void auto_set_col_width(vtab_p table, int col, int min_width, int max_width) { int width = min_width; for (int row = 0; (row < ALL_TABLE_ROWS); row++) { @@ -557,7 +551,7 @@ table->col_width[col] = (uint8_t)width; } -void display_justified_cell(cell_p c_ptr, int row_flags, int col_flags, int width, int decimal_places) +static void display_justified_cell(cell_p c_ptr, int row_flags, int col_flags, int width, int decimal_places) { char *p = fmt_cell_data(c_ptr, width, decimal_places); int l = strlen(p); @@ -585,7 +579,7 @@ printf("%s", buf); } -void display_table(vtab_p table, +static void display_table(vtab_p table, int screen_width, int show_unseen_rows, int show_unseen_cols, @@ -693,29 +687,29 @@ } } -int verbose = 0; -int num_pids = 0; -int num_nodes = 0; -int screen_width = 0; -int show_zero_data = 1; -int compress_display = 0; -int sort_table = 0; -int sort_table_node = -1; -int compatibility_mode = 0; -int pid_array_max_pids = 0; -int *pid_array = NULL; -char *prog_name = NULL; -double page_size_in_bytes = 0; -double huge_page_size_in_bytes = 0; +static int verbose = 0; +static int num_pids = 0; +static int num_nodes = 0; +static int screen_width = 0; +static int show_zero_data = 1; +static int compress_display = 0; +static int sort_table = 0; +static int sort_table_node = -1; +static int compatibility_mode = 0; +static int pid_array_max_pids = 0; +static int *pid_array = NULL; +static char *prog_name = NULL; +static double page_size_in_bytes = 0; +static double huge_page_size_in_bytes = 0; -void display_version_and_exit(void) +static void display_version_and_exit(void) { char *version_string = "20130723"; printf("%s version: %s: %s\n", prog_name, version_string, __DATE__); exit(EXIT_SUCCESS); } -void display_usage_and_exit(void) +static void display_usage_and_exit(void) { fprintf(stderr, "Usage: %s [-c] [-m] [-n] [-p <PID>|<pattern>] [-s[<node>]] [-v] [-V] [-z] [ <PID>|<pattern>... ]\n", prog_name); fprintf(stderr, "-c to minimize column widths\n"); @@ -729,7 +723,7 @@ exit(EXIT_FAILURE); } -int get_screen_width(void) +static int get_screen_width(void) { int width = 80; char *p = getenv("NUMASTAT_WIDTH"); @@ -762,7 +756,7 @@ return width; } -char *command_name_for_pid(int pid) +static char *command_name_for_pid(int pid) { // Get the PID command name field from /proc/PID/status file. Return // pointer to a static buffer, expecting caller to immediately copy result. @@ -791,7 +785,7 @@ return NULL; } -void show_info_from_system_file(char *file, meminfo_p meminfo, int meminfo_rows, int tok_offset) +static void show_info_from_system_file(char *file, meminfo_p meminfo, int meminfo_rows, int tok_offset) { // Setup and init table vtab_t table; @@ -904,7 +898,7 @@ free_table(&table); } -void show_numastat_info(void) +static void show_numastat_info(void) { if (!compatibility_mode) { printf("\nPer-node numastat info (in MBs):\n"); @@ -912,13 +906,13 @@ show_info_from_system_file("numastat", numastat_meminfo, NUMASTAT_MEMINFO_ROWS, 0); } -void show_system_info(void) +static void show_system_info(void) { printf("\nPer-node system memory usage (in MBs):\n"); show_info_from_system_file("meminfo", system_meminfo, SYSTEM_MEMINFO_ROWS, 2); } -void show_process_info(void) +static void show_process_info(void) { vtab_t table; int header_rows = 2; @@ -1115,7 +1109,7 @@ return 1; } -void init_node_ix_map_and_header(int compatibility_mode) +static void init_node_ix_map_and_header(void) { // Count directory names of the form: /sys/devices/system/node/node<N> struct dirent **namelist; @@ -1180,7 +1174,7 @@ } } -void free_node_ix_map_and_header(void) +static void free_node_ix_map_and_header(void) { if (node_ix_map != NULL) { free(node_ix_map); @@ -1195,9 +1189,9 @@ } } -double get_huge_page_size_in_bytes(void) +static double get_huge_page_size_in_bytes(void) { - double huge_page_size = 0;; + double huge_page_size = 0; FILE *fs = fopen("/proc/meminfo", "r"); if (!fs) { perror("Can't open /proc/meminfo"); @@ -1218,7 +1212,7 @@ return huge_page_size * KILOBYTE; } -int all_digits(char *p) +static int all_digits(char *p) { if (p == NULL) { return 0; @@ -1229,12 +1223,12 @@ return 1; } -int starts_with_digit(const struct dirent *dptr) +static int starts_with_digit(const struct dirent *dptr) { return (isdigit(dptr->d_name[0])); } -void add_pid_to_list(int pid) +static void add_pid_to_list(int pid) { if (num_pids < pid_array_max_pids) { pid_array[num_pids++] = pid; @@ -1260,7 +1254,7 @@ return *(int *)p1 - *(int *) p2; } -void sort_pids_and_remove_duplicates(void) +static void sort_pids_and_remove_duplicates(void) { if (num_pids > 1) { qsort(pid_array, num_pids, sizeof(int), ascending); @@ -1278,7 +1272,7 @@ } } -void add_pids_from_pattern_search(char *pattern) +static void add_pids_from_pattern_search(char *pattern) { // Search all /proc/<PID>/cmdline files and /proc/<PID>/status:Name fields // for matching patterns. Show the memory details for matching PIDs. @@ -1407,7 +1401,7 @@ // with the old numastat perl script (which is included at the end of this // file for reference) compatibility_mode = (argc == 1); - init_node_ix_map_and_header(compatibility_mode); // enumarate the NUMA nodes + init_node_ix_map_and_header(); // enumarate the NUMA nodes if (compatibility_mode) { show_numastat_info(); free_node_ix_map_and_header(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/shm.c new/numactl-2.0.15.0.g01a39cb/shm.c --- old/numactl-2.0.14.39.g8b18345/shm.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/shm.c 2022-09-07 23:43:06.000000000 +0200 @@ -44,21 +44,24 @@ int shmflags; static int shm_pagesize; -long huge_page_size(void) +static long huge_page_size(void) { size_t len = 0; + long huge_size = 0; char *line = NULL; FILE *f = fopen("/proc/meminfo", "r"); if (f != NULL) { while (getdelim(&line, &len, '\n', f) > 0) { int ps; - if (sscanf(line, "Hugepagesize: %d kB", &ps) == 1) - return ps * 1024; + if (sscanf(line, "Hugepagesize: %d kB", &ps) == 1) { + huge_size = ps * 1024; + break; + } } free(line); fclose(f); } - return getpagesize(); + return huge_size ? huge_size : getpagesize(); } static void check_region(char *opt) @@ -168,7 +171,6 @@ shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); if (shmptr == (char*)-1) err("shm mmap"); - } static void @@ -326,7 +328,6 @@ case MPOL_DEFAULT: break; - } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/stream_lib.c new/numactl-2.0.15.0.g01a39cb/stream_lib.c --- old/numactl-2.0.14.39.g8b18345/stream_lib.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/stream_lib.c 2022-09-07 23:43:06.000000000 +0200 @@ -1,7 +1,6 @@ #include <stdio.h> #include <math.h> #include <float.h> -#include <limits.h> #include <sys/time.h> #include <stdlib.h> #include "stream_lib.h" @@ -59,7 +58,7 @@ * */ -int checktick(void); +static int checktick(void); # define HLINE "-------------------------------------------------------------\n" @@ -198,13 +197,12 @@ if (res) res[j] = speed; - } } # define M 20 -int checktick(void) +static int checktick(void) { int i, minDelta, Delta; double t1, t2, timesfound[M]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/stream_main.c new/numactl-2.0.15.0.g01a39cb/stream_main.c --- old/numactl-2.0.14.39.g8b18345/stream_main.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/stream_main.c 2022-09-07 23:43:06.000000000 +0200 @@ -6,13 +6,11 @@ #include "util.h" #include "stream_lib.h" -void usage(void) +static void usage(void) { exit(1); } -char *policy = "default"; - /* Run STREAM with a numa policy */ int main(int ac, char **av) { @@ -22,8 +20,10 @@ int policy; policy = parse_policy(av[1], av[2]); + if (policy == MPOL_MAX) + usage(); - nodes = numa_allocate_nodemask(); + nodes = numa_allocate_nodemask(); if (av[1] && av[2]) nodes = numa_parse_nodestring(av[2]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/syscall.c new/numactl-2.0.15.0.g01a39cb/syscall.c --- old/numactl-2.0.14.39.g8b18345/syscall.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/syscall.c 2022-09-07 23:43:06.000000000 +0200 @@ -267,7 +267,6 @@ int numa_sched_getaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask) { return syscall(__NR_sched_getaffinity,pid,len,mask); - } SYMVER("numa_sched_getaffinity_v2", "numa_sched_getaffinity@@libnuma_1.2") @@ -277,7 +276,6 @@ return syscall(__NR_sched_getaffinity, pid, numa_bitmask_nbytes(mask), mask->maskp); /* sched_getaffinity returns sizeof(cpumask_t) */ - } make_internal_alias(numa_sched_getaffinity_v1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/test/migrate_pages.c new/numactl-2.0.15.0.g01a39cb/test/migrate_pages.c --- old/numactl-2.0.14.39.g8b18345/test/migrate_pages.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/test/migrate_pages.c 2022-09-07 23:43:06.000000000 +0200 @@ -92,8 +92,8 @@ numa_move_pages(0, page_count, addr, nodes, status, 0); printf("\nMigrating the current processes pages ...\n"); + rc = numa_migrate_pages(0, old_nodes, new_nodes); - if (rc < 0) { perror("numa_migrate_pages failed"); errors++; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/test/move_pages.c new/numactl-2.0.15.0.g01a39cb/test/move_pages.c --- old/numactl-2.0.14.39.g8b18345/test/move_pages.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/test/move_pages.c 2022-09-07 23:43:06.000000000 +0200 @@ -47,7 +47,6 @@ pagesize = getpagesize(); nr_nodes = get_node_list(); - if (nr_nodes < 2) { printf("A minimum of 2 nodes is required for this test.\n"); exit(77); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/test/node-parse.c new/numactl-2.0.15.0.g01a39cb/test/node-parse.c --- old/numactl-2.0.14.39.g8b18345/test/node-parse.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/test/node-parse.c 2022-09-07 23:43:06.000000000 +0200 @@ -3,12 +3,6 @@ #include "numa.h" #include "util.h" -/* For util.c. Fixme. */ -void usage(void) -{ - exit(1); -} - int main(int ac, char **av) { int err = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/test/prefered.c new/numactl-2.0.15.0.g01a39cb/test/prefered.c --- old/numactl-2.0.14.39.g8b18345/test/prefered.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/test/prefered.c 2022-09-07 23:43:06.000000000 +0200 @@ -12,10 +12,6 @@ extern void printmask(char *name, struct bitmask *mask); -void usage(void) -{ -} - int main(void) { int max = numa_max_node(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/test/tbitmap.c new/numactl-2.0.15.0.g01a39cb/test/tbitmap.c --- old/numactl-2.0.14.39.g8b18345/test/tbitmap.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/test/tbitmap.c 2022-09-07 23:43:06.000000000 +0200 @@ -9,12 +9,6 @@ #include "numa.h" #include "util.h" -/* For util.c. Fixme. */ -void usage(void) -{ - exit(1); -} - #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) #define test_bit(i,p) ((p)[(i) / BITS_PER_LONG] & (1UL << ((i)%BITS_PER_LONG))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/util.c new/numactl-2.0.15.0.g01a39cb/util.c --- old/numactl-2.0.14.39.g8b18345/util.c 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/util.c 2022-09-07 23:43:06.000000000 +0200 @@ -111,15 +111,21 @@ { int k; struct policy *p = NULL; + int found = 0; + if (!name) return MPOL_DEFAULT; + + while (*name == '-') name++; for (k = 0; policies[k].name; k++) { p = &policies[k]; - if (!strcmp(p->name, name)) + if (!strcmp(p->name, name)) { + found = 1; break; + } } - if (!p || !p->name || (!arg && !p->noarg)) - usage(); + if (!found || !p || !p->name || (!arg && !p->noarg)) + return MPOL_MAX; return p->policy; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.14.39.g8b18345/util.h new/numactl-2.0.15.0.g01a39cb/util.h --- old/numactl-2.0.14.39.g8b18345/util.h 2022-02-25 20:18:46.000000000 +0100 +++ new/numactl-2.0.15.0.g01a39cb/util.h 2022-09-07 23:43:06.000000000 +0200 @@ -6,9 +6,6 @@ extern void complain(char *fmt, ...); extern void nerror(char *fmt, ...); -/* defined in main module, but called by util.c */ -extern void usage(void); - extern long memsize(char *s); extern int parse_policy(char *name, char *arg); extern void print_policies(void); ++++++ numactl.obsinfo ++++++ --- /var/tmp/diff_new_pack.ylQarB/_old 2022-09-10 20:17:10.472810952 +0200 +++ /var/tmp/diff_new_pack.ylQarB/_new 2022-09-10 20:17:10.472810952 +0200 @@ -1,5 +1,5 @@ name: numactl -version: 2.0.14.39.g8b18345 -mtime: 1645816726 -commit: 8b18345065c39d6b1e498bf635b4c8668e2d8f4e +version: 2.0.15.0.g01a39cb +mtime: 1662586986 +commit: 01a39cb4edc0dd0f4151b7ad11e0c56d2e612a02
