mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Update sortix/kernelinfo.cpp to current coding conventions.
This commit is contained in:
parent
b399ece14b
commit
8975c75c61
1 changed files with 7 additions and 9 deletions
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <sortix/kernel/platform.h>
|
#include <sortix/kernel/platform.h>
|
||||||
#include <sortix/kernel/syscall.h>
|
#include <sortix/kernel/syscall.h>
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "kernelinfo.h"
|
#include "kernelinfo.h"
|
||||||
|
|
||||||
#ifndef VERSIONSTR
|
#ifndef VERSIONSTR
|
||||||
|
@ -45,23 +45,21 @@ const char* KernelInfo(const char* req)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t SysKernelInfo(const char* req, char* resp, size_t resplen)
|
static ssize_t sys_kernelinfo(const char* req, char* resp, size_t resplen)
|
||||||
{
|
{
|
||||||
const char* str = KernelInfo(req);
|
const char* str = KernelInfo(req);
|
||||||
if ( !str ) { errno = EINVAL; return -1; }
|
if ( !str )
|
||||||
|
return errno = EINVAL, -1;
|
||||||
size_t stringlen = strlen(str);
|
size_t stringlen = strlen(str);
|
||||||
if ( resplen < stringlen + 1 )
|
if ( resplen < stringlen + 1 )
|
||||||
{
|
return errno = ERANGE, (ssize_t) stringlen;
|
||||||
errno = ERANGE;
|
|
||||||
return (ssize_t) stringlen;
|
|
||||||
}
|
|
||||||
strcpy(resp, str);
|
strcpy(resp, str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
Syscall::Register(SYSCALL_KERNELINFO, (void*) SysKernelInfo);
|
Syscall::Register(SYSCALL_KERNELINFO, (void*) sys_kernelinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
Loading…
Reference in a new issue