MCPcopy Index your code
hub / github.com/sql-js/sql.js / ___syscall221

Function ___syscall221

js/sql-debug.js:4787–4839  ·  view source on GitHub ↗
(which, varargs)

Source from the content-addressed store, hash-verified

4785 }
4786
4787 function ___syscall221(which, varargs) {SYSCALLS.varargs = varargs;
4788 try {
4789 // fcntl64
4790 var stream = SYSCALLS.getStreamFromFD(), cmd = SYSCALLS.get();
4791 switch (cmd) {
4792 case 0: {
4793 var arg = SYSCALLS.get();
4794 if (arg < 0) {
4795 return -ERRNO_CODES.EINVAL;
4796 }
4797 var newStream;
4798 newStream = FS.open(stream.path, stream.flags, 0, arg);
4799 return newStream.fd;
4800 }
4801 case 1:
4802 case 2:
4803 return 0; // FD_CLOEXEC makes no sense for a single process.
4804 case 3:
4805 return stream.flags;
4806 case 4: {
4807 var arg = SYSCALLS.get();
4808 stream.flags |= arg;
4809 return 0;
4810 }
4811 case 12:
4812 case 12: {
4813 var arg = SYSCALLS.get();
4814 var offset = 0;
4815 // We're always unlocked.
4816 HEAP16[(((arg)+(offset))>>1)]=2;
4817 return 0;
4818 }
4819 case 13:
4820 case 14:
4821 case 13:
4822 case 14:
4823 return 0; // Pretend that the locking is successful.
4824 case 16:
4825 case 8:
4826 return -ERRNO_CODES.EINVAL; // These are for sockets. We don't have them fully implemented yet.
4827 case 9:
4828 // musl trusts getown return values, due to a bug where they must be, as they overlap with errors. just return -1 here, so fnctl() returns that, and we set errno ourselves.
4829 ___setErrNo(ERRNO_CODES.EINVAL);
4830 return -1;
4831 default: {
4832 return -ERRNO_CODES.EINVAL;
4833 }
4834 }
4835 } catch (e) {
4836 if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
4837 return -e.errno;
4838 }
4839 }
4840
4841 function ___syscall3(which, varargs) {SYSCALLS.varargs = varargs;
4842 try {

Callers 5

_fstatFunction · 0.70
_fcntlFunction · 0.70
_openFunction · 0.70
_fchownFunction · 0.70
_fchmodFunction · 0.70

Calls 2

___setErrNoFunction · 0.70
abortFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…