diff options
Diffstat (limited to 'Source/Library')
-rw-r--r-- | Source/Library/Common/BasicString.class.cpp | 34 | ||||
-rw-r--r-- | Source/Library/Common/String.class.cpp | 1 | ||||
-rw-r--r-- | Source/Library/Interface/Process.iface.h | 3 | ||||
-rw-r--r-- | Source/Library/Userland/Binding/Process.class.h | 10 |
4 files changed, 31 insertions, 17 deletions
diff --git a/Source/Library/Common/BasicString.class.cpp b/Source/Library/Common/BasicString.class.cpp index ceab60b..b8f7eea 100644 --- a/Source/Library/Common/BasicString.class.cpp +++ b/Source/Library/Common/BasicString.class.cpp @@ -1,8 +1,8 @@ #include <Vector.class.h> -#define FREE if (m_string != 0) delete m_string; -#define ALLOC m_string = new T[m_length]; -#define VRFY if (m_length == 0) { m_string = NULL; return; } +#define BS_FREE if (m_string != 0) delete m_string; +#define BS_ALLOC m_string = new T[m_length]; +#define BS_VRFY if (m_length == 0) { m_string = NULL; return; } using namespace CMem; @@ -32,33 +32,33 @@ BasicString<T>::BasicString(const T value, u32int count) { template <typename T> BasicString<T>::~BasicString() { - FREE; + BS_FREE; } template <typename T> void BasicString<T>::affect(const BasicString<T> &other) { - FREE; + BS_FREE; m_length = other.m_length; - VRFY; - ALLOC; + BS_VRFY; + BS_ALLOC; memcpy((u8int*)m_string, (u8int*)(other.m_string), m_length * sizeof(T)); } template <typename T> void BasicString<T>::affect(const T* string, u32int length) { - FREE; + BS_FREE; m_length = length; - VRFY; - ALLOC; + BS_VRFY; + BS_ALLOC; memcpy((u8int*)string, (u8int*)string, m_length * sizeof(T)); } template <typename T> void BasicString<T>::affect(const T value, u32int count) { - FREE; + BS_FREE; m_length = count; - VRFY; - ALLOC; + BS_VRFY; + BS_ALLOC; for (u32int i = 0; i < count; i++) { m_string[i] = value; } @@ -91,7 +91,7 @@ BasicString<T> &BasicString<T>::append(const BasicString<T> &other) { for (u32int i = 0; i < other.m_length; i++) { newdata[i + m_length] = other.m_string[i]; } - FREE; + BS_FREE; m_string = newdata; m_length += other.m_length; return *this; @@ -106,7 +106,7 @@ BasicString<T> &BasicString<T>::append(const T* string, u32int length) { for (u32int i = 0; i < length; i++) { newdata[i + m_length] = string[i]; } - FREE; + BS_FREE; m_string = newdata; m_length += length; return *this; @@ -118,7 +118,7 @@ BasicString<T> &BasicString<T>::append(const T other) { for (u32int i = 0; i < m_length; i++) { newdata[i] = m_string[i]; } - FREE; + BS_FREE; m_string = newdata; m_string[m_length] = other; m_length++; @@ -145,7 +145,7 @@ BasicString<T> BasicString<T>::concat(const T other) const { template <typename T> void BasicString<T>::clear() { - FREE; + BS_FREE; m_string = 0; m_length = 0; } diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp index ac0eba0..63ff837 100644 --- a/Source/Library/Common/String.class.cpp +++ b/Source/Library/Common/String.class.cpp @@ -50,6 +50,7 @@ String String::number(s32int number) { } String String::unserialize(u32int w) { + if (w == (u32int) - 1) return String(); u32int* a = (u32int*)w; String ret; ret.m_length = a[0]; diff --git a/Source/Library/Interface/Process.iface.h b/Source/Library/Interface/Process.iface.h index 2126dc6..b79639d 100644 --- a/Source/Library/Interface/Process.iface.h +++ b/Source/Library/Interface/Process.iface.h @@ -9,5 +9,8 @@ #define PRIF_EXIT 0x01 #define PRIF_ALLOCPAGE 0x02 #define PRIF_FREEPAGE 0x03 +#define PRIF_GETPID 0x04 +#define PRIF_GETPPID 0x05 +#define PRIF_GETCMDLINE 0x06 #endif diff --git a/Source/Library/Userland/Binding/Process.class.h b/Source/Library/Userland/Binding/Process.class.h index 00afe27..935bb39 100644 --- a/Source/Library/Userland/Binding/Process.class.h +++ b/Source/Library/Userland/Binding/Process.class.h @@ -1,6 +1,7 @@ #include <Syscall/RessourceCaller.class.h> #include <Process.iface.h> +#include <String.class.h> class Process : public RessourceCaller { public: @@ -19,4 +20,13 @@ class Process : public RessourceCaller { void freePage(u32int pos) { doCall(PRIF_FREEPAGE, pos); } + u32int getPid() { + return doCall(PRIF_GETPID); + } + u32int getPpid() { + return doCall(PRIF_GETPPID); + } + String getCmdline() { + return String::unserialize(doCall(PRIF_GETCMDLINE)); + } }; |