aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.h
AgeCommit message (Collapse)Author
2018-01-17Merge branch 'bug22798_029_squashed'Nick Mathewson
2018-01-17Improve Windows performance with SIO_IDEAL_SEND_BACKLOG_QUERY.Nick Mathewson
Patch written by "Vort" on trac. Addresses ticket 22798.
2017-10-18New function for Tor to treat itself as the "owner" of a socketNick Mathewson
Our socket accounting functions assumed that we'd never be asked to close a socket that we didn't open ourselves. But now we want to support taking control sockets that we inherit -- so we need a way of taking ownership of them, so we don't freak out later on when we close them.
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-15Split some long #if lines to make the #endif annotator happyNick Mathewson
2017-05-22fix two typos in commentsRoger Dingledine
closes ticket 22322
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-09Remove fgets() compatbility function and related tests.Alexander Færøy
This patch removes the `tor_fgets()` wrapper around `fgets(3)` since it is no longer needed. The function was created due to inconsistency between the returned values of `fgets(3)` on different versions of Unix when using `fgets(3)` on non-blocking file descriptors, but with the recent changes in bug #21654 we switch from unbuffered to direct I/O on non-blocking file descriptors in our utility module. We continue to use `fgets(3)` directly in the geoip and dirserv module since this usage is considered safe. This patch also removes the test-case that was created to detect differences in the implementation of `fgets(3)` as well as the changes file since these changes was not included in any releases yet. See: https://bugs.torproject.org/21654
2017-03-01Add compatibility function for fgets(3).Alexander Færøy
This patch adds the `tor_fgets()` function to our compatibility layer. `tor_fgets()` adds an additional check for whether the error-bit have been enabled for the given file stream, if that is the case and `errno` is set to `EAGAIN` we make sure that we always return NULL. Unfortunately `fgets(3)` behaves differently on different versions of the C library. See: https://bugs.torproject.org/21416 See: https://bugs.torproject.org/20988
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