| 196 | } |
| 197 | |
| 198 | int |
| 199 | kern_getsid(struct thread *td, pid_t pid) |
| 200 | { |
| 201 | struct proc *p; |
| 202 | int error; |
| 203 | |
| 204 | if (pid == 0) { |
| 205 | p = td->td_proc; |
| 206 | PROC_LOCK(p); |
| 207 | } else { |
| 208 | p = pfind(pid); |
| 209 | if (p == NULL) |
| 210 | return (ESRCH); |
| 211 | error = p_cansee(td, p); |
| 212 | if (error) { |
| 213 | PROC_UNLOCK(p); |
| 214 | return (error); |
| 215 | } |
| 216 | } |
| 217 | td->td_retval[0] = p->p_session->s_sid; |
| 218 | PROC_UNLOCK(p); |
| 219 | return (0); |
| 220 | } |
| 221 | |
| 222 | #ifndef _SYS_SYSPROTO_H_ |
| 223 | struct getuid_args { |
no test coverage detected