aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
Commit message (Collapse)AuthorAge
* Merge branch '6044_nm_squashed'Nick Mathewson2012-09-17
|\
| * Handle FIFOs in read_file_to_strmeejah2012-09-17
| | | | | | | | | | | | | | | | add read_file_to_str_until_eof which is used by read_file_to_str if the file happens to be a FIFO. change file_status() to return FN_FILE if st_mode matches S_IFIFO (on not-windows) so that init_key_from_file() will read from a FIFO.
* | Merge remote-tracking branch 'public/bug6538'Nick Mathewson2012-09-11
|\ \ | | | | | | | | | | | | Conflicts: configure.ac
| * | Change smartlist_choose_node_by_bandwidth to avoid doubleNick Mathewson2012-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should make our preferred solution to #6538 easier to implement, avoid a bunch of potential nastiness with excessive int-vs-double math, and generally make the code there a little less scary. "But wait!" you say. "Is it really safe to do this? Won't the results come out differently?" Yes, but not much. We now round every weighted bandwidth to the nearest byte before computing on it. This will make every node that had a fractional part of its weighted bandwidth before either slighty more likely or slightly less likely. Further, the rand_bw value was only ever set with integer precision, so it can't accurately sample routers with tiny fractional bandwidth values anyway. Finally, doing repeated double-vs-uint64 comparisons is just plain sad; it will involve an implicit cast to double, which is never a fun thing.
* | | Merge remote-tracking branch 'origin/maint-0.2.3'Nick Mathewson2012-09-11
|\ \ \ | |_|/ |/| |
| * | Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3Nick Mathewson2012-09-11
| |\ \ | | |/ | |/| | | | | | | Conflicts: src/test/test_util.c
| | * Fix assertion failure in tor_timegm.Nick Mathewson2012-09-11
| | | | | | | | | | | | Fixes bug 6811.
* | | Refactor tor to support the new tor-fw-helper protocol.George Kadianakis2012-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add handle_fw_helper_output(), a function responsible for parsing the output of tor-fw-helper. Refactor tor_check_port_forwarding() and run_scheduled_events() accordingly too. We now issue warnings when we get control output from tor-fw-helper, and we log the verbose output of tor-fw-helper in LOG_INFO. Conflicts: src/common/util.c
* | | Introduce get_lines_from_handle().George Kadianakis2012-09-05
| | | | | | | | | | | | | | | | | | | | | get_lines_from_handle() is a multiplatform function which drains lines from a stream and stuffs it into a smartlist. It's useful for line-based protocols, like the one managed proxy and the tor-fw-helper protocols.
* | | Remove tor_malloc_roundup().Nick Mathewson2012-08-13
| | | | | | | | | | | | | | | This function never actually did us any good, and it added a little complexity. See the changes file for more info.
* | | Merge remote-tracking branch 'public/bug2385'Nick Mathewson2012-06-25
|\ \ \ | |/ / |/| |
| * | Clear a couple more fields in rend_service_load_auth_keysNick Mathewson2012-06-18
| | |
* | | Resolve crash caused by format_helper_exit_status changes in #5557Nick Mathewson2012-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Because the string output was no longer equal in length to HEX_ERRNO_SIZE, the write() call would add some extra spaces and maybe a NUL, and the NUL would trigger an assert in get_string_from_pipe. Fixes bug 6225; bug not in any released version of Tor.
* | | Refactor unsigned int hex formatting out of format_helper_exit_status() in ↵Andrea Shepard2012-06-22
|/ / | | | | | | util.c
* | Fix another clang compile warningSebastian Hahn2012-06-13
| | | | | | | | We forgot this when we fixed 5969.
* | Fix some mingw build warningsNick Mathewson2012-06-05
| | | | | | | | | | | | | | | | These include: - Having a weird in_addr that can't be initialized with {0} - Needing INVALID_HANDLE_VALUE instead of -1 for file handles. - Having a weird dependent definition for struct stat. - pid is signed, not unsigned.
* | Resolve about 24 DOCDOCsNick Mathewson2012-06-05
| |
* | Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson2012-06-04
| |
* | Add about 60 more DOCDOC comments to 0.2.3Nick Mathewson2012-06-04
| | | | | | | | | | | | | | | | Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together.
* | Resolve all currently pending DOCDOC items in masterNick Mathewson2012-06-04
| |
* | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2012-05-31
|\| | | | | | | (For bug 5969 fix)
| * Add __attribute__(format)s for our varargs printf/scanf wrappersNick Mathewson2012-05-30
| | | | | | | | | | | | | | | | | | | | It turns out that if you set the third argument of __attribute__(format) to 0, GCC and Clang will check the format argument without expecting to find variadic arguments. This is the correct behavior for vsnprintf, vasprintf, and vscanf. I'm hoping this will fix bug 5969 (a clang warning) by telling clang that the format argument to tor_vasprintf is indeed a format string.
* | Pass process_environment_t * to tor_spawn_backgroundRobert Ransom2012-02-17
| | | | | | | | Now tor_spawn_background's prototype is OS-independent.
* | Change type of unixoid_environment_block to match tor_spawn_background's argRobert Ransom2012-02-17
| |
* | Add set_environment_variable_in_smartlistRobert Ransom2012-02-17
| |
* | Add get_current_process_environment_variablesRobert Ransom2012-02-17
| |
* | Add process_environment_make and related utilitiesRobert Ransom2012-02-17
| |
* | Add tor_callocRobert Ransom2012-02-17
| |
* | Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32Nick Mathewson2012-01-31
| | | | | | | | | | | | | | | | | | | | | | This commit is completely mechanical; I used this perl script to make it: #!/usr/bin/perl -w -i.bak -p if (/^\s*\#/) { s/MS_WINDOWS/_WIN32/g; s/\bWIN32\b/_WIN32/g; }
* | Rename smartlist_{v,}asprintf_add to smartlist_add_{v,}asprintfNick Mathewson2012-01-16
| |
* | Merge branch 'feature3457-v4-nm-squashed'Nick Mathewson2012-01-11
|\ \ | | | | | | | | | | | | Conflicts: src/or/rendclient.c
| * | Use spaceless ISO8601 time format, not sec,usec.Nick Mathewson2012-01-11
| | |
* | | Merge remote-tracking branch 'asn-mytor/bug4548_take2'Nick Mathewson2011-11-29
|\ \ \
| * | | Introduce write_bytes_to_new_file().George Kadianakis2011-11-26
| |/ / | | | | | | | | | | | | Introduce write_bytes_to_new_file(), a function which writes bytes to a file only if that file did not exist.
* | | Make process_handle_t private and fix some unit testsNick Mathewson2011-11-25
| | | | | | | | | | | | | | | | | | | | | | | | Let's *not* expose more cross-platform-compatibility structures, or expect code to use them right. Also, don't fclose() stdout_handle and stdin_handle until we do tor_process_handle_destroy, or we risk a double-fclose.
* | | Merge remote-tracking branch 'asn/bug3472_act2'Nick Mathewson2011-11-25
|\ \ \
| * | | Rename tor_process_destroy() to tor_process_handle_destroy().George Kadianakis2011-10-24
| | | |
| * | | Improve general code quality.George Kadianakis2011-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a tor_process_get_pid() function that returns the PID of a process_handle_t. - Conform to make check-spaces. - Add some more documentation. - Improve some log messages.
| * | | Prepare util.[ch] to use the new process_handle_t API.George Kadianakis2011-10-24
| | | | | | | | | | | | | | | | Also, create tor_process_destroy() which destroys a process_handle_t.
| * | | Port managed proxy launching code to the new subprocess API.George Kadianakis2011-10-17
| |/ /
* / / Purge ATTR_PURE from the codeSebastian Hahn2011-11-25
|/ / | | | | | | | | We're using it incorrectly in many cases, and it doesn't help as far as we know.
* | Merge remote-tracking branch 'asn2/bug3656'Nick Mathewson2011-10-07
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/common/util.c src/common/util.h src/or/config.h src/or/main.c src/test/test_util.c
| * | Enforce transport names being C identifiers.George Kadianakis2011-09-11
| | | | | | | | | | | | | | | Introduce string_is_C_identifier() and use it to enforce transport names according to the 180 spec.
| * | Introduce tor_terminate_process() function.George Kadianakis2011-09-11
| | |
| * | Improve the code a tad.George Kadianakis2011-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use strcmpstart() instead of strcmp(x,y,strlen(y)). * Warn the user if the managed proxy failed to launch. * Improve function documentation. * Use smartlist_len() instead of n_unconfigured_proxies. * Split managed_proxy_destroy() to managed_proxy_destroy() and managed_proxy_destroy_with_transports(). * Constification.
| * | Replaced ST_* enum prefix for stream status with IO_STREAM_*.George Kadianakis2011-07-18
| | |
| * | Make some utility functions.George Kadianakis2011-07-13
| | | | | | | | | | | | | | | | | | | | | * Create a function that will get input from a stream, so that we can communicate with the managed proxy. * Hackish change to tor_spawn_background() so that we can specify an environ for our spawn.
* | | Fix double-closing a stdio streamSteven Murdoch2011-09-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | After a stream reached eof, we fclose it, but then test_util_spawn_background_partial_read() reads from it again, which causes an error and thus another fclose(). Some platforms are fine with this, others (e.g. debian-sid-i386) trigger a double-free() error. The actual code used by Tor (log_from_pipe() and tor_check_port_forwarding()) handle this case correctly.
* | | Make a version of tor_read_all_handle() for non-Windows platformsSteven Murdoch2011-09-01
| | | | | | | | | | | | | | | | | | Mainly used for testing reading from subprocesses. To be more generic we now pass in a pointer to a process_handle_t rather than a Windows- specific HANDLE.
* | | Rename tor_join_cmdline to tor_join_win_cmdline; tweak doxygenNick Mathewson2011-08-30
| | |