Lines Matching full:args
16 template <typename... Args>
17 inline void Debug(WASI* wasi, Args&&... args) { in Debug() argument
18 Debug(wasi->env(), DebugCategory::WASI, std::forward<Args>(args)...); in Debug()
25 THROW_ERR_WASI_NOT_STARTED(Environment::GetCurrent(args)); \
30 #define RETURN_IF_BAD_ARG_COUNT(args, expected) \ argument
32 if ((args).Length() != (expected)) { \
33 (args).GetReturnValue().Set(UVWASI_EINVAL); \
38 #define CHECK_TO_TYPE_OR_RETURN(args, input, type, result) \ argument
41 (args).GetReturnValue().Set(UVWASI_EINVAL); \
47 #define UNWRAP_BIGINT_OR_RETURN(args, input, type, result) \ argument
50 (args).GetReturnValue().Set(UVWASI_EINVAL); \
58 #define GET_BACKING_STORE_OR_RETURN(wasi, args, mem_ptr, mem_size) \ argument
62 (args).GetReturnValue().Set(err); \
67 #define CHECK_BOUNDS_OR_RETURN(args, mem_size, offset, buf_size) \ argument
70 (args).GetReturnValue().Set(UVWASI_EOVERFLOW); \
162 void WASI::New(const FunctionCallbackInfo<Value>& args) { in New() argument
163 CHECK(args.IsConstructCall()); in New()
164 CHECK_EQ(args.Length(), 4); in New()
165 CHECK(args[0]->IsArray()); in New()
166 CHECK(args[1]->IsArray()); in New()
167 CHECK(args[2]->IsArray()); in New()
168 CHECK(args[3]->IsArray()); in New()
170 Environment* env = Environment::GetCurrent(args); in New()
172 Local<Array> argv = args[0].As<Array>(); in New()
178 Local<Array> stdio = args[3].As<Array>(); in New()
200 Local<Array> env_pairs = args[1].As<Array>(); in New()
212 Local<Array> preopens = args[2].As<Array>(); in New()
231 new WASI(env, args.This(), &options); in New()
256 void WASI::ArgsGet(const FunctionCallbackInfo<Value>& args) { in ArgsGet() argument
262 RETURN_IF_BAD_ARG_COUNT(args, 2); in ArgsGet()
263 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, argv_offset); in ArgsGet()
264 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, argv_buf_offset); in ArgsGet()
265 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in ArgsGet()
267 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in ArgsGet()
268 CHECK_BOUNDS_OR_RETURN(args, in ArgsGet()
272 CHECK_BOUNDS_OR_RETURN(args, in ArgsGet()
291 args.GetReturnValue().Set(err); in ArgsGet()
295 void WASI::ArgsSizesGet(const FunctionCallbackInfo<Value>& args) { in ArgsSizesGet() argument
301 RETURN_IF_BAD_ARG_COUNT(args, 2); in ArgsSizesGet()
302 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, argc_offset); in ArgsSizesGet()
303 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, argv_buf_offset); in ArgsSizesGet()
304 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in ArgsSizesGet()
306 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in ArgsSizesGet()
307 CHECK_BOUNDS_OR_RETURN(args, in ArgsSizesGet()
311 CHECK_BOUNDS_OR_RETURN(args, in ArgsSizesGet()
325 args.GetReturnValue().Set(err); in ArgsSizesGet()
329 void WASI::ClockResGet(const FunctionCallbackInfo<Value>& args) { in ClockResGet() argument
335 RETURN_IF_BAD_ARG_COUNT(args, 2); in ClockResGet()
336 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, clock_id); in ClockResGet()
337 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, resolution_ptr); in ClockResGet()
338 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in ClockResGet()
340 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in ClockResGet()
341 CHECK_BOUNDS_OR_RETURN(args, in ClockResGet()
352 args.GetReturnValue().Set(err); in ClockResGet()
356 void WASI::ClockTimeGet(const FunctionCallbackInfo<Value>& args) { in ClockTimeGet() argument
363 RETURN_IF_BAD_ARG_COUNT(args, 3); in ClockTimeGet()
364 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, clock_id); in ClockTimeGet()
365 UNWRAP_BIGINT_OR_RETURN(args, args[1], Uint64, precision); in ClockTimeGet()
366 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, time_ptr); in ClockTimeGet()
367 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in ClockTimeGet()
369 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in ClockTimeGet()
370 CHECK_BOUNDS_OR_RETURN(args, in ClockTimeGet()
382 args.GetReturnValue().Set(err); in ClockTimeGet()
386 void WASI::EnvironGet(const FunctionCallbackInfo<Value>& args) { in EnvironGet() argument
392 RETURN_IF_BAD_ARG_COUNT(args, 2); in EnvironGet()
393 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, environ_offset); in EnvironGet()
394 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, environ_buf_offset); in EnvironGet()
395 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in EnvironGet()
397 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in EnvironGet()
398 CHECK_BOUNDS_OR_RETURN(args, in EnvironGet()
402 CHECK_BOUNDS_OR_RETURN(args, in EnvironGet()
424 args.GetReturnValue().Set(err); in EnvironGet()
428 void WASI::EnvironSizesGet(const FunctionCallbackInfo<Value>& args) { in EnvironSizesGet() argument
434 RETURN_IF_BAD_ARG_COUNT(args, 2); in EnvironSizesGet()
435 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, envc_offset); in EnvironSizesGet()
436 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, env_buf_offset); in EnvironSizesGet()
437 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in EnvironSizesGet()
439 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in EnvironSizesGet()
440 CHECK_BOUNDS_OR_RETURN(args, in EnvironSizesGet()
444 CHECK_BOUNDS_OR_RETURN(args, in EnvironSizesGet()
458 args.GetReturnValue().Set(err); in EnvironSizesGet()
462 void WASI::FdAdvise(const FunctionCallbackInfo<Value>& args) { in FdAdvise() argument
468 RETURN_IF_BAD_ARG_COUNT(args, 4); in FdAdvise()
469 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdAdvise()
470 UNWRAP_BIGINT_OR_RETURN(args, args[1], Uint64, offset); in FdAdvise()
471 UNWRAP_BIGINT_OR_RETURN(args, args[2], Uint64, len); in FdAdvise()
472 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, advice); in FdAdvise()
473 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdAdvise()
476 args.GetReturnValue().Set(err); in FdAdvise()
480 void WASI::FdAllocate(const FunctionCallbackInfo<Value>& args) { in FdAllocate() argument
485 RETURN_IF_BAD_ARG_COUNT(args, 3); in FdAllocate()
486 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdAllocate()
487 UNWRAP_BIGINT_OR_RETURN(args, args[1], Uint64, offset); in FdAllocate()
488 UNWRAP_BIGINT_OR_RETURN(args, args[2], Uint64, len); in FdAllocate()
489 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdAllocate()
492 args.GetReturnValue().Set(err); in FdAllocate()
496 void WASI::FdClose(const FunctionCallbackInfo<Value>& args) { in FdClose() argument
499 RETURN_IF_BAD_ARG_COUNT(args, 1); in FdClose()
500 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdClose()
501 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdClose()
504 args.GetReturnValue().Set(err); in FdClose()
508 void WASI::FdDatasync(const FunctionCallbackInfo<Value>& args) { in FdDatasync() argument
511 RETURN_IF_BAD_ARG_COUNT(args, 1); in FdDatasync()
512 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdDatasync()
513 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdDatasync()
516 args.GetReturnValue().Set(err); in FdDatasync()
520 void WASI::FdFdstatGet(const FunctionCallbackInfo<Value>& args) { in FdFdstatGet() argument
526 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdFdstatGet()
527 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdFdstatGet()
528 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, buf); in FdFdstatGet()
529 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdFdstatGet()
531 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdFdstatGet()
532 CHECK_BOUNDS_OR_RETURN(args, mem_size, buf, UVWASI_SERDES_SIZE_fdstat_t); in FdFdstatGet()
539 args.GetReturnValue().Set(err); in FdFdstatGet()
543 void WASI::FdFdstatSetFlags(const FunctionCallbackInfo<Value>& args) { in FdFdstatSetFlags() argument
547 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdFdstatSetFlags()
548 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdFdstatSetFlags()
549 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, flags); in FdFdstatSetFlags()
550 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdFdstatSetFlags()
553 args.GetReturnValue().Set(err); in FdFdstatSetFlags()
557 void WASI::FdFdstatSetRights(const FunctionCallbackInfo<Value>& args) { in FdFdstatSetRights() argument
562 RETURN_IF_BAD_ARG_COUNT(args, 3); in FdFdstatSetRights()
563 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdFdstatSetRights()
564 UNWRAP_BIGINT_OR_RETURN(args, args[1], Uint64, fs_rights_base); in FdFdstatSetRights()
565 UNWRAP_BIGINT_OR_RETURN(args, args[2], Uint64, fs_rights_inheriting); in FdFdstatSetRights()
566 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdFdstatSetRights()
576 args.GetReturnValue().Set(err); in FdFdstatSetRights()
580 void WASI::FdFilestatGet(const FunctionCallbackInfo<Value>& args) { in FdFilestatGet() argument
586 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdFilestatGet()
587 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdFilestatGet()
588 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, buf); in FdFilestatGet()
589 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdFilestatGet()
591 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdFilestatGet()
592 CHECK_BOUNDS_OR_RETURN(args, mem_size, buf, UVWASI_SERDES_SIZE_filestat_t); in FdFilestatGet()
599 args.GetReturnValue().Set(err); in FdFilestatGet()
603 void WASI::FdFilestatSetSize(const FunctionCallbackInfo<Value>& args) { in FdFilestatSetSize() argument
607 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdFilestatSetSize()
608 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdFilestatSetSize()
609 UNWRAP_BIGINT_OR_RETURN(args, args[1], Uint64, st_size); in FdFilestatSetSize()
610 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdFilestatSetSize()
613 args.GetReturnValue().Set(err); in FdFilestatSetSize()
617 void WASI::FdFilestatSetTimes(const FunctionCallbackInfo<Value>& args) { in FdFilestatSetTimes() argument
623 RETURN_IF_BAD_ARG_COUNT(args, 4); in FdFilestatSetTimes()
624 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdFilestatSetTimes()
625 UNWRAP_BIGINT_OR_RETURN(args, args[1], Uint64, st_atim); in FdFilestatSetTimes()
626 UNWRAP_BIGINT_OR_RETURN(args, args[2], Uint64, st_mtim); in FdFilestatSetTimes()
627 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, fst_flags); in FdFilestatSetTimes()
628 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdFilestatSetTimes()
640 args.GetReturnValue().Set(err); in FdFilestatSetTimes()
644 void WASI::FdPread(const FunctionCallbackInfo<Value>& args) { in FdPread() argument
653 RETURN_IF_BAD_ARG_COUNT(args, 5); in FdPread()
654 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdPread()
655 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, iovs_ptr); in FdPread()
656 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, iovs_len); in FdPread()
657 UNWRAP_BIGINT_OR_RETURN(args, args[3], Uint64, offset); in FdPread()
658 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, nread_ptr); in FdPread()
659 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdPread()
667 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdPread()
668 CHECK_BOUNDS_OR_RETURN(args, in FdPread()
672 CHECK_BOUNDS_OR_RETURN(args, mem_size, nread_ptr, UVWASI_SERDES_SIZE_size_t); in FdPread()
682 args.GetReturnValue().Set(err); in FdPread()
691 args.GetReturnValue().Set(err); in FdPread()
695 void WASI::FdPrestatGet(const FunctionCallbackInfo<Value>& args) { in FdPrestatGet() argument
701 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdPrestatGet()
702 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdPrestatGet()
703 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, buf); in FdPrestatGet()
704 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdPrestatGet()
706 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdPrestatGet()
707 CHECK_BOUNDS_OR_RETURN(args, mem_size, buf, UVWASI_SERDES_SIZE_prestat_t); in FdPrestatGet()
714 args.GetReturnValue().Set(err); in FdPrestatGet()
718 void WASI::FdPrestatDirName(const FunctionCallbackInfo<Value>& args) { in FdPrestatDirName() argument
725 RETURN_IF_BAD_ARG_COUNT(args, 3); in FdPrestatDirName()
726 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdPrestatDirName()
727 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, path_ptr); in FdPrestatDirName()
728 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_len); in FdPrestatDirName()
729 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdPrestatDirName()
731 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdPrestatDirName()
732 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in FdPrestatDirName()
737 args.GetReturnValue().Set(err); in FdPrestatDirName()
741 void WASI::FdPwrite(const FunctionCallbackInfo<Value>& args) { in FdPwrite() argument
750 RETURN_IF_BAD_ARG_COUNT(args, 5); in FdPwrite()
751 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdPwrite()
752 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, iovs_ptr); in FdPwrite()
753 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, iovs_len); in FdPwrite()
754 UNWRAP_BIGINT_OR_RETURN(args, args[3], Uint64, offset); in FdPwrite()
755 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, nwritten_ptr); in FdPwrite()
756 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdPwrite()
764 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdPwrite()
765 CHECK_BOUNDS_OR_RETURN(args, in FdPwrite()
769 CHECK_BOUNDS_OR_RETURN(args, in FdPwrite()
782 args.GetReturnValue().Set(err); in FdPwrite()
796 args.GetReturnValue().Set(err); in FdPwrite()
800 void WASI::FdRead(const FunctionCallbackInfo<Value>& args) { in FdRead() argument
808 RETURN_IF_BAD_ARG_COUNT(args, 4); in FdRead()
809 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdRead()
810 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, iovs_ptr); in FdRead()
811 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, iovs_len); in FdRead()
812 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, nread_ptr); in FdRead()
813 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdRead()
815 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdRead()
816 CHECK_BOUNDS_OR_RETURN(args, in FdRead()
820 CHECK_BOUNDS_OR_RETURN(args, mem_size, nread_ptr, UVWASI_SERDES_SIZE_size_t); in FdRead()
830 args.GetReturnValue().Set(err); in FdRead()
839 args.GetReturnValue().Set(err); in FdRead()
843 void WASI::FdReaddir(const FunctionCallbackInfo<Value>& args) { in FdReaddir() argument
852 RETURN_IF_BAD_ARG_COUNT(args, 5); in FdReaddir()
853 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdReaddir()
854 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, buf_ptr); in FdReaddir()
855 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, buf_len); in FdReaddir()
856 UNWRAP_BIGINT_OR_RETURN(args, args[3], Uint64, cookie); in FdReaddir()
857 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, bufused_ptr); in FdReaddir()
858 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdReaddir()
866 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdReaddir()
867 CHECK_BOUNDS_OR_RETURN(args, mem_size, buf_ptr, buf_len); in FdReaddir()
868 CHECK_BOUNDS_OR_RETURN(args, in FdReaddir()
882 args.GetReturnValue().Set(err); in FdReaddir()
886 void WASI::FdRenumber(const FunctionCallbackInfo<Value>& args) { in FdRenumber() argument
890 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdRenumber()
891 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, from); in FdRenumber()
892 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, to); in FdRenumber()
893 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdRenumber()
896 args.GetReturnValue().Set(err); in FdRenumber()
900 void WASI::FdSeek(const FunctionCallbackInfo<Value>& args) { in FdSeek() argument
908 RETURN_IF_BAD_ARG_COUNT(args, 4); in FdSeek()
909 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdSeek()
910 UNWRAP_BIGINT_OR_RETURN(args, args[1], Int64, offset); in FdSeek()
911 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, whence); in FdSeek()
912 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, newoffset_ptr); in FdSeek()
913 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdSeek()
915 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdSeek()
916 CHECK_BOUNDS_OR_RETURN(args, in FdSeek()
929 args.GetReturnValue().Set(err); in FdSeek()
933 void WASI::FdSync(const FunctionCallbackInfo<Value>& args) { in FdSync() argument
936 RETURN_IF_BAD_ARG_COUNT(args, 1); in FdSync()
937 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdSync()
938 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdSync()
941 args.GetReturnValue().Set(err); in FdSync()
945 void WASI::FdTell(const FunctionCallbackInfo<Value>& args) { in FdTell() argument
951 RETURN_IF_BAD_ARG_COUNT(args, 2); in FdTell()
952 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdTell()
953 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, offset_ptr); in FdTell()
954 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdTell()
956 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdTell()
957 CHECK_BOUNDS_OR_RETURN(args, in FdTell()
967 args.GetReturnValue().Set(err); in FdTell()
971 void WASI::FdWrite(const FunctionCallbackInfo<Value>& args) { in FdWrite() argument
979 RETURN_IF_BAD_ARG_COUNT(args, 4); in FdWrite()
980 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in FdWrite()
981 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, iovs_ptr); in FdWrite()
982 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, iovs_len); in FdWrite()
983 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, nwritten_ptr); in FdWrite()
984 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in FdWrite()
991 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in FdWrite()
992 CHECK_BOUNDS_OR_RETURN(args, in FdWrite()
996 CHECK_BOUNDS_OR_RETURN(args, in FdWrite()
1009 args.GetReturnValue().Set(err); in FdWrite()
1018 args.GetReturnValue().Set(err); in FdWrite()
1022 void WASI::PathCreateDirectory(const FunctionCallbackInfo<Value>& args) { in PathCreateDirectory() argument
1029 RETURN_IF_BAD_ARG_COUNT(args, 3); in PathCreateDirectory()
1030 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in PathCreateDirectory()
1031 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, path_ptr); in PathCreateDirectory()
1032 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_len); in PathCreateDirectory()
1033 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathCreateDirectory()
1035 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathCreateDirectory()
1036 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathCreateDirectory()
1041 args.GetReturnValue().Set(err); in PathCreateDirectory()
1045 void WASI::PathFilestatGet(const FunctionCallbackInfo<Value>& args) { in PathFilestatGet() argument
1054 RETURN_IF_BAD_ARG_COUNT(args, 5); in PathFilestatGet()
1055 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in PathFilestatGet()
1056 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, flags); in PathFilestatGet()
1057 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_ptr); in PathFilestatGet()
1058 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, path_len); in PathFilestatGet()
1059 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, buf_ptr); in PathFilestatGet()
1060 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathFilestatGet()
1066 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathFilestatGet()
1067 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathFilestatGet()
1068 CHECK_BOUNDS_OR_RETURN(args, in PathFilestatGet()
1082 args.GetReturnValue().Set(err); in PathFilestatGet()
1086 void WASI::PathFilestatSetTimes(const FunctionCallbackInfo<Value>& args) { in PathFilestatSetTimes() argument
1097 RETURN_IF_BAD_ARG_COUNT(args, 7); in PathFilestatSetTimes()
1098 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in PathFilestatSetTimes()
1099 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, flags); in PathFilestatSetTimes()
1100 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_ptr); in PathFilestatSetTimes()
1101 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, path_len); in PathFilestatSetTimes()
1102 UNWRAP_BIGINT_OR_RETURN(args, args[4], Uint64, st_atim); in PathFilestatSetTimes()
1103 UNWRAP_BIGINT_OR_RETURN(args, args[5], Uint64, st_mtim); in PathFilestatSetTimes()
1104 CHECK_TO_TYPE_OR_RETURN(args, args[6], Uint32, fst_flags); in PathFilestatSetTimes()
1105 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathFilestatSetTimes()
1115 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathFilestatSetTimes()
1116 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathFilestatSetTimes()
1125 args.GetReturnValue().Set(err); in PathFilestatSetTimes()
1129 void WASI::PathLink(const FunctionCallbackInfo<Value>& args) { in PathLink() argument
1140 RETURN_IF_BAD_ARG_COUNT(args, 7); in PathLink()
1141 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, old_fd); in PathLink()
1142 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, old_flags); in PathLink()
1143 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, old_path_ptr); in PathLink()
1144 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, old_path_len); in PathLink()
1145 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, new_fd); in PathLink()
1146 CHECK_TO_TYPE_OR_RETURN(args, args[5], Uint32, new_path_ptr); in PathLink()
1147 CHECK_TO_TYPE_OR_RETURN(args, args[6], Uint32, new_path_len); in PathLink()
1148 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathLink()
1158 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathLink()
1159 CHECK_BOUNDS_OR_RETURN(args, mem_size, old_path_ptr, old_path_len); in PathLink()
1160 CHECK_BOUNDS_OR_RETURN(args, mem_size, new_path_ptr, new_path_len); in PathLink()
1169 args.GetReturnValue().Set(err); in PathLink()
1173 void WASI::PathOpen(const FunctionCallbackInfo<Value>& args) { in PathOpen() argument
1186 RETURN_IF_BAD_ARG_COUNT(args, 9); in PathOpen()
1187 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, dirfd); in PathOpen()
1188 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, dirflags); in PathOpen()
1189 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_ptr); in PathOpen()
1190 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, path_len); in PathOpen()
1191 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, o_flags); in PathOpen()
1192 UNWRAP_BIGINT_OR_RETURN(args, args[5], Uint64, fs_rights_base); in PathOpen()
1193 UNWRAP_BIGINT_OR_RETURN(args, args[6], Uint64, fs_rights_inheriting); in PathOpen()
1194 CHECK_TO_TYPE_OR_RETURN(args, args[7], Uint32, fs_flags); in PathOpen()
1195 CHECK_TO_TYPE_OR_RETURN(args, args[8], Uint32, fd_ptr); in PathOpen()
1196 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathOpen()
1208 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathOpen()
1209 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathOpen()
1210 CHECK_BOUNDS_OR_RETURN(args, mem_size, fd_ptr, UVWASI_SERDES_SIZE_fd_t); in PathOpen()
1225 args.GetReturnValue().Set(err); in PathOpen()
1229 void WASI::PathReadlink(const FunctionCallbackInfo<Value>& args) { in PathReadlink() argument
1239 RETURN_IF_BAD_ARG_COUNT(args, 6); in PathReadlink()
1240 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in PathReadlink()
1241 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, path_ptr); in PathReadlink()
1242 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_len); in PathReadlink()
1243 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, buf_ptr); in PathReadlink()
1244 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, buf_len); in PathReadlink()
1245 CHECK_TO_TYPE_OR_RETURN(args, args[5], Uint32, bufused_ptr); in PathReadlink()
1246 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathReadlink()
1255 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathReadlink()
1256 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathReadlink()
1257 CHECK_BOUNDS_OR_RETURN(args, mem_size, buf_ptr, buf_len); in PathReadlink()
1258 CHECK_BOUNDS_OR_RETURN(args, in PathReadlink()
1273 args.GetReturnValue().Set(err); in PathReadlink()
1277 void WASI::PathRemoveDirectory(const FunctionCallbackInfo<Value>& args) { in PathRemoveDirectory() argument
1284 RETURN_IF_BAD_ARG_COUNT(args, 3); in PathRemoveDirectory()
1285 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in PathRemoveDirectory()
1286 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, path_ptr); in PathRemoveDirectory()
1287 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_len); in PathRemoveDirectory()
1288 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathRemoveDirectory()
1290 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathRemoveDirectory()
1291 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathRemoveDirectory()
1296 args.GetReturnValue().Set(err); in PathRemoveDirectory()
1300 void WASI::PathRename(const FunctionCallbackInfo<Value>& args) { in PathRename() argument
1310 RETURN_IF_BAD_ARG_COUNT(args, 6); in PathRename()
1311 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, old_fd); in PathRename()
1312 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, old_path_ptr); in PathRename()
1313 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, old_path_len); in PathRename()
1314 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, new_fd); in PathRename()
1315 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, new_path_ptr); in PathRename()
1316 CHECK_TO_TYPE_OR_RETURN(args, args[5], Uint32, new_path_len); in PathRename()
1317 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathRename()
1326 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathRename()
1327 CHECK_BOUNDS_OR_RETURN(args, mem_size, old_path_ptr, old_path_len); in PathRename()
1328 CHECK_BOUNDS_OR_RETURN(args, mem_size, new_path_ptr, new_path_len); in PathRename()
1336 args.GetReturnValue().Set(err); in PathRename()
1340 void WASI::PathSymlink(const FunctionCallbackInfo<Value>& args) { in PathSymlink() argument
1349 RETURN_IF_BAD_ARG_COUNT(args, 5); in PathSymlink()
1350 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, old_path_ptr); in PathSymlink()
1351 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, old_path_len); in PathSymlink()
1352 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, fd); in PathSymlink()
1353 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, new_path_ptr); in PathSymlink()
1354 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, new_path_len); in PathSymlink()
1355 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathSymlink()
1363 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathSymlink()
1364 CHECK_BOUNDS_OR_RETURN(args, mem_size, old_path_ptr, old_path_len); in PathSymlink()
1365 CHECK_BOUNDS_OR_RETURN(args, mem_size, new_path_ptr, new_path_len); in PathSymlink()
1372 args.GetReturnValue().Set(err); in PathSymlink()
1376 void WASI::PathUnlinkFile(const FunctionCallbackInfo<Value>& args) { in PathUnlinkFile() argument
1383 RETURN_IF_BAD_ARG_COUNT(args, 3); in PathUnlinkFile()
1384 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, fd); in PathUnlinkFile()
1385 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, path_ptr); in PathUnlinkFile()
1386 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, path_len); in PathUnlinkFile()
1387 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PathUnlinkFile()
1389 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PathUnlinkFile()
1390 CHECK_BOUNDS_OR_RETURN(args, mem_size, path_ptr, path_len); in PathUnlinkFile()
1395 args.GetReturnValue().Set(err); in PathUnlinkFile()
1399 void WASI::PollOneoff(const FunctionCallbackInfo<Value>& args) { in PollOneoff() argument
1407 RETURN_IF_BAD_ARG_COUNT(args, 4); in PollOneoff()
1408 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, in_ptr); in PollOneoff()
1409 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, out_ptr); in PollOneoff()
1410 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, nsubscriptions); in PollOneoff()
1411 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, nevents_ptr); in PollOneoff()
1412 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in PollOneoff()
1419 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in PollOneoff()
1420 CHECK_BOUNDS_OR_RETURN(args, in PollOneoff()
1424 CHECK_BOUNDS_OR_RETURN(args, in PollOneoff()
1428 CHECK_BOUNDS_OR_RETURN(args, in PollOneoff()
1455 args.GetReturnValue().Set(err); in PollOneoff()
1459 void WASI::ProcExit(const FunctionCallbackInfo<Value>& args) { in ProcExit() argument
1462 RETURN_IF_BAD_ARG_COUNT(args, 1); in ProcExit()
1463 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, code); in ProcExit()
1464 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in ProcExit()
1466 args.GetReturnValue().Set(uvwasi_proc_exit(&wasi->uvw_, code)); in ProcExit()
1470 void WASI::ProcRaise(const FunctionCallbackInfo<Value>& args) { in ProcRaise() argument
1473 RETURN_IF_BAD_ARG_COUNT(args, 1); in ProcRaise()
1474 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, sig); in ProcRaise()
1475 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in ProcRaise()
1478 args.GetReturnValue().Set(err); in ProcRaise()
1482 void WASI::RandomGet(const FunctionCallbackInfo<Value>& args) { in RandomGet() argument
1488 RETURN_IF_BAD_ARG_COUNT(args, 2); in RandomGet()
1489 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, buf_ptr); in RandomGet()
1490 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, buf_len); in RandomGet()
1491 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in RandomGet()
1493 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in RandomGet()
1494 CHECK_BOUNDS_OR_RETURN(args, mem_size, buf_ptr, buf_len); in RandomGet()
1498 args.GetReturnValue().Set(err); in RandomGet()
1502 void WASI::SchedYield(const FunctionCallbackInfo<Value>& args) { in SchedYield() argument
1504 RETURN_IF_BAD_ARG_COUNT(args, 0); in SchedYield()
1505 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in SchedYield()
1508 args.GetReturnValue().Set(err); in SchedYield()
1512 void WASI::SockRecv(const FunctionCallbackInfo<Value>& args) { in SockRecv() argument
1522 RETURN_IF_BAD_ARG_COUNT(args, 6); in SockRecv()
1523 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, sock); in SockRecv()
1524 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, ri_data_ptr); in SockRecv()
1525 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, ri_data_len); in SockRecv()
1526 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, ri_flags); in SockRecv()
1527 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, ro_datalen_ptr); in SockRecv()
1528 CHECK_TO_TYPE_OR_RETURN(args, args[5], Uint32, ro_flags_ptr); in SockRecv()
1529 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in SockRecv()
1538 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in SockRecv()
1539 CHECK_BOUNDS_OR_RETURN(args, in SockRecv()
1543 CHECK_BOUNDS_OR_RETURN(args, mem_size, ro_datalen_ptr, 4); in SockRecv()
1544 CHECK_BOUNDS_OR_RETURN(args, mem_size, ro_flags_ptr, 4); in SockRecv()
1552 args.GetReturnValue().Set(err); in SockRecv()
1570 args.GetReturnValue().Set(err); in SockRecv()
1574 void WASI::SockSend(const FunctionCallbackInfo<Value>& args) { in SockSend() argument
1583 RETURN_IF_BAD_ARG_COUNT(args, 5); in SockSend()
1584 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, sock); in SockSend()
1585 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, si_data_ptr); in SockSend()
1586 CHECK_TO_TYPE_OR_RETURN(args, args[2], Uint32, si_data_len); in SockSend()
1587 CHECK_TO_TYPE_OR_RETURN(args, args[3], Uint32, si_flags); in SockSend()
1588 CHECK_TO_TYPE_OR_RETURN(args, args[4], Uint32, so_datalen_ptr); in SockSend()
1589 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in SockSend()
1597 GET_BACKING_STORE_OR_RETURN(wasi, args, &memory, &mem_size); in SockSend()
1598 CHECK_BOUNDS_OR_RETURN(args, in SockSend()
1602 CHECK_BOUNDS_OR_RETURN(args, in SockSend()
1613 args.GetReturnValue().Set(err); in SockSend()
1627 args.GetReturnValue().Set(err); in SockSend()
1631 void WASI::SockShutdown(const FunctionCallbackInfo<Value>& args) { in SockShutdown() argument
1635 RETURN_IF_BAD_ARG_COUNT(args, 2); in SockShutdown()
1636 CHECK_TO_TYPE_OR_RETURN(args, args[0], Uint32, sock); in SockShutdown()
1637 CHECK_TO_TYPE_OR_RETURN(args, args[1], Uint32, how); in SockShutdown()
1638 ASSIGN_INITIALIZED_OR_RETURN_UNWRAP(&wasi, args.This()); in SockShutdown()
1641 args.GetReturnValue().Set(err); in SockShutdown()
1645 void WASI::_SetMemory(const FunctionCallbackInfo<Value>& args) { in _SetMemory() argument
1647 CHECK_EQ(args.Length(), 1); in _SetMemory()
1648 CHECK(args[0]->IsObject()); in _SetMemory()
1649 ASSIGN_OR_RETURN_UNWRAP(&wasi, args.This()); in _SetMemory()
1650 wasi->memory_.Reset(wasi->env()->isolate(), args[0].As<Object>()); in _SetMemory()