FreeBSD Bugzilla – Attachment 215109 Details for
Bug 240043
audio/linux-c7-alsa: how to make it work?
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
fmod.stable.12.patch
fmod.stable.12.patch (text/plain), 6.01 KB, created by
Tijl Coosemans
on 2020-05-31 15:03:36 UTC
(
hide
)
Description:
fmod.stable.12.patch
Filename:
MIME Type:
Creator:
Tijl Coosemans
Created:
2020-05-31 15:03:36 UTC
Size:
6.01 KB
patch
obsolete
>Index: sys/compat/linux/linux_mib.c >=================================================================== >--- sys/compat/linux/linux_mib.c (revision 361661) >+++ sys/compat/linux/linux_mib.c (working copy) >@@ -62,6 +62,11 @@ static unsigned linux_osd_jail_slot; > > SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode"); > >+bool linux_map_sched_prio = true; >+SYSCTL_BOOL(_compat_linux, OID_AUTO, map_sched_prio, CTLFLAG_RDTUN, >+ &linux_map_sched_prio, 0, "Map scheduler priorities to Linux priorities " >+ "(not POSIX compliant)"); >+ > static int linux_set_osname(struct thread *td, char *osname); > static int linux_set_osrelease(struct thread *td, char *osrelease); > static int linux_set_oss_version(struct thread *td, int oss_version); >Index: sys/compat/linux/linux_mib.h >=================================================================== >--- sys/compat/linux/linux_mib.h (revision 361661) >+++ sys/compat/linux/linux_mib.h (working copy) >@@ -62,4 +62,6 @@ int linux_kernver(struct thread *td); > > #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) > >+extern bool linux_map_sched_prio; >+ > #endif /* _LINUX_MIB_H_ */ >Index: sys/compat/linux/linux_misc.c >=================================================================== >--- sys/compat/linux/linux_misc.c (revision 361661) >+++ sys/compat/linux/linux_misc.c (working copy) >@@ -1558,6 +1558,33 @@ linux_sched_setscheduler(struct thread *td, > if (error) > return (error); > >+ if (linux_map_sched_prio) { >+ switch (policy) { >+ case SCHED_OTHER: >+ if (sched_param.sched_priority != 0) >+ return (EINVAL); >+ >+ sched_param.sched_priority = >+ PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE; >+ break; >+ case SCHED_FIFO: >+ case SCHED_RR: >+ if (sched_param.sched_priority < 1 || >+ sched_param.sched_priority >= LINUX_MAX_RT_PRIO) >+ return (EINVAL); >+ >+ /* >+ * Map [1, LINUX_MAX_RT_PRIO - 1] to >+ * [0, RTP_PRIO_MAX - RTP_PRIO_MIN] (rounding down). >+ */ >+ sched_param.sched_priority = >+ (sched_param.sched_priority - 1) * >+ (RTP_PRIO_MAX - RTP_PRIO_MIN + 1) / >+ (LINUX_MAX_RT_PRIO - 1); >+ break; >+ } >+ } >+ > tdt = linux_tdfind(td, args->pid, -1); > if (tdt == NULL) > return (ESRCH); >@@ -1611,6 +1638,20 @@ linux_sched_get_priority_max(struct thread *td, > printf(ARGS(sched_get_priority_max, "%d"), args->policy); > #endif > >+ if (linux_map_sched_prio) { >+ switch (args->policy) { >+ case LINUX_SCHED_OTHER: >+ td->td_retval[0] = 0; >+ return (0); >+ case LINUX_SCHED_FIFO: >+ case LINUX_SCHED_RR: >+ td->td_retval[0] = LINUX_MAX_RT_PRIO - 1; >+ return (0); >+ default: >+ return (EINVAL); >+ } >+ } >+ > switch (args->policy) { > case LINUX_SCHED_OTHER: > bsd.policy = SCHED_OTHER; >@@ -1638,6 +1679,20 @@ linux_sched_get_priority_min(struct thread *td, > printf(ARGS(sched_get_priority_min, "%d"), args->policy); > #endif > >+ if (linux_map_sched_prio) { >+ switch (args->policy) { >+ case LINUX_SCHED_OTHER: >+ td->td_retval[0] = 0; >+ return (0); >+ case LINUX_SCHED_FIFO: >+ case LINUX_SCHED_RR: >+ td->td_retval[0] = 1; >+ return (0); >+ default: >+ return (EINVAL); >+ } >+ } >+ > switch (args->policy) { > case LINUX_SCHED_OTHER: > bsd.policy = SCHED_OTHER; >@@ -2095,7 +2150,7 @@ linux_sched_setparam(struct thread *td, > { > struct sched_param sched_param; > struct thread *tdt; >- int error; >+ int error, policy; > > #ifdef DEBUG > if (ldebug(sched_setparam)) >@@ -2110,8 +2165,41 @@ linux_sched_setparam(struct thread *td, > if (tdt == NULL) > return (ESRCH); > >+ if (linux_map_sched_prio) { >+ error = kern_sched_getscheduler(td, tdt, &policy); >+ if (error) >+ goto out; >+ >+ switch (policy) { >+ case SCHED_OTHER: >+ if (sched_param.sched_priority != 0) { >+ error = EINVAL; >+ goto out; >+ } >+ sched_param.sched_priority = >+ PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE; >+ break; >+ case SCHED_FIFO: >+ case SCHED_RR: >+ if (sched_param.sched_priority < 1 || >+ sched_param.sched_priority >= LINUX_MAX_RT_PRIO) { >+ error = EINVAL; >+ goto out; >+ } >+ /* >+ * Map [1, LINUX_MAX_RT_PRIO - 1] to >+ * [0, RTP_PRIO_MAX - RTP_PRIO_MIN] (rounding down). >+ */ >+ sched_param.sched_priority = >+ (sched_param.sched_priority - 1) * >+ (RTP_PRIO_MAX - RTP_PRIO_MIN + 1) / >+ (LINUX_MAX_RT_PRIO - 1); >+ break; >+ } >+ } >+ > error = kern_sched_setparam(td, tdt, &sched_param); >- PROC_UNLOCK(tdt->td_proc); >+out: PROC_UNLOCK(tdt->td_proc); > return (error); > } > >@@ -2121,7 +2209,7 @@ linux_sched_getparam(struct thread *td, > { > struct sched_param sched_param; > struct thread *tdt; >- int error; >+ int error, policy; > > #ifdef DEBUG > if (ldebug(sched_getparam)) >@@ -2133,10 +2221,38 @@ linux_sched_getparam(struct thread *td, > return (ESRCH); > > error = kern_sched_getparam(td, tdt, &sched_param); >- PROC_UNLOCK(tdt->td_proc); >- if (error == 0) >- error = copyout(&sched_param, uap->param, >- sizeof(sched_param)); >+ if (error) { >+ PROC_UNLOCK(tdt->td_proc); >+ return (error); >+ } >+ >+ if (linux_map_sched_prio) { >+ error = kern_sched_getscheduler(td, tdt, &policy); >+ PROC_UNLOCK(tdt->td_proc); >+ if (error) >+ return (error); >+ >+ switch (policy) { >+ case SCHED_OTHER: >+ sched_param.sched_priority = 0; >+ break; >+ case SCHED_FIFO: >+ case SCHED_RR: >+ /* >+ * Map [0, RTP_PRIO_MAX - RTP_PRIO_MIN] to >+ * [1, LINUX_MAX_RT_PRIO - 1] (rounding up). >+ */ >+ sched_param.sched_priority = >+ (sched_param.sched_priority * >+ (LINUX_MAX_RT_PRIO - 1) + >+ (RTP_PRIO_MAX - RTP_PRIO_MIN - 1)) / >+ (RTP_PRIO_MAX - RTP_PRIO_MIN) + 1; >+ break; >+ } >+ } else >+ PROC_UNLOCK(tdt->td_proc); >+ >+ error = copyout(&sched_param, uap->param, sizeof(sched_param)); > return (error); > } > >Index: sys/compat/linux/linux_misc.h >=================================================================== >--- sys/compat/linux/linux_misc.h (revision 361661) >+++ sys/compat/linux/linux_misc.h (working copy) >@@ -105,6 +105,8 @@ extern const char *linux_kplatform; > #define LINUX_SCHED_FIFO 1 > #define LINUX_SCHED_RR 2 > >+#define LINUX_MAX_RT_PRIO 100 >+ > struct l_new_utsname { > char sysname[LINUX_MAX_UTSNAME]; > char nodename[LINUX_MAX_UTSNAME];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240043
:
207391
|
207411
|
207416
| 215109