tb %PID builtin command

This commit is contained in:
2025-09-29 21:37:48 +02:00
parent 4e8afae5fb
commit 46e52c8d48
4 changed files with 12 additions and 2 deletions

View File

@ -22,4 +22,6 @@ typedef struct {
size_t usemem; size_t usemem;
} ProcStat; } ProcStat;
typedef uint64_t PID_t;
#endif // SHARE_HDRS_PROCESSCTL_H_ #endif // SHARE_HDRS_PROCESSCTL_H_

View File

@ -5,7 +5,7 @@
#include "runtime.h" #include "runtime.h"
#include "macros.h" #include "macros.h"
extern uint64_t PID; extern PID_t PID;
static InterpResult RES; static InterpResult RES;

View File

@ -6,7 +6,7 @@
#define LINEBUF_MAX 1024 #define LINEBUF_MAX 1024
uint64_t PID; PID_t PID;
struct { struct {
char *modestr; char *modestr;

View File

@ -4,6 +4,8 @@
#include "runtime.h" #include "runtime.h"
#include "interp.h" #include "interp.h"
extern PID_t PID;
RtCmd *RTCMDS = NULL; RtCmd *RTCMDS = NULL;
RtAlias *RTALIASES = NULL; RtAlias *RTALIASES = NULL;
@ -45,7 +47,13 @@ bool rt_mkalias(Token *tks) {
return true; return true;
} }
bool rt_PID(Token *tks) {
uprintf("%lu\n", PID);
return true;
}
void rt_init(void) { void rt_init(void) {
RTCMD("%print", &rt_print); RTCMD("%print", &rt_print);
RTCMD("%mkalias", &rt_mkalias); RTCMD("%mkalias", &rt_mkalias);
RTCMD("%PID", &rt_PID);
} }