Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
script3r
GitHub Repository: script3r/os161
Path: blob/master/kern/syscall/getpid.c
2093 views
1
#include <types.h>
2
#include <lib.h>
3
#include <proc.h>
4
#include <thread.h>
5
#include <current.h>
6
#include <syscall.h>
7
8
int
9
sys_getpid( int *retval ) {
10
KASSERT( curthread != NULL );
11
KASSERT( curthread->td_proc != NULL );
12
13
PROC_LOCK( curthread->td_proc );
14
*retval = curthread->td_proc->p_pid;
15
PROC_UNLOCK( curthread->td_proc );
16
17
return 0;
18
}
19
20
21