This file is indexed.

/usr/share/lua/5.1/cqueues/auxlib.lua is in lua-cqueues 20161214-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
local loader = function(loader, ...)
	local cqueues = require"_cqueues"
	local errno = require"_cqueues.errno"
	local auxlib = require"_cqueues.auxlib"
	local coroutine = require"coroutine"

	--
	-- auxlib.tostring
	--
	-- Yieldable tostring. Implemented in C for Lua 5.2 and above.
	--
	-- Lua 5.1 API doesn't allow us to implement a yieldable tostring
	-- routine. Fortunately, LuaJIT's tostring permits yielding.
	--
	auxlib.tostring = auxlib.tostring or tostring

	--
	-- auxlib.resume
	-- auxlib.wrap
	--
	-- Wrappers for multilevel coroutine management to allow I/O polling
	-- of coroutine-wrapped code. The code checks for a special value
	-- returned by cqueues.poll, and will propogate a yield on I/O.
	-- Everything else should behave as usual.
	--
	local _POLL = cqueues._POLL -- magic internal value
	local l_resume = coroutine.resume -- take reference to permit monkey patching
	local l_yield = coroutine.yield

	local function c_resume(co, ok, arg1, ...)
		if ok and arg1 == _POLL then
			return auxlib.resume(co, l_yield(_POLL, ...))
		else
			return ok, arg1, ...
		end
	end -- c_resume

	function auxlib.resume(co, ...)
		return c_resume(co, l_resume(co, ...))
	end -- auxlib.resume

	local function c_wrap(co, ok, ...)
		if ok then
			return ...
		else
			error((...), 0)
		end
	end -- c_wrap

	function auxlib.wrap(f)
		local co = coroutine.create(f)

		return function(...)
			return c_wrap(co, c_resume(co, l_resume(co, ...)))
		end
	end -- auxlib.wrap

	--
	-- auxlib.assert
	--
	-- If condition is false, locate and use the first non-false,
	-- non-nil value as the reason. If an integer value, attempt to
	-- convert to string using strerror.
	--
	-- RATIONALE: Many routines return only an integer error number.
	-- Errors like EAGAIN are very common and constantly pushing a new
	-- string on the stack from C would be inefficient.
	--
	-- Also, unlike the standard Lua idiom, the failure mode for some
	-- routines will return multiple false or nil values preceding the
	-- error number so user code doesn't need to use variable names like
	-- "value_or_error" for routines which can be expected to fail
	-- regularly in the normal course of operation and where simply
	-- using the assert idiom would create spaghetti code.
	--
	local tostring = auxlib.tostring

	local function findwhy(v, ...)
		if v then
			if type(v) == "number" then
				-- return string and number for auxlib.fileresult
				return (errno.strerror(v) or tostring(v)), v
			else
				return tostring(v), ...
			end
		elseif select("#", ...) > 0 then
			return findwhy(...)
		else
			return
		end
	end

	function auxlib.assert(c, ...)
		if c then
			return c, ...
		end

		return error(findwhy(...), 2)
	end -- auxlib.assert

	--
	-- auxlib.assert[23456789]
	--
	-- Like auxlib.assert, but use error(message, level) where level is
	-- the numeric suffix of the assert function name.
	--
	local function makeassert(level)
		return function (c, ...)
			if c then
				return c, ...
			end

			return error(findwhy(...), level)
		end
	end

	for n=2,9 do
		auxlib[string.format("assert%d", n)] = makeassert(n)
	end

	--
	-- auxlib.fileresult
	--
	function auxlib.fileresult(c, ...)
		if c then
			return c, ...
		else
			return c, findwhy(...)
		end
	end -- auxlib.fileresult

	auxlib.loader = loader

	return auxlib
end -- loader

return loader(loader, ...)