apio
71e15e94af
Kernel: Add an errno.h header with definitions for each header, and return those, negated, from syscalls when there is an error. mmap() returns an invalid address with errno encoded, instead of returning a negated errno; this address is encoded as ffffffffffffffEE where EE is errno in hex. libc: make syscall() return -1 and set errno on error, instead of returning the raw return value of the system call. Also, add mmap() and munmap() wrappers in sys/mman.h :). userspace: make the memeater program show the value of errno when allocating memory fails. Things to improve: add perror() and strerror() to make the errno experience even better! >.<
22 lines
291 B
C
22 lines
291 B
C
#ifndef _SYS_MMAN_H
|
|
#define _SYS_MMAN_H
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef unsigned long off_t;
|
|
|
|
#define MAP_FAILED (void*)-1
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
void* mmap(void*, size_t, int, int, int, off_t);
|
|
int munmap(void* addr, size_t len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |