gluon-core: remove unused lock and exec functions

This commit is contained in:
Matthias Schiffer 2018-02-25 07:06:08 +01:00
parent 987eef011a
commit 5dcb784308
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -13,16 +13,6 @@ local function do_filter_prefix(input, output, prefix)
return f
end
local function close_stdio(stream, mode)
local null = nixio.open('/dev/null', mode)
if null then
nixio.dup(null, nixio[stream])
if null:fileno() > 2 then
null:close()
end
end
end
local io = io
local os = os
@ -76,23 +66,6 @@ function remove_from_set(t, itm)
return changed
end
function exec(...)
local pid, errno, error = nixio.fork()
if pid == 0 then
close_stdio('stdin', 'r')
close_stdio('stdout', 'w')
close_stdio('stderr', 'w')
nixio.execp(...)
os.exit(127)
elseif pid > 0 then
local wpid, status, code = nixio.waitpid(pid)
return wpid and status == 'exited' and code
else
return nil, errno, error
end
end
-- Removes all lines starting with a prefix from a file, optionally adding a new one
function replace_prefix(file, prefix, add)
local tmp = file .. '.tmp'
@ -110,14 +83,6 @@ function readline(fd)
return line
end
function lock(file)
exec('lock', file)
end
function unlock(file)
exec('lock', '-u', file)
end
function node_id()
return string.gsub(sysconfig.primary_mac, ':', '')
end