#define PACKED __attribute__((packed))
//! Mark a function as not returning
#define NORETURN __attribute__((noreturn))
+//! Mark a function (or variable) as deprecated
+#define DEPRECATED __attribute__((deprecated))
//! Mark a parameter as unused
#define UNUSED(x) UNUSED_##x __attribute__((unused))
//! Get the offset of a member in a structure
// --- Types ---
typedef Uint32 tPID; //!< Process ID type
+typedef Uint32 tPGID; //!< Process Group ID type
typedef Uint32 tTID; //!< Thread ID Type
typedef Uint32 tUID; //!< User ID Type
typedef Uint32 tGID; //!< Group ID Type
typedef Sint64 tTime; //!< Same again
typedef struct sShortSpinlock tShortSpinlock; //!< Opaque (kinda) spinlock
typedef int bool; //!< Boolean type
+typedef Uint64 off_t; //!< VFS Offset
// --- Helper Macros ---
/**
#define CLONE_VM 0x10
//! Don't copy user pages
#define CLONE_NOUSER 0x20
+//! Inherit the parent's PGID
+#define CLONE_PGID 0x40
/**
* \}
*/
# define LEAVE_RET0() return
#endif
#if SANITY
-# define ASSERT(expr) do{if(!(expr))Panic("%s: Assertion '"#expr"' failed",(char*)__func__);}while(0)
+# define ASSERT(expr) do{if(!(expr))Panic("%s:%i - %s: Assertion '"#expr"' failed",__FILE__,__LINE__,(char*)__func__);}while(0)
#else
# define ASSERT(expr)
#endif
* \return Virtual address of page in memory
* \note There is only a limited ammount of slots avaliable
*/
-extern tVAddr MM_MapTemp(tPAddr PAddr);
+extern void *MM_MapTemp(tPAddr PAddr);
/**
* \brief Free a temporarily mapped page
* \param VAddr Allocate virtual addres of page
*/
-extern void MM_FreeTemp(tVAddr VAddr);
+extern void MM_FreeTemp(void *Ptr);
/**
* \brief Map a physcal address range into the virtual address space
* \param PAddr Physical address to map in
#ifdef __BIG_ENDIAN__
#define LittleEndian16(_val) SwapEndian16(_val)
#define LittleEndian32(_val) SwapEndian32(_val)
+#define LittleEndian64(_val) SwapEndian32(_val)
#define BigEndian16(_val) (_val)
#define BigEndian32(_val) (_val)
+#define BigEndian64(_val) (_val)
#else
#define LittleEndian16(_val) (_val)
#define LittleEndian32(_val) (_val)
+#define LittleEndian64(_val) (_val)
#define BigEndian16(_val) SwapEndian16(_val)
#define BigEndian32(_val) SwapEndian32(_val)
+#define BigEndian64(_val) SwapEndian64(_val)
#endif
extern Uint16 SwapEndian16(Uint16 Val);
extern Uint32 SwapEndian32(Uint32 Val);
+extern Uint64 SwapEndian64(Uint64 Val);
/**
* \}
*/
* \{
*/
extern int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args);
+extern int snprintf(char *__s, size_t __n, const char *__format, ...);
extern int sprintf(char *__s, const char *__format, ...);
extern size_t strlen(const char *Str);
extern char *strcpy(char *__dest, const char *__src);
* \}
*/
+#include <ctype.h>
+
/**
* \brief Get a random number
* \return Random number
*/
/**
* \brief Create a timestamp from a time
+ * \note Days/Months are zero-based (e.g. December is 11, and has a day range of 0-30)
*/
extern tTime timestamp(int sec, int mins, int hrs, int day, int month, int year);
/**
* \brief Extract the date/time from a timestamp
+ * \note Days/Months are zero-based (e.g. December is 11, and has a day range of 0-30)
*/
extern void format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms);
/**
extern void Threads_Yield(void);
extern void Threads_Sleep(void);
extern int Threads_WakeTID(tTID Thread);
+extern tPGID Threads_GetPGID(void);
extern tPID Threads_GetPID(void);
extern tTID Threads_GetTID(void);
extern tUID Threads_GetUID(void);