#include #include struct process *process_get(pid_t pid) { extern struct process *proc_table; struct process *proc; // Check error if (pid <= 0) return (NULL); // Start atomic operation atomic_start(); // Proess table walk proc = proc_table; while (proc != NULL) { // Check target process if (proc->pid != pid) { proc = proc->next; continue; } // Check if the process is alive if (proc->status == PROC_DEAD) proc = NULL; // Stop atomic operations atomic_stop(); return (proc); } // Stop atomic operation atomic_stop(); return (NULL); }