Picking up the pieces (part 1)
This was SVN commit r5376.
This commit is contained in:
parent
a8066fe5e2
commit
ea65a2ad8e
22
source/lib/sysdep/linux/linux.cpp
Normal file
22
source/lib/sysdep/linux/linux.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
|
||||
#define GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
|
||||
LibError sys_get_executable_name(char* n_path, size_t buf_size)
|
||||
{
|
||||
Dl_info dl_info;
|
||||
|
||||
memset(&dl_info, 0, sizeof(dl_info));
|
||||
if (!dladdr((void *)sys_get_executable_name, &dl_info) ||
|
||||
!dl_info.dli_fname )
|
||||
{
|
||||
return ERR::NO_SYS;
|
||||
}
|
||||
|
||||
strncpy(n_path, dl_info.dli_fname, buf_size);
|
||||
return INFO::OK;
|
||||
}
|
||||
|
@ -3,12 +3,14 @@
|
||||
|
||||
// stub implementations
|
||||
|
||||
LibError dir_add_watch(const char * const n_full_path, intptr_t* const watch)
|
||||
LibError dir_add_watch(
|
||||
const char * const UNUSED(n_full_path),
|
||||
intptr_t* const UNUSED(watch))
|
||||
{
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
LibError dir_cancel_watch(const intptr_t watch)
|
||||
LibError dir_cancel_watch(const intptr_t UNUSED(watch))
|
||||
{
|
||||
return INFO::OK;
|
||||
}
|
||||
|
24
source/lib/sysdep/osx/odbg.cpp
Normal file
24
source/lib/sysdep/osx/odbg.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
// note: the BFD stuff *could* be used on other platforms, if we saw the
|
||||
// need for it.
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
#include "lib/debug.h"
|
||||
|
||||
void* debug_get_nth_caller(uint UNUSED(n), void *UNUSED(context))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LibError debug_dump_stack(wchar_t* UNUSED(buf), size_t UNUSED(max_chars), uint UNUSED(skip), void* UNUSED(context))
|
||||
{
|
||||
return ERR::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
LibError debug_resolve_symbol(void* UNUSED(ptr_of_interest), char* UNUSED(sym_name), char* UNUSED(file), int* UNUSED(line))
|
||||
{
|
||||
return ERR::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -54,24 +54,24 @@ LibError gfx_get_video_mode(int* xres, int* yres, int* bpp, int* freq)
|
||||
return ERR::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
LibError sys_get_executable_name(char* n_path, size_t buf_size)
|
||||
{
|
||||
static char name[PATH_MAX];
|
||||
static bool init = false;
|
||||
if ( !init )
|
||||
{
|
||||
init = true;
|
||||
char temp[PATH_MAX];
|
||||
u32 size = PATH_MAX;
|
||||
if (_NSGetExecutablePath( temp, &size ))
|
||||
{
|
||||
return ERR::NO_SYS;
|
||||
}
|
||||
debug_printf("exe name before realpath: %s\n", temp);
|
||||
realpath(temp, name);
|
||||
}
|
||||
strncpy(n_path, name, buf_size);
|
||||
debug_printf("exe name: %s\n", name);
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
LibError sys_get_executable_name(char* n_path, size_t buf_size)
|
||||
{
|
||||
static char name[PATH_MAX];
|
||||
static bool init = false;
|
||||
if ( !init )
|
||||
{
|
||||
init = true;
|
||||
char temp[PATH_MAX];
|
||||
u32 size = PATH_MAX;
|
||||
if (_NSGetExecutablePath( temp, &size ))
|
||||
{
|
||||
return ERR::NO_SYS;
|
||||
}
|
||||
debug_printf("exe name before realpath: %s\n", temp);
|
||||
realpath(temp, name);
|
||||
}
|
||||
strncpy(n_path, name, buf_size);
|
||||
debug_printf("exe name: %s\n", name);
|
||||
return INFO::OK;
|
||||
}
|
||||
|
@ -25,23 +25,6 @@ void sys_display_msgw(const wchar_t* caption, const wchar_t* msg)
|
||||
fwprintf(stderr, L"%ls: %ls\n", caption, msg);
|
||||
}
|
||||
|
||||
|
||||
LibError sys_get_executable_name(char* n_path, size_t buf_size)
|
||||
{
|
||||
Dl_info dl_info;
|
||||
|
||||
memset(&dl_info, 0, sizeof(dl_info));
|
||||
if (!dladdr((void *)sys_get_executable_name, &dl_info) ||
|
||||
!dl_info.dli_fname )
|
||||
{
|
||||
return ERR::NO_SYS;
|
||||
}
|
||||
|
||||
strncpy(n_path, dl_info.dli_fname, buf_size);
|
||||
return INFO::OK;
|
||||
}
|
||||
|
||||
|
||||
ErrorReaction sys_display_error(const wchar_t* text, uint flags)
|
||||
{
|
||||
printf("%ls\n\n", text);
|
||||
|
Loading…
Reference in New Issue
Block a user