Modules/LVM - Fixed uninitalised value
[tpg/acess2.git] / AcessNative / ld-acess_src / exports.c
index 0c87bda..406e55f 100644 (file)
@@ -12,6 +12,7 @@
 #include <stddef.h>
 
 #define DEBUG(v...)    Debug(v)
+#define PAGE_SIZE      4096
 
 typedef struct sFILE   FILE;
 
@@ -93,9 +94,14 @@ uint64_t acess_tell(int FD) {
 }
 
 int acess_ioctl(int fd, int id, void *data) {
+        int    len;
        // NOTE: 1024 byte size is a hack
        DEBUG("ioctl(%i, %i, %p)", fd, id, data);
-       return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, 1024, data);
+       if( data == NULL )
+               len = 0;
+       else
+               len = PAGE_SIZE - ((uintptr_t)data % PAGE_SIZE);
+       return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, len, data);
 }
 int acess_finfo(int fd, t_sysFInfo *info, int maxacls) {
 //     DEBUG("offsetof(size, t_sysFInfo) = %i", offsetof(t_sysFInfo, size));
@@ -257,10 +263,19 @@ int acess_SysSendMessage(int DestTID, int Length, void *Data)
 
 int acess_SysGetMessage(int *SourceTID, void *Data)
 {
-       return _Syscall(SYS_GETMSG, "<d <d",
+//     static __thread int lastlen = 1024;
+       int lastlen;
+
+       lastlen = _Syscall(SYS_GETMSG, "<d <d",
                SourceTID ? sizeof(int) : 0, SourceTID,
-               Data ? 4096 : 0, Data
+               Data ? 1024 : 0, Data
                );
+       return lastlen;
+}
+
+int acess__SysWaitEvent(int Mask)
+{
+       return _Syscall(SYS_WAITEVENT, ">i", Mask);
 }
 
 // --- Logging
@@ -321,7 +336,8 @@ const tSym  caBuiltinSymbols[] = {
        
        DEFSYM(_SysAllocate),
        DEFSYM(_SysDebug),
-       DEFSYM(_SysSetFaultHandler)
+       DEFSYM(_SysSetFaultHandler),
+       DEFSYM(_SysWaitEvent)
 };
 
 const int      ciNumBuiltinSymbols = sizeof(caBuiltinSymbols)/sizeof(caBuiltinSymbols[0]);

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