Author: trasz
Date: Fri Dec 13 18:39:36 2019
New Revision: 355722
URL: https://svnweb.freebsd.org/changeset/base/355722

Log:
  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

Modified:
  head/sys/compat/linux/linux_misc.c
  head/sys/kern/kern_prot.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c  Fri Dec 13 18:35:48 2019        
(r355721)
+++ head/sys/compat/linux/linux_misc.c  Fri Dec 13 18:39:36 2019        
(r355722)
@@ -1599,14 +1599,11 @@ linux_getuid(struct thread *td, struct linux_getuid_ar
        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

Modified: head/sys/kern/kern_prot.c
==============================================================================
--- head/sys/kern/kern_prot.c   Fri Dec 13 18:35:48 2019        (r355721)
+++ head/sys/kern/kern_prot.c   Fri Dec 13 18:39:36 2019        (r355722)
@@ -190,14 +190,21 @@ struct getsid_args {
 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);

Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h  Fri Dec 13 18:35:48 2019        (r355721)
+++ head/sys/sys/syscallsubr.h  Fri Dec 13 18:39:36 2019        (r355722)
@@ -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,
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to