Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common Fix previous; specify lwpid for curl...



details:   https://anonhg.NetBSD.org/src/rev/a21b61e04917
branches:  trunk
changeset: 972037:a21b61e04917
user:      rin <rin%NetBSD.org@localhost>
date:      Thu May 14 08:26:29 2020 +0000

description:
Fix previous; specify lwpid for curlpw in the case of pid == 0.

For linux_sys_sched_setaffinity, pid == 0 means the current thread.
On the other hand, for our native sys_sched_setaffinity, lid == 0
means all lwp's that belong to the process.

diffstat:

 sys/compat/linux/common/linux_sched.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r e37293ccc81c -r a21b61e04917 sys/compat/linux/common/linux_sched.c
--- a/sys/compat/linux/common/linux_sched.c     Thu May 14 07:59:03 2020 +0000
+++ b/sys/compat/linux/common/linux_sched.c     Thu May 14 08:26:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_sched.c,v 1.76 2020/04/29 01:55:18 thorpej Exp $ */
+/*     $NetBSD: linux_sched.c,v 1.77 2020/05/14 08:26:29 rin Exp $     */
 
 /*-
  * Copyright (c) 1999, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.76 2020/04/29 01:55:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.77 2020/05/14 08:26:29 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -671,12 +671,14 @@
        struct sys__sched_setaffinity_args ssa;
        size_t size;
        pid_t pid;
+       lwpid_t lid;
 
        size = LINUX_CPU_MASK_SIZE;
        if (SCARG(uap, len) < size)
                return EINVAL;
 
-       if (SCARG(uap, pid) != 0) {
+       lid = SCARG(uap, pid);
+       if (lid != 0) {
                /* Get the canonical PID for the process. */
                mutex_enter(proc_lock);
                struct proc *p = proc_find_lwpid(SCARG(uap, pid));
@@ -687,11 +689,12 @@
                pid = p->p_pid;
                mutex_exit(proc_lock);
        } else {
-               pid = 0;
+               pid = curproc->p_pid;
+               lid = curlwp->l_lid;
        }
 
        SCARG(&ssa, pid) = pid;
-       SCARG(&ssa, lid) = SCARG(uap, pid);
+       SCARG(&ssa, lid) = lid;
        SCARG(&ssa, size) = size;
        SCARG(&ssa, cpuset) = (cpuset_t *)SCARG(uap, mask);
 



Home | Main Index | Thread Index | Old Index