string: move header to standard location

Anything that implements POSIX should also be where POSIX defines
it to be, otherwise it would be pretty useless lol
This commit is contained in:
anna 2021-02-28 18:27:43 +01:00
parent a1d594f0bd
commit ec3b64d232
Signed by: fef
GPG key ID: EC22E476DC2D3D84
10 changed files with 47 additions and 16 deletions

View file

@ -7,11 +7,11 @@
#include <ardix/atomic.h>
#include <ardix/malloc.h>
#include <ardix/sched.h>
#include <ardix/string.h>
#include <ardix/types.h>
#include <errno.h>
#include <stddef.h>
#include <string.h>
extern uint32_t _sstack;
extern uint32_t _estack;
@ -84,6 +84,36 @@ void *sched_process_switch(void *curr_sp)
return _sched_current_task->sp;
}
struct task *sched_fork(struct task *parent)
{
pid_t pid;
struct task *child = malloc(sizeof(*child));
if (child == NULL)
goto err_alloc;
for (pid = 0; pid < CONFIG_SCHED_MAXTASK; pid++) {
if (_sched_tasktab[pid] == NULL)
break;
}
if (pid == CONFIG_SCHED_MAXTASK)
goto err_maxtask;
child->pid = pid;
list_init(&child->children);
list_insert(&parent->children, &child->siblings);
err_maxtask:
free(child);
err_alloc:
return NULL;
}
struct task *sched_current_task(void)
{
return _sched_current_task;
}
/*
* This file is part of Ardix.
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.