Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Use standard unsigned integer types | Andreas Steffen | 2016-03-24 | 1 | -1/+1 |
| | |||||
* | sigwaitinfo() may fail with EINTR if interrupted by an unblocked signal not ↵ | Tobias Brunner | 2015-11-23 | 1 | -1/+4 |
| | | | | | | in the set Fixes #1213. | ||||
* | utils: Use the more low-level __NR_ prefix to refer to the syscall number | Tobias Brunner | 2015-11-17 | 1 | -1/+1 |
| | | | | The __NR_ constants are also defined in the Android headers. | ||||
* | utils: Provide a fallback for sigwaitinfo() if needed | Tobias Brunner | 2015-11-13 | 1 | -1/+21 |
| | | | | | Apparently, not available on Mac OS X 10.10 Yosemite. We don't provide this on Windows. | ||||
* | Replace usages of sigwait(3) with sigwaitinfo(2) | Tobias Brunner | 2015-10-29 | 1 | -2/+1 |
| | | | | | | | This is basically the same call, but it has the advantage of being supported by FreeBSD's valgrind, which sigwait() is not. References #1106. | ||||
* | utils: Check for dirfd(3) | Tobias Brunner | 2015-08-17 | 1 | -0/+9 |
| | | | | | Not all POSIX compatible systems might provide it yet. If not, we close the lowest FD to close and hope it gets reused by opendir(). | ||||
* | utils: Directly use syscall() to close open FDs in closefrom() | Tobias Brunner | 2015-08-17 | 1 | -5/+53 |
| | | | | | | | This avoids any allocations, since calling malloc() after fork() is potentially unsafe. Fixes #990. | ||||
* | utils: Don't use directory enumerator to close open FDs in closefrom() | Tobias Brunner | 2015-08-17 | 1 | -24/+36 |
| | | | | | | | | | | Calling malloc() after fork() is potentially unsafe, so we should avoid it if possible. opendir() will still require an allocation but that's less than the variant using the enumerator wrapper, thus, decreasing the conflict potential. This way we can also avoid closing the FD for the enumerated directory itself. References #990. | ||||
* | utils: Clean up includes | Martin Willi | 2015-04-16 | 1 | -9/+4 |
| | |||||
* | align: Move min/max/padding/alignment functions to separate files | Martin Willi | 2015-04-16 | 1 | -45/+0 |
| | |||||
* | time: Move time related functions to separate files | Martin Willi | 2015-04-16 | 1 | -122/+0 |
| | |||||
* | status: Move status_t type and functions to separate files | Martin Willi | 2015-04-16 | 1 | -31/+0 |
| | |||||
* | path: Move path related utility functions to separate files | Martin Willi | 2015-04-16 | 1 | -146/+0 |
| | |||||
* | tty: Move tty related functions to separate files | Martin Willi | 2015-04-16 | 1 | -67/+0 |
| | |||||
* | memory: Move memory manipulation related functions to separate files | Martin Willi | 2015-04-16 | 1 | -219/+0 |
| | |||||
* | string: Move string related utility functions to separate files | Martin Willi | 2015-04-16 | 1 | -74/+0 |
| | |||||
* | atomics: Move atomics/recounting support to separate files | Martin Willi | 2015-04-16 | 1 | -85/+2 |
| | |||||
* | utils: Add malloc/free wrappers returning aligned data | Martin Willi | 2015-04-15 | 1 | -0/+44 |
| | | | | | | | | | | | | | While we could use posix_memalign(3), that is not fully portable. Further, it might be difficult on some platforms to properly catch it in leak-detective, which results in invalid free()s when releasing such memory. We instead use a simple wrapper, which allocates larger data, and saves the padding size in the allocated header. This requires that memory is released using a dedicated function. To reduce the risk of invalid free() when working on corrupted data, we fill up all the padding with the padding length, and verify it during free_align(). | ||||
* | utils: Add a constant time memeq() variant for cryptographic purposes | Martin Willi | 2015-04-14 | 1 | -0/+19 |
| | |||||
* | windows: Use WINAPI call convention for Windows API callbacks | Martin Willi | 2014-06-06 | 1 | -1/+1 |
| | | | | | For x86_64 it does not actually matter, but for i686 builds the call convention is different with WINAPI. | ||||
* | utils: Add a wait_sigint() function to wait for SIGINT or equivalent | Martin Willi | 2014-06-04 | 1 | -0/+83 |
| | |||||
* | utils: Provide a path_absolute() function to check path for non-relativeness | Martin Willi | 2014-06-04 | 1 | -0/+27 |
| | | | | The usually used trivial '/' check won't work on Windows platforms. | ||||
* | utils: Return plain drive letter as base/pathname for drive letters on Windows | Martin Willi | 2014-06-04 | 1 | -0/+9 |
| | |||||
* | utils: Support Windows path separators in path_basename/dirname | Martin Willi | 2014-06-04 | 1 | -9/+9 |
| | |||||
* | windows: Provide a time_monotonic() based on GetTickCount64() | Martin Willi | 2014-06-04 | 1 | -0/+21 |
| | |||||
* | utils: Don't directly depend on pthread | Martin Willi | 2014-06-04 | 1 | -40/+53 |
| | |||||
* | strerror: Don't directly depend on pthread | Martin Willi | 2014-06-04 | 1 | -0/+2 |
| | |||||
* | windows: Add utils_init/deinit functions to initialize Winsock2 | Martin Willi | 2014-06-04 | 1 | -0/+20 |
| | |||||
* | utils: Printf() defined time output should gmtime/localtime_r() fail | Martin Willi | 2014-06-04 | 1 | -10/+13 |
| | |||||
* | printf-hook-builtin: Support Windows console colors using TTY escape codes | Martin Willi | 2014-06-04 | 1 | -1/+4 |
| | |||||
* | windows: Use _getmaxstdio as replacement for syscall(_SC_OPEN_MAX) | Martin Willi | 2014-06-03 | 1 | -0/+4 |
| | |||||
* | windows: replace mkdir() with Windows _mkdir() variant | Martin Willi | 2014-06-03 | 1 | -0/+4 |
| | |||||
* | utils: Use GCC's __atomic built-ins if available | Tobias Brunner | 2014-04-24 | 1 | -2/+2 |
| | | | | | | | | These are available since GCC 4.7 and will eventually replace the __sync operations. They support the memory model defined by C++11. For instance, by using __ATOMIC_RELAXED for some operations on the reference counters we can avoid memory barriers, which are required by __sync operations (whose memory model essentially is __ATOMIC_SEQ_CST). | ||||
* | utils: Add ref_cur() to retrieve the current value of a reference counter | Tobias Brunner | 2014-04-24 | 1 | -1/+13 |
| | | | | | | | | | | On many architectures it is safe to read the value directly (those using cache coherency protocols, and with atomic loads for 32-bit values) but it is not if that's not the case or if we ever decide to make refcount_t 64-bit (load not atomic on x86). So make sure the operation is actually atomic and that users do not have to care about the size of refcount_t. | ||||
* | utils: Add memrchr(3) replacement for platforms that don't support it | Tobias Brunner | 2014-02-26 | 1 | -1/+23 |
| | | | | For instance, on Mac OS X memrchr(3) is not provided by the C library. | ||||
* | utils: Add thread-safe variants of dirname(3) and basename(3) | Tobias Brunner | 2014-02-24 | 1 | -3/+61 |
| | |||||
* | utils: Move thread-safe strerror replacement to a separate file | Tobias Brunner | 2014-02-24 | 1 | -78/+0 |
| | | | | | For some utils _GNU_SOURCE might be needed but that conflicts with the signature of strerror_r(3). | ||||
* | utils: Add strreplace function | Tobias Brunner | 2014-01-23 | 1 | -1/+53 |
| | |||||
* | utils: Fix %T printf hook on big-endian systems | Tobias Brunner | 2014-01-06 | 1 | -1/+1 |
| | | | | | | | | The cast to a bool* cut of the actual value on big-endian systems if bool was shorter than int because the bool argument to printf gets promoted to an int. Fixes #479. | ||||
* | utils: Fix check for fmemopen() fallback implementation | Martin Willi | 2013-10-24 | 1 | -1/+1 |
| | |||||
* | utils: Provide a fmemopen(3) fallback using BSD funopen() | Martin Willi | 2013-10-24 | 1 | -0/+46 |
| | |||||
* | utils: ref_get() returns the new value of the reference counter | Martin Willi | 2013-06-11 | 1 | -2/+6 |
| | | | | This allows us to use ref_get() for getting unique values. | ||||
* | Allow memstr() to be called with NULL arguments | Tobias Brunner | 2013-06-11 | 1 | -1/+6 |
| | |||||
* | Removed unused clalloc() function | Tobias Brunner | 2013-06-11 | 1 | -13/+0 |
| | |||||
* | Add a utility function to resolve TTY color escape codes dynamically | Martin Willi | 2013-03-04 | 1 | -0/+63 |
| | |||||
* | Add a global return_success() method implementation | Martin Willi | 2013-02-14 | 1 | -0/+8 |
| | |||||
* | time is a time_t pointer | Andreas Steffen | 2013-02-04 | 1 | -1/+1 |
| | |||||
* | Moved utils.[ch] to utils folder | Tobias Brunner | 2012-10-24 | 1 | -0/+570 |