dd kern_getpriority(), make Linuxulator use it.
Reviewed by: kib, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22842
This commit is contained in:
parent
7a0ef283e6
commit
ca603bb1ee
@ -1613,12 +1613,9 @@ linux_nosys(struct thread *td, struct nosys_args *ignore)
|
||||
int
|
||||
linux_getpriority(struct thread *td, struct linux_getpriority_args *args)
|
||||
{
|
||||
struct getpriority_args bsd_args;
|
||||
int error;
|
||||
|
||||
bsd_args.which = args->which;
|
||||
bsd_args.who = args->who;
|
||||
error = sys_getpriority(td, &bsd_args);
|
||||
error = kern_getpriority(td, args->which, args->who);
|
||||
td->td_retval[0] = 20 - td->td_retval[0];
|
||||
return (error);
|
||||
}
|
||||
|
@ -91,6 +91,13 @@ struct getpriority_args {
|
||||
#endif
|
||||
int
|
||||
sys_getpriority(struct thread *td, struct getpriority_args *uap)
|
||||
{
|
||||
|
||||
return (kern_getpriority(td, uap->which, uap->who));
|
||||
}
|
||||
|
||||
int
|
||||
kern_getpriority(struct thread *td, int which, int who)
|
||||
{
|
||||
struct proc *p;
|
||||
struct pgrp *pg;
|
||||
@ -98,13 +105,13 @@ sys_getpriority(struct thread *td, struct getpriority_args *uap)
|
||||
|
||||
error = 0;
|
||||
low = PRIO_MAX + 1;
|
||||
switch (uap->which) {
|
||||
switch (which) {
|
||||
|
||||
case PRIO_PROCESS:
|
||||
if (uap->who == 0)
|
||||
if (who == 0)
|
||||
low = td->td_proc->p_nice;
|
||||
else {
|
||||
p = pfind(uap->who);
|
||||
p = pfind(who);
|
||||
if (p == NULL)
|
||||
break;
|
||||
if (p_cansee(td, p) == 0)
|
||||
@ -115,11 +122,11 @@ sys_getpriority(struct thread *td, struct getpriority_args *uap)
|
||||
|
||||
case PRIO_PGRP:
|
||||
sx_slock(&proctree_lock);
|
||||
if (uap->who == 0) {
|
||||
if (who == 0) {
|
||||
pg = td->td_proc->p_pgrp;
|
||||
PGRP_LOCK(pg);
|
||||
} else {
|
||||
pg = pgfind(uap->who);
|
||||
pg = pgfind(who);
|
||||
if (pg == NULL) {
|
||||
sx_sunlock(&proctree_lock);
|
||||
break;
|
||||
@ -139,14 +146,14 @@ sys_getpriority(struct thread *td, struct getpriority_args *uap)
|
||||
break;
|
||||
|
||||
case PRIO_USER:
|
||||
if (uap->who == 0)
|
||||
uap->who = td->td_ucred->cr_uid;
|
||||
if (who == 0)
|
||||
who = td->td_ucred->cr_uid;
|
||||
sx_slock(&allproc_lock);
|
||||
FOREACH_PROC_IN_SYSTEM(p) {
|
||||
PROC_LOCK(p);
|
||||
if (p->p_state == PRS_NORMAL &&
|
||||
p_cansee(td, p) == 0 &&
|
||||
p->p_ucred->cr_uid == uap->who) {
|
||||
p->p_ucred->cr_uid == who) {
|
||||
if (p->p_nice < low)
|
||||
low = p->p_nice;
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ int kern_getitimer(struct thread *, u_int, struct itimerval *);
|
||||
int kern_getppid(struct thread *);
|
||||
int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
|
||||
socklen_t *alen);
|
||||
int kern_getpriority(struct thread *td, int which, int who);
|
||||
int kern_getrusage(struct thread *td, int who, struct rusage *rup);
|
||||
int kern_getsid(struct thread *td, pid_t pid);
|
||||
int kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
|
||||
|
Loading…
x
Reference in New Issue
Block a user