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/syscall.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "kernelinfo.h"
|
||||
|
||||
#ifndef VERSIONSTR
|
||||
|
@ -45,23 +45,21 @@ const char* KernelInfo(const char* req)
|
|||
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);
|
||||
if ( !str ) { errno = EINVAL; return -1; }
|
||||
if ( !str )
|
||||
return errno = EINVAL, -1;
|
||||
size_t stringlen = strlen(str);
|
||||
if ( resplen < stringlen + 1 )
|
||||
{
|
||||
errno = ERANGE;
|
||||
return (ssize_t) stringlen;
|
||||
}
|
||||
return errno = ERANGE, (ssize_t) stringlen;
|
||||
strcpy(resp, str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
Syscall::Register(SYSCALL_KERNELINFO, (void*) SysKernelInfo);
|
||||
Syscall::Register(SYSCALL_KERNELINFO, (void*) sys_kernelinfo);
|
||||
}
|
||||
|
||||
} // namespace Info
|
||||
|
|
Loading…
Reference in a new issue