некотрые фиксы ipc (но всеравное всрато работаетЖ не работает)

This commit is contained in:
Egor00f committed 2025-05-18 15:05:26 +05:00
1 parent 521d00fdb8
commit 5e441a984f
8 files changed
+88 -41

No files matched your search

+11 -2
View File
@@ -4,23 +4,32 @@
local syscalls = require("syscalls")
-- Enable IPC event only
syscalls.SetEventMask(1 << (syscalls.Event.IPC - 1))
-- write pid to /tmp0/1/lua_test_ipc_pid
local pid = syscalls.ThreadInfo().PID
local f = io.open("/tmp0/1/lua_test_ipc_pid", "w")
if f then
f:write(pid)
f:write(pid);
f:close()
end
------------
local buffer = syscalls.DefineIPCBuffer(4096)
syscalls.IPC_buffer.Unlock(buffer)
while true do
print("buffer:", buffer.used .. '/' .. buffer.size, "Locked:" .. tostring(buffer.lock))
if syscalls.WaitEvent() == syscalls.Event.IPC then
print(buffer:GetLastMessage())
syscalls.IPC_buffer.Lock(buffer)
print("message:", syscalls.IPC_buffer.GetLastMessage(buffer))
syscalls.IPC_buffer.Unlock(buffer)
end
end
+2 -1
View File
@@ -15,6 +15,7 @@ end
if pid then
while true do
print(syscalls.SendIPCMessage(pid, syscalls.IPC_msg.fromString("Test aboba")))
local msg = syscalls.IPC_msg.fromString("Test aboba", pid)
print("Send:", msg, "State:", syscalls.SendIPCMessage(msg))
end
end