0f71f2121b76de0fc2871a0998f2eb653165ae04
[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
15 #undef acess__SysSpawn
16
17 int acess__SysSpawn(const char *binary, const char **argv, const char **envp, int nfd, int fds[], struct s_sys_spawninfo *info)
18 {
19          int    argc = 0;
20         while( argv[argc++] )
21                 ;
22
23         Debug("_SysSpawn('%s', %p (%i), %p, %i, %p, %p)",
24                 binary, argv, argc, envp, nfd, fds, info);
25
26         char realpath[256];
27         realpath[255] = 0;
28
29         if( _Syscall(SYS_AN_GETPATH, "<d >s", sizeof(realpath)-1, realpath, binary) <= 0 ) {
30                 Warning("No translation for path '%s'", binary);
31                 acess__errno = -11;
32                 return -1;
33         }
34
35         Warning("TODO: Spawn '%s' = '%s'", binary, realpath);
36
37          int    emulated_tid;
38         int newID = _Syscall(SYS_AN_SPAWN, "<d >d >d",
39                 sizeof(emulated_tid), &emulated_tid,
40                 nfd*sizeof(int), fds,
41                 (info ? sizeof(*info) : 0), info
42                 );
43
44         if( newID <= 0 ) {
45                 return -1;
46         }
47
48         if( acessnative_spawn(realpath, newID, argv, envp) ) {
49         }
50
51         return emulated_tid;
52 }
53
54 void ldacess_DumpLoadedLibraries(void)
55 {
56         Debug("ldacess_DumpLoadedLibraries");
57 }
58

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