Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | utils: Include stdint.h | Tobias Brunner | 2017-09-19 | 1 | -0/+1 |
| | | | | | | | | | Recent releases of glibc don't include the full stdint.h header in some network headers included by utils.h. So uintptr_t might not be defined. Since we use fixed width integers, including the latter, all over the place we make sure the complete file is included. Fixes #2425. | ||||
* | utils: Add helper macros to read variadic arguments into local variables | Tobias Brunner | 2017-05-26 | 1 | -2/+46 |
| | |||||
* | utils: Fix definition of BYTE_ORDER with MinGW | Tobias Brunner | 2016-08-24 | 1 | -1/+5 |
| | |||||
* | utils: Provide a fallback for sigwaitinfo() if needed | Tobias Brunner | 2015-11-13 | 1 | -1/+15 |
| | | | | | Apparently, not available on Mac OS X 10.10 Yosemite. We don't provide this on Windows. | ||||
* | android: Replace AndroidConfigLocal.h with a header in utils/compat | Tobias Brunner | 2015-11-12 | 1 | -0/+3 |
| | |||||
* | utils: Clean up includes | Martin Willi | 2015-04-16 | 1 | -27/+27 |
| | |||||
* | align: Move min/max/padding/alignment functions to separate files | Martin Willi | 2015-04-16 | 1 | -61/+1 |
| | |||||
* | time: Move time related functions to separate files | Martin Willi | 2015-04-16 | 1 | -66/+1 |
| | |||||
* | object: Move OO programming helper macros to a separate header file | Martin Willi | 2015-04-16 | 1 | -106/+1 |
| | |||||
* | status: Move status_t type and functions to separate files | Martin Willi | 2015-04-16 | 1 | -82/+1 |
| | |||||
* | path: Move path related utility functions to separate files | Martin Willi | 2015-04-16 | 1 | -52/+1 |
| | |||||
* | tty: Move tty related functions to separate files | Martin Willi | 2015-04-16 | 1 | -40/+1 |
| | |||||
* | memory: Move memory manipulation related functions to separate files | Martin Willi | 2015-04-16 | 1 | -158/+1 |
| | |||||
* | string: Move string related utility functions to separate files | Martin Willi | 2015-04-16 | 1 | -78/+1 |
| | |||||
* | byteorder: Move byte order related functions to separate header file | Martin Willi | 2015-04-16 | 1 | -136/+1 |
| | |||||
* | types: Use generic type definitions to separate header file | Martin Willi | 2015-04-16 | 1 | -62/+1 |
| | |||||
* | atomics: Move atomics/recounting support to separate files | Martin Willi | 2015-04-16 | 1 | -95/+1 |
| | |||||
* | utils: Provide aligning variants of INIT/INIT_EXTRA macros | Martin Willi | 2015-04-15 | 1 | -0/+29 |
| | |||||
* | utils: Add malloc/free wrappers returning aligned data | Martin Willi | 2015-04-15 | 1 | -0/+18 |
| | | | | | | | | | | | | | 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: Provide an INIT_EXTRA() macro, that allocates extra data to INIT() | Martin Willi | 2015-04-15 | 1 | -0/+15 |
| | |||||
* | utils: Define MAX_(U)INT_TYPE to the maximum size integer type available | Martin Willi | 2015-04-14 | 1 | -0/+6 |
| | |||||
* | utils: Typedef int128_t and u_int128_t types if supported | Martin Willi | 2015-04-14 | 1 | -0/+11 |
| | |||||
* | utils: Add a constant time memeq() variant for cryptographic purposes | Martin Willi | 2015-04-14 | 1 | -0/+5 |
| | |||||
* | windows: Move the compatibility header to the compat subfolder | Martin Willi | 2014-11-21 | 1 | -1/+1 |
| | |||||
* | apple: Introduce a central compatibility header with all __APPLE__ quirks | Martin Willi | 2014-11-21 | 1 | -0/+3 |
| | |||||
* | windows: Provide a poll(2) wrapper calling WSAPoll() | Martin Willi | 2014-11-21 | 1 | -0/+1 |
| | |||||
* | utils: Check if the parameter passed to countof() is actually an array type | Martin Willi | 2014-08-25 | 1 | -1/+2 |
| | | | | This should avoid errors such as the one fixed with 118b2879. | ||||
* | utils: Add some initial build time assertion macros | Martin Willi | 2014-08-25 | 1 | -0/+14 |
| | | | | | These are useful to assert constants during build time. We evaluate the expression to 0 when valid, so we can safely use the evaluated value. | ||||
* | utils: Undefine mem{cpy,move,set} if set before defining them | Martin Willi | 2014-07-07 | 1 | -0/+9 |
| | | | | | Some platforms, such as OS X, use macros for these functions. Undefine them to avoid compiler warnings. | ||||
* | utils: Helper macros to define overloaded macros based on number of arguments | Tobias Brunner | 2014-06-30 | 1 | -0/+26 |
| | |||||
* | utils: Add wrappers for memcpy(3), memmove(3) and memset(3) | Tobias Brunner | 2014-06-24 | 1 | -1/+33 |
| | | | | | | | | These wrappers guarantee that calls to these functions are noops if the number of bytes is 0, as calling them with NULL pointers is undefined according to the C standard, even if the number of bytes is 0 (most implementations probably ignore the pointers anyway in this case, but lets make sure). | ||||
* | utils: Add a wait_sigint() function to wait for SIGINT or equivalent | Martin Willi | 2014-06-04 | 1 | -0/+5 |
| | |||||
* | utils: Provide a path_absolute() function to check path for non-relativeness | Martin Willi | 2014-06-04 | 1 | -0/+8 |
| | | | | The usually used trivial '/' check won't work on Windows platforms. | ||||
* | utils: Define a platform directory separator character used in paths | Martin Willi | 2014-06-04 | 1 | -0/+9 |
| | |||||
* | windows: Provide a sched_yield() implementation | Martin Willi | 2014-06-04 | 1 | -0/+1 |
| | |||||
* | windows: Add utils_init/deinit functions to initialize Winsock2 | Martin Willi | 2014-06-04 | 1 | -0/+10 |
| | |||||
* | windows: Add a common Windows header for platform specific wrappers | Martin Willi | 2014-06-03 | 1 | -2/+11 |
| | | | | | Include some more basic system headers in utils.h, so we can use that common header on the different platforms. | ||||
* | enum: Don't directly include enum.h | Martin Willi | 2014-05-16 | 1 | -3/+3 |
| | | | | | To allow enum.h to depend on utils.h definitions, avoid its direct inclusion. Instead include utils.h, which includes enum.h as well. | ||||
* | utils: Provide a CALLBACK macro, similar to METHOD, but for void* callbacks | Martin Willi | 2014-05-07 | 1 | -0/+13 |
| | | | | | | Using the same mechanism as the METHOD macro, the CALLBACK macro defines a hybrid function signature. It strictly uses a weak void* for the first function parameter, in contrast to the dynamic METHOD object "this" type. | ||||
* | utils: Enable __atomic* built-ins based on the GCC version | Tobias Brunner | 2014-05-04 | 1 | -0/+7 |
| | | | | | | | | | | | This solves a problem with GNAT when compiling charon-tkm as __atomic* built-ins are only provided in GCC 4.7 and newer. Currently GNAT 4.6 and GCC 4.7.2 is shipped with Debian wheezy (stable), as used in the testing environment. So while the configure script correctly detected the __atomic* built-ins, and defined HAVE_GCC_ATOMIC_OPERATIONS, this define turned out to be incorrect when charon-tkm was later built with GNAT. | ||||
* | utils: Use GCC's __atomic built-ins if available | Tobias Brunner | 2014-04-24 | 1 | -1/+20 |
| | | | | | | | | 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 | -2/+11 |
| | | | | | | | | | | 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 | -0/+14 |
| | | | | 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 | -1/+27 |
| | |||||
* | utils: Move thread-safe strerror replacement to a separate file | Tobias Brunner | 2014-02-24 | 1 | -17/+1 |
| | | | | | For some utils _GNU_SOURCE might be needed but that conflicts with the signature of strerror_r(3). | ||||
* | Fixed some typos | Tobias Brunner | 2014-02-18 | 1 | -3/+3 |
| | |||||
* | utils: Add strreplace function | Tobias Brunner | 2014-01-23 | 1 | -1/+15 |
| | |||||
* | utils: Include stdio.h for fmemopen() replacement | Tobias Brunner | 2013-10-29 | 1 | -0/+1 |
| | | | | | This might now be required because Vstr is not necessarily required anymore, which means stdio.h might not be pulled in by prinf_hook.h. | ||||
* | utils: Fix check for fmemopen() fallback implementation | Martin Willi | 2013-10-24 | 1 | -1/+2 |
| | |||||
* | utils: Provide a fmemopen(3) fallback using BSD funopen() | Martin Willi | 2013-10-24 | 1 | -0/+15 |
| |