Skip to content

Commit

Permalink
split out rumpclient specific parts of emul.c
Browse files Browse the repository at this point in the history
  • Loading branch information
justincormack committed Jun 6, 2014
1 parent 18ca974 commit b224951
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ rumpremote.sh: rumpremote.sh.in
emul.o: emul.c
${CC} ${HOSTCFLAGS} -c $< -o $@

rumpclient.o: rumpclient.c
${CC} ${HOSTCFLAGS} -c $< -o $@

readwrite.o: readwrite.c
${CC} ${HOSTCFLAGS} -c $< -o $@

Expand All @@ -95,7 +98,7 @@ halt.o: halt.c ${NBCC}

MAPS=rump.map namespace.map host.map netbsd.map readwrite.map emul.map

bin/halt: halt.o emul.o readwrite.o remoteinit.o ${MAPS}
bin/halt: halt.o emul.o rumpclient.o readwrite.o remoteinit.o ${MAPS}
./mkremote.sh halt halt.o

rump.map: rumpsrc/sys/rump/rump.sysmap
Expand All @@ -113,7 +116,7 @@ rumpsrc/${1}/${2}.ro:

NBLIBS.${2}:= $(shell cd rumpsrc/${1} && ${RUMPMAKE} -V '$${LDADD}')
LIBS.${2}=$${NBLIBS.${2}:-l%=rump/lib/lib%.a}
bin/${2}: rumpsrc/${1}/${2}.ro emul.o readwrite.o remoteinit.o netbsd_init.o ${MAPS} $${LIBS.${2}}
bin/${2}: rumpsrc/${1}/${2}.ro emul.o rumpclient.o readwrite.o remoteinit.o netbsd_init.o ${MAPS} $${LIBS.${2}}
./mkremote.sh ${2} rumpsrc/${1}/${2}.ro $${LIBS.${2}}

${2}: bin/${2}
Expand Down
23 changes: 0 additions & 23 deletions emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <sys/time.h>
#include <sys/resource.h>

#include <rump/rumpclient.h>

/* TODO map errors better, and generally better error handling */
#define _NETBSD_ENOENT 2
#define _NETBSD_EINVAL 22
Expand Down Expand Up @@ -152,18 +150,6 @@ emul_setpriority(int which, int who, int prio) {
return 0;
}

int
emul__fork(void)
{
return rumpclient_fork();
}

int
emul__vfork14(void)
{
return rumpclient_fork();
}

static int rusage_map[2] = {
RUSAGE_SELF,
RUSAGE_CHILDREN,
Expand All @@ -189,15 +175,6 @@ emul__getrusage50(int who, struct _netbsd_rusage *nrusage)
return ok;
}

extern char **environ;

int
emul_execve(const char *filename, char *const argv[], char *const envp[])
{

return rumpclient_exec(filename, argv, environ);
}

/* use host environment */
char *
emul_getenv(const char *name)
Expand Down
2 changes: 1 addition & 1 deletion mkremote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ objcopy --redefine-syms=netbsd.map ${OBJDIR}/tmp1_${NAME}.o
${CC} ${LDFLAGS} -Wl,-r -nostdlib -Wl,-dc ${OBJDIR}/tmp1_${NAME}.o readwrite.o -o ${OBJDIR}/tmp2_${NAME}.o 2>/dev/null
objcopy -w --localize-symbol='*' ${OBJDIR}/tmp2_${NAME}.o
objcopy -w --globalize-symbol='_netbsd_*' ${OBJDIR}/tmp2_${NAME}.o
${CC} ${CFLAGS} ${OBJDIR}/tmp2_${NAME}.o emul.o remoteinit.o ${RUMPCLIENT} ${DLFLAG} -o ${BINDIR}/${NAME}
${CC} ${CFLAGS} ${OBJDIR}/tmp2_${NAME}.o emul.o rumpclient.o remoteinit.o ${RUMPCLIENT} ${DLFLAG} -o ${BINDIR}/${NAME}

23 changes: 23 additions & 0 deletions rumpclient.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <rump/rumpclient.h>

int
emul__fork(void)
{
return rumpclient_fork();
}

int
emul__vfork14(void)
{
return rumpclient_fork();
}

extern char **environ;

int
emul_execve(const char *filename, char *const argv[], char *const envp[])
{

return rumpclient_exec(filename, argv, environ);
}

0 comments on commit b224951

Please sign in to comment.