Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131490233
D34850.id105432.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34850.id105432.diff
View Options
Index: sys/compat/linux/linux_misc.c
===================================================================
--- sys/compat/linux/linux_misc.c
+++ sys/compat/linux/linux_misc.c
@@ -61,6 +61,7 @@
#include <sys/sched.h>
#include <sys/sdt.h>
#include <sys/signalvar.h>
+#include <sys/smp.h>
#include <sys/stat.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
@@ -2256,22 +2257,22 @@
linux_sched_getaffinity(struct thread *td,
struct linux_sched_getaffinity_args *args)
{
- int error;
struct thread *tdt;
-
- if (args->len < sizeof(cpuset_t))
- return (EINVAL);
+ int error;
+ id_t tid;
tdt = linux_tdfind(td, args->pid, -1);
if (tdt == NULL)
return (ESRCH);
-
+ tid = tdt->td_tid;
PROC_UNLOCK(tdt->td_proc);
error = kern_cpuset_getaffinity(td, CPU_LEVEL_WHICH, CPU_WHICH_TID,
- tdt->td_tid, sizeof(cpuset_t), (cpuset_t *)args->user_mask_ptr);
+ tid, args->len, (cpuset_t *)args->user_mask_ptr);
+ if (error == ERANGE)
+ error = EINVAL;
if (error == 0)
- td->td_retval[0] = sizeof(cpuset_t);
+ td->td_retval[0] = min(args->len, sizeof(cpuset_t));
return (error);
}
@@ -2284,18 +2285,21 @@
struct linux_sched_setaffinity_args *args)
{
struct thread *tdt;
-
- if (args->len < sizeof(cpuset_t))
- return (EINVAL);
+ int error;
+ id_t tid;
tdt = linux_tdfind(td, args->pid, -1);
if (tdt == NULL)
return (ESRCH);
-
+ tid = tdt->td_tid;
PROC_UNLOCK(tdt->td_proc);
- return (kern_cpuset_setaffinity(td, CPU_LEVEL_WHICH, CPU_WHICH_TID,
- tdt->td_tid, sizeof(cpuset_t), (cpuset_t *) args->user_mask_ptr));
+ error = kern_cpuset_setaffinity(td, CPU_LEVEL_WHICH, CPU_WHICH_TID,
+ tid, args->len, (cpuset_t *) args->user_mask_ptr);
+ if (error == EDEADLK)
+ error = EINVAL;
+
+ return (error);
}
struct linux_rlimit64 {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 9, 1:46 PM (21 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23497938
Default Alt Text
D34850.id105432.diff (1 KB)
Attached To
Mode
D34850: linux(4); Adopt affinity syscalls to the recent kernel changes.
Attached
Detach File
Event Timeline
Log In to Comment