summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-10-01 16:35:08 -0700
committerVito Caputo <vcaputo@pengaru.com>2021-10-01 16:35:08 -0700
commitb686b405c6a22b26e9b8082c92ed91513608bea3 (patch)
tree0000f671501863a8ee9b536ba869221d0f6710f9 /src/util.c
parentd1da5500261e96efe0ede06fbebb32f0e191f3c1 (diff)
*: librototiller->libtil
Largely mechanical rename of librototiller -> libtil, but introducing a til_ prefix to all librototiller (now libtil) functions and types where a rototiller prefix was absent. This is just a step towards a more libized librototiller, and til is just a nicer to type/read prefix than rototiller_.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/util.c b/src/util.c
deleted file mode 100644
index 500ac75..0000000
--- a/src/util.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef __WIN32__
-#include <windows.h>
-#endif
-
-#include "util.h"
-
-#define SYSFS_CPU "/sys/devices/system/cpu/cpu"
-#define MAXCPUS 1024
-
-unsigned get_ncpus(void)
-{
-#ifdef __WIN32__
- SYSTEM_INFO sysinfo;
-
- GetSystemInfo(&sysinfo);
-
- return sysinfo.dwNumberOfProcessors;
-#else
- char path[cstrlen(SYSFS_CPU "1024") + 1];
- unsigned n;
-
- for (n = 0; n < MAXCPUS; n++) {
- snprintf(path, sizeof(path), "%s%u", SYSFS_CPU, n);
- if (access(path, F_OK) == -1)
- break;
- }
-
- return n == 0 ? 1 : n;
-#endif
-}
© All Rights Reserved