summaryrefslogtreecommitdiffstats
path: root/sw/z80/kernel/process.c
blob: b43fa1109060e48074df4fdd47f4c51e6eaf690b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "process.h"

static struct process proc_table[PID_COUNT_MAX];
static struct process *current_proc;

pid_t newpid(void)
{
    int i;
    static pid_t last_pid = 0;

    for (i = 0; i < PID_COUNT_MAX; i++, last_pid++) {
        if (last_pid == PID_COUNT_MAX) {
            last_pid = 0;
            continue;            
        }

        if (!proc_table[last_pid].running)
            break;
    }

    if (i >= PID_COUNT_MAX)
        return 0;

    return last_pid;
}

int fork(void)
{

}

int exec(char *path, char *args)
{
    
}

int spawn(char *path, char *args)
{
    
}