-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mount #1
Conversation
@@ -460,6 +461,18 @@ static JSValue syscall_current_memory(JSContext *ctx, JSValueConst this_value, i | |||
return JS_NewUint32(ctx, (uint32_t)size); | |||
} | |||
|
|||
static JSValue mount(JSContext *ctx, JSValueConst this_value, int argc, JSValueConst *argv) { | |||
JSValue buf = syscall_load_cell_data(ctx, this_value, argc, argv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check buf is valid.
quickjs/ckb_module.c
Outdated
@@ -501,6 +514,8 @@ int js_init_module_ckb(JSContext *ctx) { | |||
JS_NewCFunction(ctx, syscall_get_memory_limit, "get_memory_limit", 0)); | |||
JS_SetPropertyStr(ctx, ckb, "current_memory", | |||
JS_NewCFunction(ctx, syscall_current_memory, "current_memory", 0)); | |||
JS_SetPropertyStr(ctx, ckb, "mount", | |||
JS_NewCFunction(ctx, mount, "mount", 3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mount has only 2 arguments.
quickjs/qjs.c
Outdated
@@ -304,18 +318,23 @@ int main(int argc, const char **argv) { | |||
switch (type) { | |||
case RunJsWithCode: | |||
err = eval_buf(ctx, argv[1], strlen(argv[1]), "<cmdline>", 0); | |||
js_std_loop(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When error occurs, no need to continue.
@@ -0,0 +1,11 @@ | |||
/* example of JS module */ | |||
|
|||
ckb.mount(2, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ckb
consts. e.g. ckb.SOURCE_INPUT
.
Don't forget updating the document in docs/syscalls.md. |
No description provided.