* Towards support of taskset(1) within util-linux package
@ 2019-06-25 5:52 Mark Geisert
0 siblings, 0 replies; only message in thread
From: Mark Geisert @ 2019-06-25 5:52 UTC (permalink / raw)
To: cygwin-apps
Hi Yaakov,
I patched util-linux locally to build the 'taskset' tool so I could test
my implementation of the get- and set-affinity functions within Cygwin.
The implementation will be part of the upcoming Cygwin 3.1.0 release.
I'm not sure how to manipulate the build environment so I could supply a
'git send-mail' of a 'git format-patch' that would be usable to you.
I hope the following 'diff -u' outputs will be useful; but if you'd prefer
a different format just let me know.
Thank you for all your work on Cygwin!
..mark
cd /usr/src/util-linux-2.33.1-1.src
diff -u util-linux.cygport.safe util-linux.cygport
--- util-linux.cygport.safe 2019-03-05 12:07:51.000000000 -0800
+++ util-linux.cygport 2019-05-23 22:43:40.520885600 -0700
@@ -147,7 +147,6 @@
--enable-more
--enable-pg
--disable-setterm
- --disable-schedutils
--disable-wall
--disable-write
--disable-use-tty-group
cd util-linux-2.33.1-1.x86_64/src/util-linux-2.33.1/lib
diff -u cpuset.c.safe cpuset.c
--- cpuset.c.safe 2018-06-04 00:57:02.792445800 -0700
+++ cpuset.c 2019-06-21 01:36:44.078702800 -0700
@@ -60,7 +60,7 @@
*/
int get_max_number_of_cpus(void)
{
-#ifdef SYS_sched_getaffinity
+#if defined(SYS_sched_getaffinity) || defined(__CYGWIN__)
int n, cpus = 2048;
size_t setsize;
cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL);
@@ -71,8 +71,12 @@
for (;;) {
CPU_ZERO_S(setsize, set);
+#if defined(__CYGWIN__)
+ n = sched_getaffinity(0, setsize, set);
+#else
/* the library version does not return size of cpumask_t */
n = syscall(SYS_sched_getaffinity, 0, setsize, set);
+#endif
if (n < 0 && errno == EINVAL && cpus < 1024 * 1024) {
cpuset_free(set);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-25 5:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 5:52 Towards support of taskset(1) within util-linux package Mark Geisert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).