PatchworkOS  1731ea3
A non-POSIX operating system.
Loading...
Searching...
No Matches
Box Daemon

Box Daemon. More...

Collaboration diagram for Box Daemon:

Detailed Description

Box Daemon.

The box daemon is responsible for spawning and managing boxes.

Spawning Boxes

To spawn a box a request should be sent to the "boxspawn" socket in the format:

[key=value ...] -- <box_name> [arg1 arg2 ...]
int64_t y
Definition main.c:153

Where the following values can be specified:

Note
The stdin, stdout, stderr and group values will only be used if the box is a foreground box, meanwhile the namespace will only be used if the box uses the inherit sandbox profile.
Todo:
Implement group and namespace specification for foreground boxes and the inherit profile.

The "boxspawn" socket will send a response in the format:

<background|foreground [key]|error [msg]>

On success, the response will either contain background if the box is a background box, or foreground followed by a key for the boxes /proc/[pid]/wait file if the box is a foreground box.

On failure, the response will contain error followed by an error message.

Todo:
Once filesystem servers are implemented the box deamon should use them instead of sockets.
Todo:
Add a system for specifying environment variables.

Modules

 Manifests.
 Box Manifest Files.
 

Data Structures

struct  box_spawn_t
 
struct  box_args_t
 

Macros

#define ARGV_MAX   512
 
#define BUFFER_MAX   0x1000
 

Functions

static uint64_t box_args_parse (box_args_t *args, uint64_t argc, const char **argv, box_spawn_t *ctx)
 
static void box_spawn (box_spawn_t *ctx)
 
int main (void)
 

Variables

char box_spawn_t::input [BUFFER_MAX]
 
char box_spawn_t::result [BUFFER_MAX]
 
const charbox_args_t::box
 
const char ** box_args_t::argv
 
uint64_t box_args_t::argc
 
fd_t box_args_t::stdio [3]
 
fd_t box_args_t::group
 

Macro Definition Documentation

◆ ARGV_MAX

#define ARGV_MAX   512

Definition at line 57 of file main.c.

◆ BUFFER_MAX

#define BUFFER_MAX   0x1000

Definition at line 58 of file main.c.

Function Documentation

◆ box_args_parse()

static uint64_t box_args_parse ( box_args_t args,
uint64_t  argc,
const char **  argv,
box_spawn_t ctx 
)
static

Definition at line 76 of file main.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ box_spawn()

static void box_spawn ( box_spawn_t ctx)
static

Definition at line 166 of file main.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( void  )
Todo:
Use nonblocking sockets to avoid hanging on accept or read, or just wait until we have filesystem servers and do that instead.

Definition at line 405 of file main.c.

Here is the call graph for this function:

Variable Documentation

◆ input

char box_spawn_t::input[BUFFER_MAX]

Definition at line 62 of file main.c.

◆ result

char box_spawn_t::result[BUFFER_MAX]

Definition at line 63 of file main.c.

◆ box

const char* box_args_t::box

Definition at line 68 of file main.c.

◆ argv

const char** box_args_t::argv

Definition at line 69 of file main.c.

◆ argc

uint64_t box_args_t::argc

Definition at line 70 of file main.c.

◆ stdio

fd_t box_args_t::stdio[3]

Definition at line 71 of file main.c.

◆ group

fd_t box_args_t::group

Definition at line 72 of file main.c.