From f0556ed7f051fb101dc68752526696365bf79a11 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Fri, 23 Oct 2009 17:28:25 +0200 Subject: More work on syscalls and shell --- Source/Library/Userland/Binding/FSNode.class.h | 12 ++++++++++++ Source/Library/Userland/Binding/Sys.ns.cpp | 15 +++++++++++++++ Source/Library/Userland/Binding/Sys.ns.h | 9 +++++++++ Source/Library/Userland/Syscall/RessourceCaller.class.h | 2 +- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Source/Library/Userland/Binding/Sys.ns.cpp create mode 100644 Source/Library/Userland/Binding/Sys.ns.h (limited to 'Source/Library/Userland') diff --git a/Source/Library/Userland/Binding/FSNode.class.h b/Source/Library/Userland/Binding/FSNode.class.h index eb25782..95802a4 100644 --- a/Source/Library/Userland/Binding/FSNode.class.h +++ b/Source/Library/Userland/Binding/FSNode.class.h @@ -20,4 +20,16 @@ class FSNode : public RessourceCaller { u64int getLength() { return *((u64int*)doCall(FNIF_GETLENGTH)); } + u32int getUid() { + return doCall(FNIF_GETUID); + } + u32int getGid() { + return doCall(FNIF_GETGID); + } + u32int getPerm() { + return doCall(FNIF_GETPERM); + } + String path() { + return String::unserialize(doCall(FNIF_GETPATH)); + } }; diff --git a/Source/Library/Userland/Binding/Sys.ns.cpp b/Source/Library/Userland/Binding/Sys.ns.cpp new file mode 100644 index 0000000..7083e56 --- /dev/null +++ b/Source/Library/Userland/Binding/Sys.ns.cpp @@ -0,0 +1,15 @@ +#include +#include "Sys.ns.h" +#include + +namespace Sys { + +void halt() { + RessourceCaller::sCall(SYIF_IFID, SYIF_HALT); +} + +void reboot() { + RessourceCaller::sCall(SYIF_IFID, SYIF_REBOOT); +} + +} diff --git a/Source/Library/Userland/Binding/Sys.ns.h b/Source/Library/Userland/Binding/Sys.ns.h new file mode 100644 index 0000000..3a8426b --- /dev/null +++ b/Source/Library/Userland/Binding/Sys.ns.h @@ -0,0 +1,9 @@ +#ifndef DEF_SYS_NS_H +#define DEF_SYS_NS_H + +namespace Sys { + void halt(); + void reboot(); +} + +#endif diff --git a/Source/Library/Userland/Syscall/RessourceCaller.class.h b/Source/Library/Userland/Syscall/RessourceCaller.class.h index 85beacf..f26216d 100644 --- a/Source/Library/Userland/Syscall/RessourceCaller.class.h +++ b/Source/Library/Userland/Syscall/RessourceCaller.class.h @@ -23,11 +23,11 @@ class RessourceCaller { RessourceCaller(u32int id, u32int type); //Static call -- a call specific to a class and not an object - static u32int sCall(u32int type, u8int wat, u32int a = 0, u32int b = 0, u32int c = 0, u32int d = 0); u32int doCall(u8int call, u32int a = 0, u32int b = 0, u32int c = 0, u32int d = 0, u32int e = 0); public: + static u32int sCall(u32int type, u8int wat, u32int a = 0, u32int b = 0, u32int c = 0, u32int d = 0); u32int resId() { return m_id; } u32int resType() { return m_type; } bool valid() { return m_type != 0; } -- cgit v1.2.3