diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /emu/port/dynld.c | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'emu/port/dynld.c')
| -rw-r--r-- | emu/port/dynld.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/emu/port/dynld.c b/emu/port/dynld.c new file mode 100644 index 00000000..6c5bf8e4 --- /dev/null +++ b/emu/port/dynld.c @@ -0,0 +1,52 @@ +#include "dat.h" +#include "fns.h" +#include "error.h" +#include <a.out.h> +#include <dynld.h> + +/* + * kernel interface to dynld, for use by devdynld.c, + * libinterp/dlm.c, and possibly others + */ + +typedef struct Fd Fd; +struct Fd { + int fd; +}; + +static long +readfd(void *a, void *buf, long nbytes) +{ + return kread(((Fd*)a)->fd, buf, nbytes); +} + +static vlong +seekfd(void *a, vlong off, int t) +{ + return kseek(((Fd*)a)->fd, off, t); +} + +static void +errfd(char *s) +{ + kstrcpy(up->env->errstr, s, ERRMAX); +} + +Dynobj* +kdynloadfd(int fd, Dynsym *tab, int ntab) +{ + Dynobj *o; + Fd f; + + f.fd = fd; + return dynloadgen(&f, readfd, seekfd, errfd, tab, ntab, 0); +} + +int +kdynloadable(int fd) +{ + Fd f; + + f.fd = fd; + return dynloadable(&f, readfd, seekfd); +} |
