Add basic getcpu(2) support to linuxulator. The purpose of this

syscall is to query the CPU number and the NUMA domain the calling
thread is currently running on.  The third argument is ignored.
It doesn't do anything regarding scheduling - it's literally
just a way to query the current state, without any guarantees
you won't get rescheduled an opcode later.

This unbreaks Java from CentOS 8
(java-11-openjdk-11.0.5.10-0.el8_0.x86_64).

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22972
This commit is contained in:
Edward Tomasz Napierala 2019-12-31 22:01:08 +00:00
parent 8c3fbf3c20
commit cc50333011
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356241
5 changed files with 16 additions and 8 deletions

View File

@ -102,8 +102,6 @@ DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
DUMMY(move_pages);
/* Linux 2.6.19: */
DUMMY(getcpu);
/* Linux 2.6.22: */
DUMMY(signalfd);
/* Linux 2.6.27: */

View File

@ -108,8 +108,6 @@ DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
DUMMY(move_pages);
/* Linux 2.6.19: */
DUMMY(getcpu);
/* Linux 2.6.22: */
DUMMY(signalfd);
/* Linux 2.6.27: */

View File

@ -104,8 +104,6 @@ DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
DUMMY(move_pages);
/* Linux 2.6.19: */
DUMMY(getcpu);
/* Linux 2.6.27: */
DUMMY(signalfd4);
DUMMY(inotify_init1);

View File

@ -2353,3 +2353,19 @@ linux_syslog(struct thread *td, struct linux_syslog_args *args)
td->td_retval[0] = dst - args->buf;
return (error);
}
int
linux_getcpu(struct thread *td, struct linux_getcpu_args *args)
{
int cpu, error, node;
cpu = td->td_oncpu; /* Make sure it doesn't change during copyout(9) */
error = 0;
node = 0; /* XXX: Fake NUMA node 0 for now */
if (args->cpu != NULL)
error = copyout(&cpu, args->cpu, sizeof(l_int));
if (args->node != NULL)
error = copyout(&node, args->node, sizeof(l_int));
return (error);
}

View File

@ -104,8 +104,6 @@ DUMMY(tee);
DUMMY(vmsplice);
/* Linux 2.6.18: */
DUMMY(move_pages);
/* Linux 2.6.19: */
DUMMY(getcpu);
/* Linux 2.6.22: */
DUMMY(signalfd);
/* Linux 2.6.27: */