working on 9p support

This commit is contained in:
Alex Shinn 2009-08-24 22:41:54 +09:00
parent d36e70f6bf
commit 386a1cdb0a
2 changed files with 50 additions and 1 deletions

18
opt/plan9-opcodes.c Normal file
View file

@ -0,0 +1,18 @@
_FN0("random-integer", 0, sexp_rand),
_FN1(SEXP_FIXNUM, "random-seed", 0, sexp_srand),
_FN0("current-directory", 0, sexp_getwd),
_FN0("current-user", 0, sexp_getuser),
_FN0("system-name", 0, sexp_sysname),
_FN1(SEXP_IPORT, "port-fileno", 0, sexp_fileno),
_FN2(SEXP_FIXNUM, SEXP_STRING, "fileno->port", 0, sexp_fdopen),
_FN0("fork", 0, sexp_fork),
_FN2(SEXP_STRING, SEXP_PAIR, "exec", 0, sexp_exec),
_FN1(SEXP_STRING, "exits", 0, sexp_exits),
_FN2(SEXP_FIXNUM, SEXP_FIXNUM, "dup", 0, sexp_dup),
_FN0("pipe", 0, sexp_pipe),
_FN1(SEXP_FIXNUM, "sleep", 0, sexp_sleep),
_FN1(SEXP_STRING, "getenv", 0, sexp_getenv),
_FN1(SEXP_STRING, "change-directory", 0, sexp_chdir),
_FN0("wait", 0, sexp_wait),
_FN2(SEXP_FIXNUM, SEXP_STRING, "post-note", 0, sexp_postnote),
_FN4(SEXP_PAIR, SEXP_STRING, "%postmountsrv", 0, sexp_postmountsrv),

View file

@ -277,7 +277,7 @@ sexp sexp_postmountsrv (sexp ctx, sexp ls, sexp name, sexp mtpt, sexp flags) {
Srv s; Srv s;
struct sexp_plan9_srv p9s; struct sexp_plan9_srv p9s;
if (! sexp_listp(ctx, ls)) if (! sexp_listp(ctx, ls))
return sexp_type_exception(ctx, "postmountsrv: not an list", ls); return sexp_type_exception(ctx, "postmountsrv: not a list", ls);
if (! sexp_stringp(name)) if (! sexp_stringp(name))
return sexp_type_exception(ctx, "postmountsrv: not a string", name); return sexp_type_exception(ctx, "postmountsrv: not a string", name);
if (! sexp_stringp(mtpt)) if (! sexp_stringp(mtpt))
@ -307,3 +307,34 @@ sexp sexp_postmountsrv (sexp ctx, sexp ls, sexp name, sexp mtpt, sexp flags) {
return SEXP_UNDEF; return SEXP_UNDEF;
} }
sexp sexp_9p_req_offset (sexp ctx, sexp req) {
return sexp_make_integer(ctx, (Req*)sexp_cpointer_value(req)->ifcall.offset);
}
sexp sexp_9p_req_count (sexp ctx, sexp req) {
return sexp_make_integer(ctx, (Req*)sexp_cpointer_value(req)->ifcall.count);
}
sexp sexp_9p_req_path (sexp ctx, sexp req) {
return sexp_c_string(ctx, (Req*)sexp_cpointer_value(req)->fid.qid.path, -1);
}
sexp sexp_9p_req_fid (sexp ctx, sexp req) {
return sexp_make_cpointer(ctx, (Req*)sexp_cpointer_value(req)->fid);
}
sexp sexp_9p_req_newfid (sexp ctx, sexp req) {
return sexp_make_cpointer(ctx, (Req*)sexp_cpointer_value(req)->newfid);
}
sexp sexp_9p_respond (sexp ctx, sexp req, sexp err) {
char *cerr = sexp_stringp(err) ? sexp_string_data(err) : nil;
respond(sexp_cpointer_value(req), cerr);
return SEXP_VOID;
}
sexp sexp_9p_responderror (sexp ctx, sexp req) {
responderror(sexp_cpointer_value(req));
return SEXP_VOID;
}