Add kern_getsid() and use it in Linuxulator; no functional changes.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22647
This commit is contained in:
trasz 2019-12-13 18:39:36 +00:00
parent a3fcfb05ea
commit 787237cc3f
3 changed files with 11 additions and 6 deletions

View File

@ -1599,14 +1599,11 @@ linux_getuid(struct thread *td, struct linux_getuid_args *args)
return (0);
}
int
linux_getsid(struct thread *td, struct linux_getsid_args *args)
{
struct getsid_args bsd;
bsd.pid = args->pid;
return (sys_getsid(td, &bsd));
return (kern_getsid(td, args->pid));
}
int

View File

@ -189,15 +189,22 @@ struct getsid_args {
#endif
int
sys_getsid(struct thread *td, struct getsid_args *uap)
{
return (kern_getsid(td, uap->pid));
}
int
kern_getsid(struct thread *td, pid_t pid)
{
struct proc *p;
int error;
if (uap->pid == 0) {
if (pid == 0) {
p = td->td_proc;
PROC_LOCK(p);
} else {
p = pfind(uap->pid);
p = pfind(pid);
if (p == NULL)
return (ESRCH);
error = p_cansee(td, p);

View File

@ -140,6 +140,7 @@ int kern_getppid(struct thread *);
int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
socklen_t *alen);
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,
socklen_t *alen);
int kern_getsockopt(struct thread *td, int s, int level, int name,