summaryrefslogtreecommitdiff
path: root/src/common/compat.h
AgeCommit message (Collapse)Author
2016-09-09Fix cases where the tests were doing closesocket() on a non-socketNick Mathewson
These seem to have caused warnings on windows. Hmmm.
2016-08-12Fix integer overflows in the conversion tablescypherpunks
2016-08-11Fix a bug in the old-gcc version of ENABLE_GCC_WARNINGNick Mathewson
Fixes bug 19901; bugfix on 0.2.9.1-alpha.
2016-07-08Move our "what time is it now" compat functions into a new moduleNick Mathewson
I'm not moving our "format and parse the time" functions, since those have been pretty volatile over the last couple of years.
2016-05-27Add support for temporarily suppressing a warningNick Mathewson
There are a few places where we want to disable a warning: for example, when it's impossible to call a legacy API without triggering it, or when it's impossible to include an external header without triggering it. This pile of macros uses GCC's c99 _Pragma support, plus the usual macro trickery, to enable and disable warnings.
2016-04-05Fix a comment typo in compat.hteor (Tim Wilson-Brown)
2016-02-27Update the copyright year.Nick Mathewson
2016-02-23Merge branch 'maint-0.2.7'Nick Mathewson
2016-02-23Make clang asan work with FORTIFIED_SOURCE again.Nick Mathewson
Short version: clang asan hates the glibc strcmp macro in bits/string2.h if you are passing it a constant string argument of length two or less. (I could be off by one here, but that's the basic idea.) Closes issue 14821.
2016-01-15Whitespace cleanupNick Mathewson
2016-01-13Add tests for options_actOla Bini
2015-12-15Merge branch 'feature8195_small_squashed'Nick Mathewson
2015-12-15Update KeepCapabilities based on comments from asnNick Mathewson
* The option is now KeepBindCapabilities * We now warn if the user specifically asked for KeepBindCapabilities and we can't deliver. * The unit tests are willing to start. * Fewer unused-variable warnings. * More documentation, fewer misspellings.
2015-12-15Add ability to keep the CAP_NET_BIND_SERVICE capability on LinuxNick Mathewson
This feature allows us to bind low ports when starting as root and switching UIDs. Based on code by David Goulet. Implement feature 8195
2015-12-15Remove obsolete INLINE preprocessor definitioncypherpunks
The INLINE keyword is not used anymore in favor of inline. Windows only supports __inline so an inline preprocessor definition is still needed.
2015-12-15Replace usage of INLINE with inlinecypherpunks
This patch was generated using; sed -i -e "s/\bINLINE\b/inline/" src/*/*.[ch] src/*/*/*.[ch]
2015-11-25Make crypto_seed_rng() and crypto_rand() less scary.Nick Mathewson
These functions must really never fail; so have crypto_rand() assert that it's working okay, and have crypto_seed_rng() demand that callers check its return value. Also have crypto_seed_rng() check RAND_status() before returning.
2015-08-17Merge remote-tracking branch 'public/bug16741_026'Nick Mathewson
2015-08-07Check for EINTR correctly on windowsNick Mathewson
(even though these are nonblocking calls and EINTR shouldn't be possible). Also, log what error we're seing if drain_fn fails.
2015-08-05Add a compat function to check how much disk space is free.Nick Mathewson
Closes ticket 16734.
2015-07-30Add get_max_sockets() and remove dead codeDavid Goulet
The control port was using set_max_file_descriptors() with a limit set to 0 to query the number of maximum socket Tor can use. With the recent changes to that function, a check was introduced to make sure a user can not set a value below the amount we reserved for non socket. This commit adds get_max_sockets() that returns the value of max_sockets so we can stop using that "setter" function to get the current value. Finally, the dead code is removed that is the code that checked for limit equal to 0. From now on, set_max_file_descriptors() should never be used with a limit set to 0 for a valid use case. Fixes #16697 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-29More tweaks for windows compilation. (ick)Nick Mathewson
2015-06-29Remove checks for visual C 6.Nick Mathewson
2015-06-25Merge branch 'bug16288_027_03_squashed'Nick Mathewson
2015-06-25Validate the open file limit when creating a socketDavid Goulet
Fixes #16288 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-17Add a tor_getpass to read passphrases. Needs better backend.Nick Mathewson
2015-03-31Merge branch 'ticket14710_squashed'Nick Mathewson
2015-03-31Whitebox test for get_interface_address6_via_udp_socket_hack().rl1987
Also, fix some whitespace mishaps.
2015-03-09Merge remote-tracking branch 'public/bug15205_025' into maint-0.2.6Nick Mathewson
2015-03-09Don't use checked strl{cat,cpy} on OSX.Nick Mathewson
There is a bug in the overlap-checking in strlcat that can crash Tor servers. Fixes bug 15205; this is an OSX bug, not a Tor bug.
2015-01-14Split threading-related code out of compat.cNick Mathewson
Also, re-enable the #if'd out condition-variable code. Work queues are going to make us hack on all of this stuff a bit more closely, so it might not be a terrible idea to make it easier to hack.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-29Merge branch 'resolvemyaddr_squashed'Nick Mathewson
2014-12-29Adding comprehensive test cases for resolve_my_address.rl1987
Also, improve comments on resolve_my_address to explain what it actually does.
2014-11-06Define macros meaning <,>,==,!=,<=,>=Nick Mathewson
This lets us avoid putting operators directly in macro arguments, and thus will help us unconfuse coccinelle. For ticket 13172.
2014-10-30Silence spurious clang warningsteor
Silence clang warnings under --enable-expensive-hardening, including: + implicit truncation of 64 bit values to 32 bit; + const char assignment to self; + tautological compare; and + additional parentheses around equality tests. (gcc uses these to silence assignment, so clang warns when they're present in an equality test. But we need to use extra parentheses in macros to isolate them from other code).
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-07-16Add a tor_ftruncate to replace ftruncate.Nick Mathewson
(Windows doesn't have ftruncate, and some ftruncates do not move the file pointer to the start of the file.)
2014-06-20Thread support is now requiredNick Mathewson
Long ago we supported systems where there was no support for threads, or where the threading library was broken. We shouldn't have do that any more: on every OS that matters, threads exist, and the OS supports running threads across multiple CPUs. This resolves tickets 9495 and 12439. It's a prerequisite to making our workqueue code work better, since sensible workqueue implementations don't split across multiple processes.
2014-06-20Remove code for Windows CE supportNick Mathewson
As far as I know, nobody has used this in ages. It would be a pretty big surprise if it had worked. Closes ticket 11446.
2014-06-14Merge branch 'bug8746_v2_squashed'Nick Mathewson
Conflicts: src/common/include.am
2014-06-14New testing-only tor_sleep_msec functionNick Mathewson
In the unit tests I want to loop with a delay, but I want less than a 1 second delay. This, sadly, requires compatibility code.
2014-05-14Add a pair of wrapper functions: tor_getpwnam() and tor_getpwuid()Nick Mathewson
We'll use these to deal with being unable to access the user DB after we install the sandbox, to fix bug 11946.
2014-04-24Merge branch 'bug11396_v2_squashed'Nick Mathewson
Conflicts: src/or/main.c
2014-04-24get_total_system_memory(): see how much RAM we haveNick Mathewson
2014-04-16Add 'rename' to the sandboxed syscallsNick Mathewson
(If we don't restrict rename, there's not much point in restricting open, since an attacker could always use rename to make us open whatever they want.)
2014-04-01Merge remote-tracking branch 'public/bug11232'Nick Mathewson
2014-03-31Add return value and assert for null parameter to tor_munmap_file()Andrea Shepard
2014-03-18Fix a ubsan warning in our ctypes replacementsNick Mathewson
ubsan doesn't like 1<<31, since that's an undefined integer overflow. Instead, we should do 1u<<31.
2014-02-15Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson