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

@ -6,9 +6,10 @@
#include <arch/at91sam3x8e/interrupt.h> #include <arch/at91sam3x8e/interrupt.h>
#include <ardix/atomic.h> #include <ardix/atomic.h>
#include <ardix/string.h>
#include <ardix/sched.h> #include <ardix/sched.h>
#include <string.h>
extern struct task *_sched_current_task; extern struct task *_sched_current_task;
void irq_sys_tick(void) void irq_sys_tick(void)

View file

@ -7,7 +7,6 @@
#include <ardix/malloc.h> #include <ardix/malloc.h>
#include <ardix/ringbuf.h> #include <ardix/ringbuf.h>
#include <ardix/serial.h> #include <ardix/serial.h>
#include <ardix/string.h>
#include <ardix/types.h> #include <ardix/types.h>
#include <arch/at91sam3x8e/hardware.h> #include <arch/at91sam3x8e/hardware.h>
@ -16,6 +15,7 @@
#include <errno.h> #include <errno.h>
#include <stddef.h> #include <stddef.h>
#include <string.h>
struct arch_serial_device arch_serial_default_device = { struct arch_serial_device arch_serial_default_device = {
.tx_current = NULL, .tx_current = NULL,

View file

@ -5,10 +5,10 @@
#include <arch/at91sam3x8e/interrupt.h> #include <arch/at91sam3x8e/interrupt.h>
#include <ardix/malloc.h> #include <ardix/malloc.h>
#include <ardix/string.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include <toolchain.h> #include <toolchain.h>
/* from flash.ld */ /* from flash.ld */

View file

@ -1,11 +1,12 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
/* See the end of this file for copyright, license, and warranty information. */ /* See the end of this file for copyright, license, and warranty information. */
#include <stddef.h>
#include <stdint.h>
#include <arch/at91sam3x8e/interrupt.h> #include <arch/at91sam3x8e/interrupt.h>
#include <arch/hardware.h> #include <arch/hardware.h>
#include <ardix/string.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <toolchain.h> #include <toolchain.h>
/* /*

View file

@ -1,16 +1,15 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
/* See the end of this file for copyright, license, and warranty information. */ /* See the end of this file for copyright, license, and warranty information. */
#include <ardix/printk.h>
#include <ardix/serial.h>
#include <errno.h> #include <errno.h>
/* Using GCC's stdarg.h is recommended even with -nodefaultlibs and -fno-builtin */ /* Using GCC's stdarg.h is recommended even with -nodefaultlibs and -fno-builtin */
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include <ardix/printk.h>
#include <ardix/serial.h>
#include <ardix/string.h>
#include <toolchain.h> #include <toolchain.h>
/* /*

View file

@ -7,11 +7,11 @@
#include <ardix/atomic.h> #include <ardix/atomic.h>
#include <ardix/malloc.h> #include <ardix/malloc.h>
#include <ardix/sched.h> #include <ardix/sched.h>
#include <ardix/string.h>
#include <ardix/types.h> #include <ardix/types.h>
#include <errno.h> #include <errno.h>
#include <stddef.h> #include <stddef.h>
#include <string.h>
extern uint32_t _sstack; extern uint32_t _sstack;
extern uint32_t _estack; extern uint32_t _estack;
@ -84,6 +84,36 @@ void *sched_process_switch(void *curr_sp)
return _sched_current_task->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. * This file is part of Ardix.
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>. * Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.

View file

@ -4,7 +4,7 @@
#include <ardix/types.h> #include <ardix/types.h>
#include <ardix/userspace.h> #include <ardix/userspace.h>
#include <ardix/string.h> #include <string.h>
#include <toolchain.h> #include <toolchain.h>
/* /*

View file

@ -4,9 +4,9 @@
#include <ardix/atomic.h> #include <ardix/atomic.h>
#include <ardix/list.h> #include <ardix/list.h>
#include <ardix/malloc.h> #include <ardix/malloc.h>
#include <ardix/string.h>
#include <ardix/types.h> #include <ardix/types.h>
#include <string.h>
#include <toolchain.h> #include <toolchain.h>
/* /*

View file

@ -1,11 +1,11 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */ /* SPDX-License-Identifier: GPL-3.0-or-later */
/* See the end of this file for copyright, license, and warranty information. */ /* See the end of this file for copyright, license, and warranty information. */
#include <ardix/string.h>
#include <ardix/types.h> #include <ardix/types.h>
#include <toolchain.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h>
#include <toolchain.h>
#ifndef __HAVE_ASM_MEMCMP #ifndef __HAVE_ASM_MEMCMP
int memcmp(const void *s1, const void *s2, size_t n) int memcmp(const void *s1, const void *s2, size_t n)