#include "request.h"
#include "../syscalls.h"
-#define DEBUG(x...) printf(x)
+#define DEBUG(str, x...) Debug(str, x)
#define NATIVE_FILE_MASK 0x40000000
#define MAX_FPS 16
case 'i':
if( direction != 1 ) {
- fprintf(stderr, "ReadEntry: Recieving an integer is not defined\n");
+ Warning("ReadEntry: Recieving an integer is not defined");
return NULL;
}
free( req );
free( retPtrs );
- DEBUG(": %llx\n", retValue);
+ DEBUG(": %llx", retValue);
return retValue;
}
int acess_ioctl(int fd, int id, void *data) {
// 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);
}
int acess_finfo(int fd, t_sysFInfo *info, int maxacls) {
}
int acess_readdir(int fd, char *dest) {
+ DEBUG("readdir(%i, %p)", fd, dest);
return _Syscall(SYS_READDIR, ">i <d", fd, 256, dest);
}
+int acess_select(int nfds, fd_set *read, fd_set *write, fd_set *error, time_t *timeout)
+{
+ DEBUG("select(%i, %p, %p, %p, %p)", nfds, read, write, error, timeout);
+ return _Syscall(SYS_SELECT, ">i ?d ?d ?d >d", nfds,
+ read ? (nfds+7)/8 : 0, read,
+ write ? (nfds+7)/8 : 0, write,
+ error ? (nfds+7)/8 : 0, error,
+ sizeof(*timeout), timeout
+ );
+}
+
int acess__SysOpenChild(int fd, char *name, int flags) {
return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags);
}
return 0;
}
- // TODO: Return the acess TID instead
+ // Return the acess TID instead
return kernel_tid;
}
else
{
int i, argc;
- printf("acess_execve: (path='%s', argv=%p, envp=%p)\n", path, argv, envp);
+ DEBUG("acess_execve: (path='%s', argv=%p, envp=%p)", path, argv, envp);
// Get argument count
for( argc = 0; argv[argc]; argc ++ ) ;
- printf(" acess_execve: argc = %i\n", argc);
+ DEBUG(" acess_execve: argc = %i", argc);
char *new_argv[5+argc+1];
char key[11];
return _Syscall(SYS_SETGID, ">i", ID);
}
+int acess_SysSendMessage(int DestTID, int Length, void *Data)
+{
+ return _Syscall(SYS_SENDMSG, ">i >d", DestTID, Length, Data);
+}
+
+int acess_SysGetMessage(int *SourceTID, void *Data)
+{
+ return _Syscall(SYS_GETMSG, "<d <d",
+ SourceTID ? sizeof(int) : 0, SourceTID,
+ Data ? 4096 : 0, Data
+ );
+}
+
// --- Logging
void acess__SysDebug(const char *Format, ...)
{
va_start(args, Format);
- printf("[_SysDebug] ");
+ printf("[_SysDebug %i]", giSyscall_ClientID);
vprintf(Format, args);
printf("\n");
void acess__exit(int Status)
{
+ DEBUG("_exit(%i)", Status);
_Syscall(SYS_EXIT, ">i", Status);
exit(Status);
}
DEFSYM(ioctl),
DEFSYM(finfo),
DEFSYM(readdir),
+ DEFSYM(select),
DEFSYM(_SysOpenChild),
DEFSYM(_SysGetACL),
DEFSYM(_SysMount),
DEFSYM(waittid),
DEFSYM(setuid),
DEFSYM(setgid),
+
+ DEFSYM(SysSendMessage),
+ DEFSYM(SysGetMessage),
DEFSYM(_SysAllocate),
DEFSYM(_SysDebug),