forked from justincormack/ljsyscall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syscall.lua
38 lines (23 loc) · 1.23 KB
/
syscall.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- this file now does very little, just makes some modifications to syscalls
-- TODO want to try to remove everything from here
local abi = require "syscall.abi"
require("syscall." .. abi.os .. ".ffitypes").init(abi)
require "syscall.ffifunctions"
local c = require("syscall." .. abi.os .. ".constants")
local errors = require("syscall." .. abi.os .. ".errors")
local ostypes = require("syscall." .. abi.os .. ".types")
local types = require "syscall.types".init(abi, c, errors, ostypes, nil) -- nil is not rump
local t, pt, s = types.t, types.pt, types.s
local C = require("syscall." .. abi.os .. ".c").init(abi, c, types)
local ioctl = require("syscall." .. abi.os .. ".ioctl")(abi, s) -- TODO add init fn
local fcntl = require("syscall." .. abi.os .. ".fcntl")(abi, c, types) -- TODO add init fn
local S = require "syscall.syscalls".init(abi, c, C, types, ioctl, fcntl)
c.IOCTL = ioctl -- cannot put in S, needed for tests, cannot be put in c earlier due to deps
S.abi, S.c, S.C, S.types, S.t = abi, c, C, types, t -- add to main table returned
-- add functions from libc
S = require "syscall.libc".init(S)
-- add methods
S = require "syscall.methods".init(S)
-- add feature tests
S.features = require "syscall.features".init(S)
return S