Commit graph

279 commits

Author SHA1 Message Date
Matthew Wild
f5460a5037 util.hashes: Add constant-time string comparison (binding to CRYPTO_memcmp) 2021-05-10 16:24:54 +01:00
Kim Alvefur
20fc0c9c15 Back out changeset 2c1583bb0e0f
Same reason as 712b2e6a09d9
2020-10-15 17:21:58 +02:00
Kim Alvefur
bad47be8f9 Back out 6dde2c9fa272: Doesn't work on Lua 5.1 2020-10-15 17:12:33 +02:00
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.
2020-10-15 17:05:53 +02:00
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.
2020-10-15 16:43:30 +02:00
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
2020-10-15 16:26:56 +02:00
Kim Alvefur
fb1808b185 util.strbitop: Library for bitwise operations on strings 2019-09-07 13:37:47 +02:00
Kim Alvefur
c4c38d2f01 util.pposix: Avoid overflow of malloc info at 2GB (fixes #1445 until 4GB) 2019-11-16 16:45:33 +01:00
Kim Alvefur
c42a786ec7 util.encodings: Allow unassigned code points in ICU mode to match libidn behavior (fixes #1348) 2019-04-24 16:16:19 +02:00
Kim Alvefur
7ef028d8d4 util.hashes: Use HMAC function provided by OpenSSL (fixes #1345) 2019-04-19 13:12:00 +02:00
Kim Alvefur
d21439da5c util-src/makefile: Update with util.poll and util.compat (fixes #1251) 2018-11-30 16:00:12 +01:00
Matthew Wild
1454ac8208 util.xpcall, util.compat: Add non-hacky multi-argument xpcall() for Lua 5.1 2018-10-26 19:29:08 +01:00
Kim Alvefur
2bb3772374 net.server_epoll: Special handling of signal interrupts 2018-10-12 03:22:09 +02:00
Kim Alvefur
afeb1f6f02 net.server_epoll: Ignore ENOENT when deregitering socket
It should not really happen
2018-10-12 03:21:11 +02:00
Kim Alvefur
bbf669b2c5 net.server_epoll: Graceful handling of registering already added socket 2018-10-12 03:20:09 +02:00
Kim Alvefur
f26390b484 util.poll: Fix inverted logic 2018-10-11 18:56:11 +02:00
Kim Alvefur
9547e0e66d util.poll: Handle failed epoll FD creation 2018-10-11 18:52:12 +02:00
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
2018-10-11 18:50:04 +02:00
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.
2018-10-08 15:33:15 +02:00
Kim Alvefur
4a73f5daef util.poll: Zero FD sets watched for errors on creation 2018-10-07 20:58:51 +02:00
Kim Alvefur
ceadb9c57c net.poll: Guard against negative or too large FDs 2018-10-07 18:44:46 +02:00
Kim Alvefur
31c8b1aca3 util.poll: Fix missing return for adding duplicate FD 2018-10-07 18:41:44 +02:00
Kim Alvefur
8126707125 util.poll: Tweak metatable name field 2018-10-06 18:32:57 +02:00
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.
2018-10-06 17:19:50 +02:00
Kim Alvefur
110ce660d5 util.poll: Lua 5.1 compat 2018-09-15 01:17:53 +02:00
Kim Alvefur
1ad376770f util.poll: Remove 'inline' from function declaration
Why does this fix building?
2018-09-15 01:05:59 +02:00
Kim Alvefur
fa4507823f util.poll: Import poll library with epoll and select support 2018-05-16 23:56:34 +02:00
Kim Alvefur
2f939029ef util.pposix: Allow _DARWIN_C_SOURCE to be overriden
Like the others there
2018-09-08 11:52:44 +02:00
Kim Alvefur
53b9150562 Merge 0.10->trunk 2018-09-08 11:51:52 +02:00
Kim Alvefur
530a9f9c8e util.pposix: Fix or silence a warning on OS X (#1202) 2018-09-08 11:46:02 +02:00
Kim Alvefur
e837abbf5d Merge 0.10->trunk 2018-09-08 11:42:22 +02:00
Kim Alvefur
6391242937 util.pposix: Restrict use of malloc_info to glibc
Fixes build on musl based distros like Alpine linux
2018-09-07 15:50:12 +02:00
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
2018-09-07 15:25:33 +02:00
Kim Alvefur
b78f1d3da1 util.pposix: Fix building on OS X (#1202) 2018-08-18 12:07:40 +02:00
Kim Alvefur
49232398ed util-src/makefile: Add util.time to BSD makefile 2018-08-11 17:33:11 +02:00
Kim Alvefur
592ccd8233 util.time: Allow for already set constant 2018-08-11 16:55:07 +02:00
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
2017-11-30 19:35:35 +01:00
Kim Alvefur
27d99dd43b util.signal: Use a static array to keep track of pending signals (fixes #1029) 2017-11-14 15:20:14 +01:00
Kim Alvefur
8956f32a9c util.encodings: Use the 'idx' argument correctly [-Wunused-parameter] 2017-10-05 12:48:36 +02:00
Kim Alvefur
237f991e4f util.crand: Build with musl/non-glibc (can't have undefined argument-taking macros?) 2017-04-25 01:35:13 +02:00
Kim Alvefur
7f1be1b938 util.time: Add monotonic time 2017-03-09 04:37:12 +01:00
Kim Alvefur
b0e0a1d487 util.time: Convert to C 2017-03-09 04:34:28 +01:00
Emmanuel Gil Peyrot
2363ba3749 encodings: Explicitly say that base64 decoding falls through in a switch, fixes a warning in gcc 7+. 2018-08-08 09:29:32 +02:00
Emmanuel Gil Peyrot
c1be2da977 pposix: Generate an error when a passed string isn’t "unlimited". 2018-08-08 09:28:42 +02:00
Emmanuel Gil Peyrot
1a23a874bc pposix, signal: Ignore unused arguments. 2018-08-08 09:28:04 +02:00
Emmanuel Gil Peyrot
9d9392a941 net, pposix, signal: Check for redefined defines, fix warnings. 2018-08-08 09:27:34 +02:00
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.
2018-07-12 20:42:22 +02:00
Kim Alvefur
1eb7584483 util.ringbuffer: Fix typo in comment [codespell] 2018-04-06 22:26:53 +02:00
Kim Alvefur
cdd71f28ac Add makefiles compatible with BSD make 2018-03-11 06:01:19 +01:00
Kim Alvefur
e156c05ad4 Rename Makefile -> GNUmakefile to reflect dependency on GNU Make 2017-10-31 17:28:23 +01:00