syscall-napi 0.0.1 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/basic.js CHANGED
@@ -5,9 +5,13 @@ import assert from "assert";
5
5
  import sys from "../lib/index.js";
6
6
 
7
7
  describe("basic", () => {
8
- it("should run getpid() correctly", async () => {
9
- // console.log("sys =", sys);
8
+ it("should run getpid() correctly [async]", async () => {
10
9
  const pid = await sys.syscall(sys.__NR_getpid);
11
10
  assert.equal(pid, process.pid);
12
11
  });
12
+
13
+ it("should run getpid() correctly [sync]", () => {
14
+ const pid = sys.syscall.sync(sys.__NR_getpid);
15
+ assert.equal(pid, process.pid);
16
+ });
13
17
  });
@@ -1,39 +0,0 @@
1
- name: CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- tests:
7
- runs-on: ubuntu-latest
8
- name: tests
9
-
10
- strategy:
11
- matrix:
12
- arch: [ amd64, arm64v8, arm32v7 ]
13
- node: [ 12, 13, 14, 15 ]
14
- fail-fast: false
15
-
16
- steps:
17
- - uses: actions/checkout@v2
18
- - uses: actions/setup-node@v2-beta
19
- with:
20
- node-version: '15'
21
- - uses: docker/setup-qemu-action@v1
22
- - name: Install dependencies
23
- run: npm install
24
- - name: Run tests
25
- run: node_modules/.bin/archibald -p -a ${{ matrix.arch }} -n ${{ matrix.node }} .
26
-
27
- linter:
28
- runs-on: ubuntu-latest
29
- name: linter
30
-
31
- steps:
32
- - uses: actions/checkout@v2
33
- - uses: actions/setup-node@v2-beta
34
- with:
35
- node-version: '15'
36
- - name: Install dependencies
37
- run: npm install
38
- - name: Verify code with ESLint
39
- run: npm run eslint
package/generate.js DELETED
@@ -1,14 +0,0 @@
1
- import data from "./table.js";
2
-
3
- Object.keys(data).forEach((key) => {
4
- const sc = data[key];
5
- // console.log("sc =", sc);
6
- const name = sc[2];
7
- if (!name) {
8
- return;
9
- }
10
-
11
- const normalizedName = name.replace("sys_", "SYS_");
12
- // console.log("name =", normalizedName);
13
- console.log(`DEF_SYS_CONSTANT(env, constants, ${normalizedName});`);
14
- });
package/generate2.js DELETED
@@ -1,24 +0,0 @@
1
- import fs from "fs";
2
-
3
- process.nextTick(async () => {
4
- const content = await fs.promises.readFile("unistd.h", "utf8");
5
-
6
- const parts = content.split(/[\s),]/);
7
- const filtered = parts.filter((part) => part.startsWith("__NR_"));
8
- const constants = filtered.map((part) => {
9
- // return `SYS_${part.substr("sys_".length)}`;
10
- return part;
11
- });
12
-
13
- let nodup = [];
14
- constants.forEach((c) => {
15
- if (nodup.indexOf(c) < 0) {
16
- nodup = [...nodup, c];
17
- }
18
- });
19
-
20
- nodup.forEach((c) => {
21
- console.log(`DEF_SYS_CONSTANT(env, target, ${c});`);
22
- });
23
- // console.log("filtered =", filtered);
24
- });