Copyright clean-up (part 1):
[AROS.git] / arch / all-unix / exec / platform_init.c
blobe1aed6e93328b52e86b0630915725c725b7ff9db
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <aros/kernel.h>
8 #include <aros/symbolsets.h>
9 #include <proto/hostlib.h>
11 #include "exec_intern.h"
13 static const char *libc_symbols[] =
15 "exit",
16 #ifdef HAVE_SWAPCONTEXT
17 "getcontext",
18 "makecontext",
19 "swapcontext",
20 #endif
21 NULL
24 static int Platform_Init(struct ExecBase *SysBase)
26 APTR LibCHandle;
27 ULONG r;
29 HostLibBase = OpenResource("hostlib.resource");
30 D(bug("[exec] HostLibBase %p\n", HostLibBase));
31 if (!HostLibBase)
32 return FALSE;
34 /* We use local variable for the handle because we never expunge
35 so we will never close it */
36 LibCHandle = HostLib_Open(LIBC_NAME, NULL);
37 D(bug("[exec] libc handle 0x%p\n", LibCHandle));
38 if (!LibCHandle)
39 return FALSE;
41 PD(SysBase).SysIFace = (struct LibCInterface *)HostLib_GetInterface(LibCHandle, libc_symbols, &r);
42 if (PD(SysBase).SysIFace)
44 D(bug("[exec] Got libc interface, %u unresolved symbols\n", r));
45 if (!r)
46 return TRUE;
48 HostLib_DropInterface((APTR *)PD(SysBase).SysIFace);
49 HostLib_Close(LibCHandle, NULL);
52 return FALSE;
55 ADD2INITLIB(Platform_Init, 0);