Matthew Wild
f5460a5037
util.hashes: Add constant-time string comparison (binding to CRYPTO_memcmp)
5 years ago
Kim Alvefur
20fc0c9c15
Back out changeset 2c1583bb0e0f
...
Same reason as 712b2e6a09d9
6 years ago
Kim Alvefur
bad47be8f9
Back out 6dde2c9fa272: Doesn't work on Lua 5.1
6 years ago
Kim Alvefur
9b8a54345f
util.strbitop: Remove redundant init function
...
When you have 3 almost identical functions, you tend to edit one and
then copypaste. Forgot to remove this line from the other two.
6 years ago
Kim Alvefur
da8eca639a
util.strbitop: Create buffer in the correct size (optimization)
...
This avoids dynamically growing the buffer as Lua does when luaL_addchar
is used, thus saving on realloc calls.
6 years ago
Kim Alvefur
539255c692
util.strbitop: Reformat code
...
astyle \
--indent=tab \
--attach-classes \
--indent-switches \
--break-blocks \
--pad-oper \
--unpad-paren \
--add-braces \
--align-pointer=name \
--lineend=linux \
*.c
6 years ago
Kim Alvefur
fb1808b185
util.strbitop: Library for bitwise operations on strings
7 years ago
Kim Alvefur
c4c38d2f01
util.pposix: Avoid overflow of malloc info at 2GB ( fixes #1445 until 4GB)
7 years ago
Kim Alvefur
c42a786ec7
util.encodings: Allow unassigned code points in ICU mode to match libidn behavior ( fixes #1348 )
7 years ago
Kim Alvefur
7ef028d8d4
util.hashes: Use HMAC function provided by OpenSSL ( fixes #1345 )
7 years ago
Kim Alvefur
d21439da5c
util-src/makefile: Update with util.poll and util.compat ( fixes #1251 )
8 years ago
Matthew Wild
1454ac8208
util.xpcall, util.compat: Add non-hacky multi-argument xpcall() for Lua 5.1
8 years ago
Kim Alvefur
2bb3772374
net.server_epoll: Special handling of signal interrupts
8 years ago
Kim Alvefur
afeb1f6f02
net.server_epoll: Ignore ENOENT when deregitering socket
...
It should not really happen
8 years ago
Kim Alvefur
bbf669b2c5
net.server_epoll: Graceful handling of registering already added socket
8 years ago
Kim Alvefur
f26390b484
util.poll: Fix inverted logic
8 years ago
Kim Alvefur
9547e0e66d
util.poll: Handle failed epoll FD creation
8 years ago
Kim Alvefur
22e0c16d4c
util.poll: Early return from __gc in case of no valid epoll FD
...
This could happen if the epoll FD has already been closed or
the epoll_create call failed
8 years ago
Kim Alvefur
28522988cc
util.poll: Increase max epoll events per call
...
This makes the struct roughly the same size in both epoll and select
mode (64bit).
There doesn’t seem to be much guidance on an appropriate size, it does
not seem to matter too much since if there are more events they will
simply show up in the next epoll_wait call. The number of exactly
concurrent events should be fairly low most of the time anyways.
8 years ago
Kim Alvefur
4a73f5daef
util.poll: Zero FD sets watched for errors on creation
8 years ago
Kim Alvefur
ceadb9c57c
net.poll: Guard against negative or too large FDs
8 years ago
Kim Alvefur
31c8b1aca3
util.poll: Fix missing return for adding duplicate FD
8 years ago
Kim Alvefur
8126707125
util.poll: Tweak metatable name field
8 years ago
Kim Alvefur
d3c236c693
util.poll: Fix monitoring of socket exceptions in select mode
...
Since state->err is a set of all watched FDs, this mistake caused all
sockets to appear to have errors.
8 years ago
Kim Alvefur
110ce660d5
util.poll: Lua 5.1 compat
8 years ago
Kim Alvefur
1ad376770f
util.poll: Remove 'inline' from function declaration
...
Why does this fix building?
8 years ago
Kim Alvefur
530a9f9c8e
util.pposix: Fix or silence a warning on OS X ( #1202 )
8 years ago
Kim Alvefur
b78f1d3da1
util.pposix: Fix building on OS X ( #1202 )
8 years ago
Kim Alvefur
fa4507823f
util.poll: Import poll library with epoll and select support
8 years ago
Kim Alvefur
2f939029ef
util.pposix: Allow _DARWIN_C_SOURCE to be overriden
...
Like the others there
8 years ago
Kim Alvefur
6391242937
util.pposix: Restrict use of malloc_info to glibc
...
Fixes build on musl based distros like Alpine linux
8 years ago
Kim Alvefur
53c20a796e
util.pposix: Do not attempt to assign to stdio variables [pedantic]
...
Fixes build on gcc 6.4.0
See also https://stackoverflow.com/a/586416
8 years ago
Kim Alvefur
49232398ed
util-src/makefile: Add util.time to BSD makefile
8 years ago
Kim Alvefur
592ccd8233
util.time: Allow for already set constant
8 years ago
Kim Alvefur
5485202439
util.signal: Fix loop ( fixes #1047 )
...
A pre-commit version probably started with i = nsig and counted down,
then an incomplete change to counting up was done
9 years ago
Kim Alvefur
27d99dd43b
util.signal: Use a static array to keep track of pending signals ( fixes #1029 )
9 years ago
Kim Alvefur
8956f32a9c
util.encodings: Use the 'idx' argument correctly [-Wunused-parameter]
9 years ago
Kim Alvefur
237f991e4f
util.crand: Build with musl/non-glibc (can't have undefined argument-taking macros?)
9 years ago
Kim Alvefur
7f1be1b938
util.time: Add monotonic time
9 years ago
Kim Alvefur
b0e0a1d487
util.time: Convert to C
9 years ago
Emmanuel Gil Peyrot
2363ba3749
encodings: Explicitly say that base64 decoding falls through in a switch, fixes a warning in gcc 7+.
8 years ago
Emmanuel Gil Peyrot
c1be2da977
pposix: Generate an error when a passed string isn’t "unlimited".
8 years ago
Emmanuel Gil Peyrot
1a23a874bc
pposix, signal: Ignore unused arguments.
8 years ago
Emmanuel Gil Peyrot
9d9392a941
net, pposix, signal: Check for redefined defines, fix warnings.
8 years ago
Kim Alvefur
39c7ba2a8f
util.pposix: Use freopen(3) when replacing standard IO streams (thanks ratchetfreak)
...
Man page says this is what freopen(3) is for.
8 years ago
Kim Alvefur
1eb7584483
util.ringbuffer: Fix typo in comment [codespell]
8 years ago
Kim Alvefur
cdd71f28ac
Add makefiles compatible with BSD make
8 years ago
Kim Alvefur
e156c05ad4
Rename Makefile -> GNUmakefile to reflect dependency on GNU Make
9 years ago
Kim Alvefur
28ba10b6b4
util.ringbuffer: Add method for discarding buffered data without returning it to lua
8 years ago
Kim Alvefur
a92cdf75b1
util.ringbuffer: Add various comments
8 years ago