{"id":30180957,"url":"https://github.com/streamich/libsys","last_synced_at":"2025-08-30T20:09:53.395Z","repository":{"id":24215244,"uuid":"100887397","full_name":"streamich/libsys","owner":"streamich","description":"POSIX/Linux/Mac system calls and low level operations for Node.js","archived":false,"fork":false,"pushed_at":"2025-08-27T05:39:50.000Z","size":299,"stargazers_count":49,"open_issues_count":7,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-27T07:04:22.947Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/libsys","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"streamich"}},"created_at":"2017-08-20T20:36:53.000Z","updated_at":"2025-08-26T22:10:50.000Z","dependencies_parsed_at":"2024-02-09T02:27:39.914Z","dependency_job_id":"7cae46a8-16ca-4002-ab15-fbc165863138","html_url":"https://github.com/streamich/libsys","commit_stats":{"total_commits":597,"total_committers":4,"mean_commits":149.25,"dds":"0.40536013400335014","last_synced_commit":"0e18f5a4977255624d11ff62187993e0462c1ebb"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/libsys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibsys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibsys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibsys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibsys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/libsys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Flibsys/sbom","scorecard":{"id":854951,"data":{"date":"2025-08-11","repo":{"name":"github.com/streamich/libsys","commit":"da54519381880cbaeb123ff72a3524cce41a4b1e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":10,"reason":"27 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating ubuntu:cosmic-20190719 to ubuntu:cosmic-20190719@sha256:7d657275047118bb77b052c4c0ae43e8a289ca2879ebfa78a703c93aa8fd686c","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: The Unlicense: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T23:39:29.455Z","repository_id":24215244,"created_at":"2025-08-23T23:39:29.455Z","updated_at":"2025-08-23T23:39:29.455Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272900157,"owners_count":25012033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T08:06:16.241Z","updated_at":"2025-08-30T20:09:53.386Z","avatar_url":"https://github.com/streamich.png","language":"C++","funding_links":["https://github.com/sponsors/streamich"],"categories":[],"sub_categories":[],"readme":"# libsys\r\n\r\n[![][npm-badge]][npm-url] [![][travis-badge]][travis-url]\r\n\r\n  - Execute [Linux](https://filippo.io/linux-syscall-table/)/[Mac](https://opensource.apple.com/source/xnu/xnu-1504.3.12/bsd/kern/syscalls.master) `syscall`s from Node.js\r\n  - Get memory address of `Buffer`, `ArrayBuffer`, `TypedArray`\r\n  - Call arbitrary machine code from Node.js\r\n  - Create machine code trampolines that will call Node.js functions\r\n\r\n\r\n## Installation\r\n\r\n```shell\r\nnpm install libsys\r\n```\r\n\r\nCompiles on Linux, Mac and Windows ([in WSL process](https://docs.microsoft.com/en-us/windows/wsl/install-win10)).\r\n\r\n\r\n## Usage\r\n\r\nPrint `Hello world` to console\r\n\r\n```js\r\nconst libsys = require('libsys');\r\n\r\nconst STDOUT = 1;\r\nconst isMac = process.platform === 'darwin';\r\nconst SYS_write = isMac ? 0x2000004 : 1;\r\nconst buf = Buffer.from('Hello world\\n');\r\n\r\nlibsys.syscall(SYS_write, STDOUT, buf, buf.length);\r\n```\r\n\r\n\r\n## More goodies\r\n\r\n  - [libjs](http://www.github.com/streamich/libjs) \u0026mdash; POSIX command implementation (`libc` in JavaScript).\r\n  - [bamboo](http://www.github.com/streamich/bamboo) \u0026mdash; Node.js clone in pure JavaScript.\r\n  - [jskernel](http://www.github.com/streamich/jskernel) \u0026mdash; proposal of Node in kernel space.\r\n  - [Assembler.js](http://www.github.com/streamich/ass-js) \u0026mdash; X86_64 assembler in JavaScript.\r\n\r\n\r\n## Reference\r\n\r\n  - [`syscall`](#syscall) \u0026mdash; Executes system call with varied type arguments, returns 32-bit result\r\n  - [`syscall64`](#syscall64) \u0026mdash; Executes system call with varied type arguments, return 64-bit result\r\n  - [`syscall_N`](#syscall_0) \u0026mdash; Executes system call with N `number` arguments, returns 32-bit result\r\n  - [`syscall64_N`](#syscall64_0) \u0026mdash; Executes system call with N `number` arguments, returns 64-bit result\r\n  - [`getAddressArrayBuffer`](#getaddressarraybuffer) \u0026mdash; Returns 64-bit address of `ArrayBuffer`\r\n  - [`getAddressTypedArray`](#getaddresstypedarray) \u0026mdash; Returns 64-bit address of `TypedArray` (including `Uint8Array`, etc..)\r\n  - [`getAddressBuffer`](#getaddressbuffer) \u0026mdash; Returns 64-bit address of Node's `Buffer`\r\n  - [`getAddress`](#getaddress) \u0026mdash; Returns 64-bit address of any buffer type\r\n  - [`frame`](#frame) \u0026mdash; Creates `ArrayBuffer` in the specified memory location\r\n  - [`call`](#call) \u0026mdash; Calls machine code at specified address with up to 10 arguments, returns 32-bit result\r\n  - [`call64`](#call64) \u0026mdash; Calls machine code at specified address with up to 10 arguments, returns 64-bit result\r\n  - [`call_0`](#call_0) \u0026mdash; Call machine code with no arguments\r\n  - `call_1`\r\n  - `call64_0`\r\n  - `call64_1`\r\n  - `jumper`\r\n  - `sigaction` - Executes `sigaction` system call\r\n  - `cmpxchg8` - Compare and exchange value at memory location\r\n  - `cmpxchg16` - Compare and exchange value at memory location\r\n  - `cmpxchg32` - Compare and exchange value at memory location\r\n\r\n### Arguments\r\n\r\nDifferent JavaScript types can be used as `Targ` argument in some functions. Here is how they are converted to 64-bit integers:\r\n\r\n```ts\r\ntype Targ = number | [number, number] | [number, number, number] | string | ArrayBuffer | TypedArray | Buffer;\r\n```\r\n\r\n - `number` is treated as 32-bit integer and gets extended to 64-bit integer;\r\n - `[number, number]` treated as a `[lo, hi]` tuple of two 32-bit integers, which are combined into 64-bit integer;\r\n - `[number, number, number]` treated as a `[lo, hi, offset]` tuple, same as above with the difference that `offset` is added to the resulting 64-bit integer;\r\n - `string` gets converted to C null-terminated string and 64-bit pointer created to the beginning of that string;\r\n - `ArrayBuffer`, `TypedArray`, `Buffer` 64-bit pointer to the beginning of data contents of those objects is created;\r\n\r\n\r\n### `syscall`\r\n\r\n```ts\r\nsyscall(command: number, ...args: Targ[]): number;\r\n```\r\n\r\n`syscall` accepts up to 6 command arguments `args`. See discussion on *Arguments*\r\nabove to see how JavaScript objects are converted to 64-bit integers.\r\n\r\n`syscall` returns a `number` which is the result returned by the kernel,\r\nnegative numbers usually represent an error.\r\n\r\n\r\n### `syscall64`\r\n\r\n```ts\r\nsyscall64(command: number, ...args: TArg[]): [number, number];\r\n```\r\n\r\nSame as `syscall`, but returns 64-bit result.\r\n\r\n\r\n### `syscall_0`\r\n\r\n```ts\r\nsyscall_0(command: number): number;\r\nsyscall_1(command: number, arg1: number): number;\r\nsyscall_2(command: number, arg1: number, arg2: number): number;\r\nsyscall_3(command: number, arg1: number, arg2: number, arg3: number): number;\r\nsyscall_4(command: number, arg1: number, arg2: number, arg3: number, arg4: number): number;\r\nsyscall_5(command: number, arg1: number, arg2: number, arg3: number, arg4: number, arg5: number): number;\r\nsyscall_6(command: number, arg1: number, arg2: number, arg3: number, arg4: number, arg5: number, arg6: number): number;\r\n```\r\n\r\nExecutes system calls and returns 32-bit result. Expects all arguments to be of type `number`.\r\n\r\n\r\n### `syscall64_0`\r\n\r\n```ts\r\nsyscall64_0(command: number): [number, number];\r\nsyscall64_1(command: number, arg1: number): [number, number];\r\nsyscall64_2(command: number, arg1: number, arg2: number): [number, number];\r\nsyscall64_3(command: number, arg1: number, arg2: number, arg3: number): [number, number];\r\nsyscall64_4(command: number, arg1: number, arg2: number, arg3: number, arg4: number): [number, number];\r\nsyscall64_5(command: number, arg1: number, arg2: number, arg3: number, arg4: number, arg5: number): [number, number];\r\nsyscall64_6(command: number, arg1: number, arg2: number, arg3: number, arg4: number, arg5: number, arg6: number): [number, number];\r\n```\r\n\r\nExecutes system calls and returns 64-bit result. Expects all arguments to be of type `number`.\r\n\r\n\r\n### `getAddressArrayBuffer`\r\n\r\n```ts\r\ngetAddressArrayBuffer(ab: ArrayBuffer): [number, number];\r\n```\r\n\r\n### `getAddressTypedArray`\r\n\r\n```ts\r\ngetAddressTypedArray(ta: TypedArray | Uint8Array): [number, number];\r\n```\r\n\r\n### `getAddressBuffer`\r\n\r\n```ts\r\ngetAddressBuffer(buf: Buffer): [number, number];\r\n```\r\n\r\nReturn memory address of `Buffer`'s data contents.\r\n\r\n\r\n### `getAddress`\r\n\r\n```ts\r\ngetAddress(buffer: Buffer | ArrayBuffer | TypedArray): [number, number];\r\n```\r\n\r\n### `frame`\r\n\r\n```ts\r\nframe(addresss: Targ, size: number): ArrayBuffer;\r\n```\r\n\r\n`frame` returns an `ArrayBuffer` object of size `size` that is mapped to memory location\r\nspecified in `addr` argument.\r\n\r\n\r\n### `call`\r\n\r\n```ts\r\ncall(address: Targ, offset?: number, arguments?: Targ[]);\r\n```\r\n\r\nExecute machine code at specified memory address `address`. The memory address is converted\r\nto function pointer and called using your architecture calling conventions. `offest` is added\r\nto the address, but defaults to 0.\r\n\r\nUp to 10 `arguments` can be supplied.\r\n\r\n\r\n### `call64`\r\n\r\nSame as `call` but ruturns a 64-bit `[number, number]`.\r\n\r\n\r\n### `call_0`\r\n\r\n```ts\r\ncall_0(address: Targ): number;\r\n```\r\n\r\nCall machine code at `address` without any arguments using architecture specific calling conventions. Returns a 32-bit result.\r\n\r\n\r\n## License\r\n\r\n[Unlicense](./LICENSE) - public domain.\r\n\r\n\r\n\r\n[npm-url]: https://www.npmjs.com/package/libsys\r\n[npm-badge]: https://img.shields.io/npm/v/libsys.svg\r\n[travis-url]: https://travis-ci.org/streamich/libsys\r\n[travis-badge]: https://travis-ci.org/streamich/libsys.svg?branch=master\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Flibsys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Flibsys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Flibsys/lists"}