processctl() PCTL_SPAWN cmd, scheduler embryo state, redirected pipes
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include <system/system.h>
|
||||
#include <sysdefs/ioctl.h>
|
||||
#include <sysdefs/ipcpipe.h>
|
||||
#include <sysdefs/processctl.h>
|
||||
#include <uprintf.h>
|
||||
#include <ansiq/all.h>
|
||||
|
||||
@ -29,6 +30,11 @@ void main(void) {
|
||||
|
||||
uprintf("Hello world using uprintf\n");
|
||||
|
||||
int32_t tb = processctl(-1, PCTL_SPAWN, (uint64_t)"base:/bin/tb");
|
||||
ipcpipe(tb, IPCPIPE_OUT, IPCPIPE_REPLACE, (uint8_t *)(uint64_t)processctl(-1, PCTL_GETPID, 0), IPCPIPE_OUT);
|
||||
processctl(tb, PCTL_RUN, 0);
|
||||
while(processctl(tb, PCTL_POLLSTATE, 0) != 2);
|
||||
|
||||
if (ipcpipe(IPCPIPE_SELFPID, 10, IPCPIPE_MAKE, NULL, 0) < 0) {
|
||||
uprintf("failed to create 10th pipe\n");
|
||||
}
|
||||
|
2
user/tb/.gitignore
vendored
Normal file
2
user/tb/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.o
|
||||
tb
|
24
user/tb/Makefile
Normal file
24
user/tb/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
include $(ROOT)/mk/grabsrc.mk
|
||||
include ../Makefile.inc
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
TARGET := tb
|
||||
|
||||
LDFLAGS += -L$(ROOT)/ulib -l:libulib.a
|
||||
|
||||
SRCFILES := $(call GRABSRC, .)
|
||||
CFILES := $(call GET_CFILES, $(SRCFILES))
|
||||
OBJ := $(call GET_OBJ, $(SRCFILES))
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
$(LD) $^ $(LDFLAGS) -o $@
|
||||
echo $$(realpath $(TARGET)) >> $(FILES)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET)
|
5
user/tb/main.c
Normal file
5
user/tb/main.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <uprintf.h>
|
||||
|
||||
void main(void) {
|
||||
uprintf("Hello from tb!\n");
|
||||
}
|
Reference in New Issue
Block a user