AcessNative - Hexdump sycall, stub shm
[tpg/acess2.git] / AcessNative / libacess-native.so_src / exports.c
1 #include "common.h"
2
3 #define acess__SysSpawn _disabled_acess__SysSpawn
4 #include "../ld-acess_src/exports.c"
5
6 void    *_crt0_exit_handler;
7
8 int *libc_geterrno(void)
9 {
10         return &acess__errno;
11 }
12
13 void _ZN4_sys5debugEPKcz(const char *fmt, ...)  __attribute__((alias("acess__SysDebug")));
14 void _ZN4_sys7hexdumpEPKcPKvj(const char *tag, const void *ptr, size_t size) __attribute__((alias("acess__SysDebugHex")));
15
16 #undef acess__SysSpawn
17
18 int acess__SysSpawn(const char *binary, const char **argv, const char **envp, int nfd, int fds[], struct s_sys_spawninfo *info)
19 {
20          int    argc = 0;
21         while( argv[argc++] )
22                 ;
23
24         Debug("_SysSpawn('%s', %p (%i), %p, %i, %p, %p)",
25                 binary, argv, argc, envp, nfd, fds, info);
26
27         char realpath[256];
28         realpath[255] = 0;
29
30         if( _Syscall(SYS_AN_GETPATH, "<d >s", sizeof(realpath)-1, realpath, binary) <= 0 ) {
31                 Warning("No translation for path '%s'", binary);
32                 acess__errno = -11;
33                 return -1;
34         }
35
36         Warning("TODO: Spawn '%s' = '%s'", binary, realpath);
37
38          int    emulated_tid;
39         int newID = _Syscall(SYS_AN_SPAWN, "<d >d >d",
40                 sizeof(emulated_tid), &emulated_tid,
41                 nfd*sizeof(int), fds,
42                 (info ? sizeof(*info) : 0), info
43                 );
44
45         if( newID <= 0 ) {
46                 return -1;
47         }
48
49         if( acessnative_spawn(realpath, newID, argv, envp) ) {
50         }
51
52         return emulated_tid;
53 }
54
55 void ldacess_DumpLoadedLibraries(void)
56 {
57         Debug("ldacess_DumpLoadedLibraries");
58 }
59

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