Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Add Solaris specific declararions for dlfcn.
Browse files Browse the repository at this point in the history
Add definitions to core.sys.posix.dlfcn and add new modul core.sys.solaris.dlfcn.
  • Loading branch information
redstar committed Nov 24, 2014
1 parent 652014b commit 77a8c8a
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 0 deletions.
1 change: 1 addition & 0 deletions mak/COPY
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ COPY=\
$(IMPDIR)\core\sys\posix\sys\wait.d \
$(IMPDIR)\core\sys\posix\sys\utsname.d \
\
$(IMPDIR)\core\sys\solaris\dlfcn.d \
$(IMPDIR)\core\sys\solaris\sys\procset.d \
$(IMPDIR)\core\sys\solaris\sys\types.d \
$(IMPDIR)\core\sys\solaris\sys\priocntl.d \
Expand Down
1 change: 1 addition & 0 deletions mak/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ MANIFEST=\
src\core\sys\posix\sys\utsname.d \
src\core\sys\posix\sys\wait.d \
\
src\core\sys\solaris\dlfcn.d \
src\core\sys\solaris\sys\priocntl.d \
src\core\sys\solaris\sys\procset.d \
src\core\sys\solaris\sys\types.d \
Expand Down
1 change: 1 addition & 0 deletions mak/SRCS
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ SRCS=\
src\core\sys\posix\netinet\in_.d \
src\core\sys\posix\arpa\inet.d \
\
src\core\sys\solaris\dlfcn.d \
src\core\sys\solaris\sys\priocntl.d \
src\core\sys\solaris\sys\types.d \
src\core\sys\solaris\sys\procset.d \
Expand Down
21 changes: 21 additions & 0 deletions src/core/sys/posix/dlfcn.d
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,27 @@ else version( FreeBSD )
void* dli_saddr;
}
}
else version( Solaris )
{
enum RTLD_LAZY = 1;
enum RTLD_NOW = 2;
enum RTLD_GLOBAL = 0x100;
enum RTLD_LOCAL = 0;

int dlclose(void*);
char* dlerror();
void* dlopen(in char*, int);
void* dlsym(void*, in char*);
int dladdr(const(void)* addr, Dl_info* info);

struct Dl_info
{
const(char)* dli_fname;
void* dli_fbase;
const(char)* dli_sname;
void* dli_saddr;
}
}
else version( Android )
{
enum
Expand Down
112 changes: 112 additions & 0 deletions src/core/sys/solaris/dlfcn.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* D header file for Solaris
*
* $(LINK2 http://src.illumos.org/source/xref/illumos-gate/usr/src/head/dlfcn.h, illumos dlfcn.h)
*/

module core.sys.solaris.dlfcn;

version (Solaris):
extern (C):
nothrow:

public import core.sys.posix.dlfcn;
import core.stdc.config;

// enum RTLD_LAZY = 0x00001; // POSIX
// enum RTLD_NOW = 0x00002; // POSIX
enum RTLD_NOLOAD = 0x00004;
enum RTLD_DEEPBIND = 0x00008;

// enum RTLD_GLOBAL = 0x00100; // POSIX
// enum RTLD_LOCAL = 0; // POSIX
enum RTLD_PARENT = 0x00200;
enum RTLD_GROUP = 0x00400;
enum RTLD_WORLD = 0x00800;
enum RTLD_NODELETE = 0x01000;
enum RTLD_FIRST = 0x02000;
enum RTLD_CONFGEN = 0x10000;


enum
{
RTLD_NEXT = cast(void *)-1,
RTLD_DEFAULT = cast(void *)-2,
RTLD_SELF = cast(void *)-3,
RTLD_PROBE = cast(void *)-4,
}

alias c_ulong Lmid_t;

void* dlmopen(Lmid_t, in char*, int);

enum
{
RTLD_REL_RELATIVE = 0x00001,
RTLD_REL_EXEC = 0x00002,
RTLD_REL_DEPENDS = 0x00004,
RTLD_REL_PRELOAD = 0x00008,
RTLD_REL_SELF = 0x00010,
RTLD_REL_WEAK = 0x00020,
RTLD_REL_ALL = 0x00fff,
RTLD_MEMORY = 0x01000,
RTLD_STRIP = 0x02000,
RTLD_NOHEAP = 0x04000,
RTLD_CONFSET = 0x10000,
}

int dldump(in char*, in char*, int);

struct Dl_info
{
const(char)* dli_fname;
void* dli_fbase;
const(char)* dli_sname;
void* dli_saddr;
}

enum
{
RTLD_DL_SYMENT = 1,
RTLD_DL_LINKMAP = 2,
}

int dladdr(const(void)*, Dl_info*);
int dladdr1(void*, Dl_info*, void**, int);

enum
{
RTLD_DI_LMID = 1,
RTLD_DI_LINKMAP = 2,
RTLD_DI_CONFIGADDR = 3,
RTLD_DI_SERINFO = 4,
RTLD_DI_SERINFOSIZE = 5,
RTLD_DI_ORIGIN = 6,
RTLD_DI_PROFILENAME = 7,
RTLD_DI_PROFILEOUT = 8,
RTLD_DI_GETSIGNAL = 9,
RTLD_DI_SETSIGNAL = 10,
RTLD_DI_ARGSINFO = 11,
RTLD_DI_MMAPS = 12,
RTLD_DI_MMAPCNT = 13,
RTLD_DI_DEFERRED = 14,
RTLD_DI_DEFERRED_SYM = 15,
RTLD_DI_MAX = 15,
}

int dlinfo(void*, int, void*);

struct Dl_serpath
{
char* dls_name;
uint dls_flags;
}

struct Dl_serinfo
{
size_t dls_size;
uint dls_cnt;
Dl_serpath[1] dls_serpath;
}

// FIXME: Dl_argsinfo, Dl_mapinfo, Dl_amd64_unwindinfo are missing
3 changes: 3 additions & 0 deletions win32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ $(IMPDIR)\core\sys\posix\unistd.d : src\core\sys\posix\unistd.d
$(IMPDIR)\core\sys\posix\utime.d : src\core\sys\posix\utime.d
copy $** $@

$(IMPDIR)\core\sys\solaris\dlfcn.d : src\core\sys\solaris\dlfcn.d
copy $** $@

$(IMPDIR)\core\sys\solaris\execinfo.d : src\core\sys\solaris\execinfo.d
copy $** $@

Expand Down
3 changes: 3 additions & 0 deletions win64.mak
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ $(IMPDIR)\core\sys\posix\unistd.d : src\core\sys\posix\unistd.d
$(IMPDIR)\core\sys\posix\utime.d : src\core\sys\posix\utime.d
copy $** $@

$(IMPDIR)\core\sys\solaris\dlfcn.d : src\core\sys\solaris\dlfcn.d
copy $** $@

$(IMPDIR)\core\sys\solaris\execinfo.d : src\core\sys\solaris\execinfo.d
copy $** $@

Expand Down

0 comments on commit 77a8c8a

Please sign in to comment.