Hi I am trying to create a counter that will just count the number of times the system call vfork() has been called in fork.c in the Linux kernel source. I’am following how total_forks is implemented. Total_forks is defined in sched.h. But I can’t find where it is initialized to zero.
Share
I’m guessing you are talking about the Linux kernel, and the variable declared in
sched.hand defined here. It’s a global variable (defined at file scope and notstatic) – these are implicitly initialized to zero. Try this in you own code: