Kernel - VFS API Update - ReadDir caller provided buffer
[tpg/acess2.git] / KernelLand / Kernel / include / acess.h
index 2cd2cff..1d062a5 100644 (file)
@@ -15,6 +15,8 @@
 #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
@@ -36,6 +38,7 @@
 
 // --- 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
@@ -43,6 +46,7 @@ typedef Sint64        tTimestamp;     //!< Timestamp (miliseconds since 00:00 1 Jan 1970)
 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 ---
 /**
@@ -56,7 +60,8 @@ typedef int   bool;   //!< Boolean type
 
 extern char    __buildnum[];
 #define BUILD_NUM      ((int)(Uint)&__buildnum)
-extern const char gsGitHash[];
+extern const char      gsGitHash[];
+extern const char      gsBuildInfo[];
 
 #define VER2(major,minor)      ((((major)&0xFF)<<8)|((minor)&0xFF))
 /**
@@ -90,6 +95,8 @@ extern const char gsGitHash[];
 #define CLONE_VM       0x10
 //! Don't copy user pages
 #define CLONE_NOUSER   0x20
+//! Inherit the parent's PGID
+#define CLONE_PGID     0x40
 /**
  * \}
  */
@@ -182,7 +189,7 @@ extern void Debug_HexDump(const char *Header, const void *Data, Uint Length);
 # 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
@@ -246,7 +253,7 @@ extern int  MM_Map(tVAddr VAddr, tPAddr PAddr);
  * \param Addr Address of the page to get the physical address of
  * \return Physical page mapped at \a Addr
  */
-extern tPAddr  MM_GetPhysAddr(tVAddr Addr);
+extern tPAddr  MM_GetPhysAddr(const void *Addr);
 /**
  * \brief Set the access flags on a page
  * \param VAddr        Virtual address of the page
@@ -272,12 +279,12 @@ extern Uint       MM_GetFlags(tVAddr VAddr);
  * \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
@@ -380,16 +387,21 @@ extern int        CheckMem(const void *Mem, int Num);
 #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);
 /**
  * \}
  */
@@ -400,6 +412,7 @@ extern Uint32       SwapEndian32(Uint32 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);
@@ -413,6 +426,7 @@ extern int  strucmp(const char *Str1, const char *Str2);
 extern char    *_strdup(const char *File, int Line, const char *Str);
 extern char    **str_split(const char *__str, char __ch);
 extern char    *strchr(const char *__s, int __c);
+extern char    *strrchr(const char *__s, int __c);
 extern int     strpos(const char *Str, char Ch);
 extern int     strpos8(const char *str, Uint32 search);
 extern void    itoa(char *buf, Uint64 num, int base, int minLength, char pad);
@@ -430,6 +444,8 @@ extern int  UnHex(Uint8 *Dest, size_t DestSize, const char *SourceString);
  * \}
  */
 
+#include <ctype.h>
+
 /**
  * \brief Get a random number
  * \return Random number
@@ -470,10 +486,12 @@ extern int        Module_LoadFile(const char *Path, const char *ArgStr);
  */
 /**
  * \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);
 /**
@@ -497,6 +515,7 @@ extern void Threads_Exit(int TID, int Status);
 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);

UCC git Repository :: git.ucc.asn.au