Move e_pid and e_pgid to libprocess, Add get_self_pid () syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m13s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m13s
This commit is contained in:
22
libprocess/process_self.c
Normal file
22
libprocess/process_self.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <process_self.h>
|
||||
#include <system.h>
|
||||
|
||||
static int e_pid;
|
||||
static int e_pgid;
|
||||
static int pid;
|
||||
static int pgid;
|
||||
|
||||
void libprocess_self_init (void) {
|
||||
e_pid = get_exec_pid ();
|
||||
e_pgid = get_procgroup (e_pid);
|
||||
pid = get_self_pid ();
|
||||
pgid = get_procgroup (pid);
|
||||
}
|
||||
|
||||
int process_get_exec_pid (void) { return e_pid; }
|
||||
|
||||
int process_get_exec_pgid (void) { return e_pgid; }
|
||||
|
||||
int process_get_pid (void) { return pid; }
|
||||
|
||||
int process_get_pgid (void) { return pgid; }
|
||||
14
libprocess/process_self.h
Normal file
14
libprocess/process_self.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _LIBPROCESS_PROCESS_SELF_H
|
||||
#define _LIBPROCESS_PROCESS_SELF_H
|
||||
|
||||
void libprocess_self_init (void);
|
||||
|
||||
int process_get_exec_pid (void);
|
||||
|
||||
int process_get_exec_pgid (void);
|
||||
|
||||
int process_get_pid (void);
|
||||
|
||||
int process_get_pgid (void);
|
||||
|
||||
#endif // _LIBPROCESS_PROCESS_SELF_H
|
||||
@@ -1,5 +1,7 @@
|
||||
include $(platform)/src.mk
|
||||
|
||||
c += process.c
|
||||
c += process.c \
|
||||
process_self.c
|
||||
|
||||
o += process.o
|
||||
o += process.o \
|
||||
process_self.o
|
||||
|
||||
Reference in New Issue
Block a user