mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 21:58:20 +00:00
handle /etc/hostname, sethostname(2), gethostname(2) and uname(2)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#include <kernel/syscalls.h>
|
||||
#include <build.h>
|
||||
|
||||
typedef struct {
|
||||
char sysname[65];
|
||||
char nodename[65];
|
||||
char release[65];
|
||||
char version[65];
|
||||
char machine[65];
|
||||
char domainname[65];
|
||||
} utsname_t;
|
||||
|
||||
void hostname_get(char *buf);
|
||||
|
||||
syscallret_t syscall_uname(context_t *, utsname_t *utsname) {
|
||||
syscallret_t ret = {0};
|
||||
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
hostname_get(hostname);
|
||||
|
||||
strcpy(utsname->sysname, "Astral");
|
||||
strcpy(utsname->nodename, hostname);
|
||||
strcpy(utsname->release, "Astral");
|
||||
strcpy(utsname->version, BUILD_DATE);
|
||||
strcpy(utsname->machine, BUILD_TARGET);
|
||||
strcpy(utsname->domainname, hostname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user