mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added getpagesize(2) with the new return type size_t.
This function is non-standard and size_t is better than int here.
This commit is contained in:
parent
809bedd32b
commit
ad200ffa91
4 changed files with 16 additions and 1 deletions
|
@ -176,6 +176,7 @@ int unlink(const char*);
|
|||
ssize_t write(int, const void*, size_t);
|
||||
|
||||
#ifdef SORTIX_EXTENSIONS
|
||||
size_t getpagesize(void);
|
||||
int memstat(size_t* memused, size_t* memtotal);
|
||||
int uptime(uintmax_t* usecssinceboot);
|
||||
int writeall(int fd, const void* buffer, size_t len);
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace Maxsi
|
|||
#ifndef SORTIX_KERNEL
|
||||
DEFN_SYSCALL2(int, SysMemStat, SYSCALL_MEMSTAT, size_t*, size_t*);
|
||||
DEFN_SYSCALL1(void*, SysSbrk, SYSCALL_SBRK, intptr_t);
|
||||
DEFN_SYSCALL0(size_t, SysGetPageSize, SYSCALL_GET_PAGE_SIZE);
|
||||
|
||||
extern "C" int memstat(size_t* memused, size_t* memtotal)
|
||||
{
|
||||
|
@ -46,6 +47,11 @@ namespace Maxsi
|
|||
{
|
||||
return SysSbrk(increment);
|
||||
}
|
||||
|
||||
extern "C" size_t getpagesize(void)
|
||||
{
|
||||
return SysGetPageSize();
|
||||
}
|
||||
#endif
|
||||
|
||||
DUAL_FUNCTION(void*, memcpy, Copy, (void* Dest, const void* Src, size_t Length))
|
||||
|
|
|
@ -732,6 +732,12 @@ namespace Sortix
|
|||
return (void*) newend;
|
||||
}
|
||||
|
||||
size_t SysGetPageSize()
|
||||
{
|
||||
// TODO: Query the virtual memory layer or look up in the process class.
|
||||
return 0x1000UL;
|
||||
}
|
||||
|
||||
void Process::Init()
|
||||
{
|
||||
Syscall::Register(SYSCALL_EXEC, (void*) SysExecVE);
|
||||
|
@ -742,6 +748,7 @@ namespace Sortix
|
|||
Syscall::Register(SYSCALL_WAIT, (void*) SysWait);
|
||||
Syscall::Register(SYSCALL_REGISTER_ERRNO, (void*) SysRegisterErrno);
|
||||
Syscall::Register(SYSCALL_SBRK, (void*) SysSbrk);
|
||||
Syscall::Register(SYSCALL_GET_PAGE_SIZE, (void*) SysGetPageSize);
|
||||
|
||||
nextpidtoallocate = 0;
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
#define SYSCALL_UPTIME 34
|
||||
#define SYSCALL_SBRK 35
|
||||
#define SYSCALL_SEEK 36
|
||||
#define SYSCALL_MAX_NUM 37 /* index of highest constant + 1 */
|
||||
#define SYSCALL_GET_PAGE_SIZE 37
|
||||
#define SYSCALL_MAX_NUM 38 /* index of highest constant + 1 */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue