Commit Graph

279 Commits

Author SHA1 Message Date
Sebastian Hahn
0cc7a63fc0 Don't warn when compiling with --disable-threads
STMT_VOID semantics suggested by nick, thanks!
2011-11-09 10:26:35 +01:00
Andrea Gelmini
72d4d762c1 Remove some duplicate includes 2011-11-03 10:23:33 -04:00
Sebastian Hahn
0a5338e03c Sockets are unsigned on windows
this gets rid of a warning about signed/unsigned comparison
2011-08-09 11:03:16 +02:00
Nick Mathewson
44cfa53873 Make WIN32_WINNT defines conditional
Requested by Gisle Vanem on tor-dev.  I'm not quite sure this is the
right solution, but it's probably harmless.
2011-07-15 10:03:59 -04:00
Nick Mathewson
21de9d46e2 Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/common/compat.c
	src/or/main.c
2011-05-30 14:58:26 -04:00
Nick Mathewson
da7c60dcf3 Merge remote-tracking branch 'public/bug3270' into maint-0.2.2 2011-05-30 14:49:49 -04:00
Nick Mathewson
2527acb2dc Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/common/Makefile.am
	src/or/control.c
2011-05-23 01:23:53 -04:00
Nick Mathewson
b80a8bba19 Merge branch 'feature3049-v2' into maint-0.2.2
Conflicts:
	src/common/Makefile.am
2011-05-23 01:19:04 -04:00
Nick Mathewson
cfeafe5e77 Use a 64-bit type to hold sockets on win64.
On win64, sockets are of type UINT_PTR; on win32 they're u_int;
elsewhere they're int.  The correct windows way to check a socket for
being set is to compare it with INVALID_SOCKET; elsewhere you see if
it is negative.

On Libevent 2, all callbacks take sockets as evutil_socket_t; we've
been passing them int.

This patch should fix compilation and correctness when built for
64-bit windows.  Fixes bug 3270.
2011-05-23 00:17:48 -04:00
Nick Mathewson
4ac8ff9c9f Merge remote-tracking branch 'origin/maint-0.2.2' 2011-05-15 20:22:44 -04:00
Nick Mathewson
3b6cbf2534 Add a function to pull off the final component of a path 2011-05-15 20:20:29 -04:00
Robert Ransom
b7452dcbcb Fix comment typo 2011-05-10 05:15:02 -07:00
Nick Mathewson
8b33928676 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-04-28 17:15:31 -04:00
Nick Mathewson
51e551d383 Detect and handle NULL returns from (gm/local)time_r
These functions can return NULL for otherwise-valid values of
time_t.  Notably, the glibc gmtime manpage says it can return NULL
if the year if greater than INT_MAX, and the windows MSDN gmtime
page says it can return NULL for negative time_t values.

Also, our formatting code is not guaranteed to correctly handle
years after 9999 CE.

This patch tries to correct this by detecting NULL values from
gmtime/localtime_r, and trying to clip them to a reasonable end of
the scale.  If they are in the middle of the scale, we call it a
downright error.

Arguably, it's a bug to get out-of-bounds dates like this to begin
with.  But we've had bugs of this kind in the past, and warning when
we see a bug is much kinder than doing a NULL-pointer dereference.

Boboper found this one too.
2011-04-28 17:12:54 -04:00
Nick Mathewson
ee871e7a0e Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
	src/common/compat.h
	src/or/circuitlist.c
	src/or/circuituse.c
	src/or/or.h
	src/or/rephist.c
2011-03-30 14:55:50 -04:00
Nick Mathewson
5eaba5ac21 Implement replacements for timer(add,cmp,sub) on platforms lacking them. 2011-03-30 14:41:41 -04:00
Nick Mathewson
57b954293e Merge remote-tracking branch 'origin/maint-0.2.2'
Trivial Conflicts in
	src/common/crypto.c
	src/or/main.h
	src/or/or.h
2011-03-16 17:09:32 -04:00
Nick Mathewson
6617822b84 Doxygen documentation for about 100 things that didn't have any
About 860 doxygen-less things remain in 0.2.2
2011-03-16 17:05:37 -04:00
Nick Mathewson
0489f7e004 Merge remote branch 'origin/maint-0.2.2' 2011-01-03 13:19:10 -05:00
Nick Mathewson
27cefef3a2 Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2 2011-01-03 13:18:33 -05:00
Nick Mathewson
5c09431cc7 Never include pthread.h when building for Windows.
On Windows, we never use pthreads, since it doesn't usually exist,
and when it does it tends to be a little weirdly-behaved.  But some
mingw installations have a pthreads installed, so autoconf detects
pthread.h and tells us about it.  This would make us include
pthread.h, which could make for trouble when the iffy pthread.h
tried to include config.h.

This patch changes compat.h so that we never include pthread.h on
Windows.  Fixes bug 2313; bugfix on 0.1.0.1-rc.
2011-01-03 12:45:13 -05:00
Nick Mathewson
8730884ebe Merge remote branch 'origin/maint-0.2.2' 2011-01-03 11:53:28 -05:00
Nick Mathewson
f1de329e78 Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2
Conflicts:
	src/common/test.h
	src/or/test.c
2011-01-03 11:51:17 -05:00
Nick Mathewson
1a07348a50 Bump copyright statements to 2011 2011-01-03 11:50:39 -05:00
Roger Dingledine
c79427a992 Merge branch 'maint-0.2.2' 2010-12-19 22:08:42 -05:00
Nick Mathewson
b5e293afe6 Merge remote branch fix_security_bug_021 into fix_security_bug_022
Conflicts:
	src/common/memarea.c
	src/or/or.h
	src/or/rendclient.c
2010-12-15 22:48:23 -05:00
Nick Mathewson
b8a7bad799 Make payloads into uint8_t.
This will avoid some signed/unsigned assignment-related bugs.
2010-12-15 22:31:11 -05:00
Nick Mathewson
9908404f01 Merge remote branch 'sjmurdoch/cloexec' 2010-12-01 11:42:34 -05:00
Nick Mathewson
3ed7505dc5 Merge remote branch 'origin/maint-0.2.2'
Conflicts:
	src/or/relay.c
2010-11-30 19:23:40 -05:00
Nick Mathewson
89e97bdf94 Add wrappers function for libc random()
On windows, it's called something different.
2010-11-29 16:00:47 -05:00
Nick Mathewson
e669d25e43 Do cloexec on socketpairs and stdio files 2010-11-20 01:16:29 -05:00
Nick Mathewson
5a66de7015 Initial work to set CLOEXEC on all possible fds
Still to go: some pipes, all stdio files.
2010-11-20 00:58:40 -05:00
Nick Mathewson
94a99ad205 Add a portable tor_timercmp
We can't use the platform timercmp, because
  1) some platforms don't have them
  2) some that do have them only support certain relational operators
2010-10-15 12:35:05 -04:00
Nick Mathewson
73d93c033d Autodetect the number of CPUs when possible if NumCPUs==0
This is needed for IOCP, since telling the IOCP backend about all
your CPUs is a good idea.  It'll also come in handy with asn's
multithreaded crypto stuff, and for people who run servers without
reading the manual.
2010-09-28 14:42:21 -04:00
valerino
076063ca90 moved wince related includes and defs to compat.h where possible, removed unused/redundant wince includes 2010-05-24 11:46:54 -04:00
valerino
8d31141ccb Port Tor to work on Windows CE
Most of the changes here are switches to use APIs available on Windows
CE.  The most pervasive change is that Windows CE only provides the
wide-character ("FooW") variants of most of the windows function, and
doesn't support the older ASCII verions at all.

This patch will require use of the wcecompat library to get working
versions of the posix-style fd-based file IO functions.

[commit message by nickm]
2010-05-24 11:46:45 -04:00
Nick Mathewson
927425150b Merge branch 'asprintf' 2010-04-02 12:30:46 -04:00
Nick Mathewson
b006e3279f Merge remote branch 'origin/maint-0.2.1'
Conflicts:
	src/common/test.h
	src/or/test.c
2010-02-27 17:16:31 -05:00
Nick Mathewson
c3e63483b2 Update Tor Project copyright years 2010-02-27 17:14:21 -05:00
Nick Mathewson
f0b5f87eab Add the MIN and MAX macros for platforms that lack them 2010-02-25 16:48:39 -05:00
Nick Mathewson
eb10d441b6 Fix 64-bit printf issues in consensus-bw-weights5-merge.
For my 64-bit Linux system running with GCC 4.4.3-fc12-whatever, you
can't do 'printf("%lld", (int64_t)x);' Instead you need to tell the
compiler 'printf("%lld", (long long int)x);' or else it doesn't
believe the types match.  This is why we added U64_PRINTF_ARG; it
looks like we needed an I64_PRINTF_ARG too.
2010-02-25 16:22:40 -05:00
Nick Mathewson
6fa8dacb97 Add a tor_asprintf() function, and use it in a couple of places.
asprintf() is a GNU extension that some BSDs have picked up: it does a printf
into a newly allocated chunk of RAM.

Our tor_asprintf() differs from standard asprintf() in that:
  - Like our other malloc functions, it asserts on OOM.
  - It works on windows.
  - It always sets its return-field.
2010-02-25 16:09:10 -05:00
Mike Perry
95aad71678 Add %lld compat defines. 2010-02-22 16:52:10 -08:00
Jacob Appelbaum
2aac39a779 Implement DisableAllSwap to avoid putting secret info in page files.
This commit implements a new config option: 'DisableAllSwap'
This option probably only works properly when Tor is started as root.
We added two new functions: tor_mlockall() and tor_set_max_memlock().
tor_mlockall() attempts to mlock() all current and all future memory pages.
For tor_mlockall() to work properly we set the process rlimits for memory to
RLIM_INFINITY (and beyond) inside of tor_set_max_memlock().
We behave differently from mlockall() by only allowing tor_mlockall() to be
called one single time. All other calls will result in a return code of 1.
It is not possible to change DisableAllSwap while running.
A sample configuration item was added to the torrc.complete.in config file.
A new item in the man page for DisableAllSwap was added.
Thanks to Moxie Marlinspike and Chris Palmer for their feedback on this patch.

Please note that we make no guarantees about the quality of your OS and its
mlock/mlockall implementation. It is possible that this will do nothing at all.
It is also possible that you can ulimit the mlock properties of a given user
such that root is not required. This has not been extensively tested and is
unsupported. I have included some comments for possible ways we can handle
this on win32.
2009-10-27 04:28:40 -04:00
Mike Perry
9e1fe29beb Switch over to tor_strtok_r instead of strtok_r. 2009-08-09 18:42:29 -07:00
Nick Mathewson
3886467f38 Add a new tor_strtok_r for platforms that don't have one, plus tests.
I don't think we actually use (or plan to use) strtok_r in a reentrant
way anywhere in our code, but would be nice not to have to think about
whether we're doing it.
2009-08-09 17:30:15 -07:00
Nick Mathewson
fd992deeea Don't attempt to log messages to a controller from a worker thread.
This patch adds a function to determine whether we're in the main
thread, and changes control_event_logmsg() to return immediately if
we're in a subthread.  This is necessary because otherwise we will
call connection_write_to_buf, which modifies non-locked data
structures.

Bugfix on 0.2.0.x; fix for at least one of the things currently
called "bug 977".
2009-05-30 18:16:24 -04:00
Nick Mathewson
ec7e054668 Spell-check Tor. 2009-05-27 17:55:51 -04:00
Karsten Loesing
9b32e8c141 Update copyright to 2009. 2009-05-04 11:28:27 -04:00
Nick Mathewson
9f8d095e0f Add and use set/get_uint64 on onion tags. [bug 604; backportable]
It seems that 64-bit Sparc Solaris demands 64-bit-aligned access to
uint64_t, but does not 64-bit-align the stack-allocated char array we
use for cpuworker tags.  So this patch adds a set/get_uint64 pair, and
uses them to access the conn_id field in the tag.

svn:r18743
2009-03-02 19:15:05 +00:00
Nick Mathewson
3f8ab367c1 Fix warning on panther compile, and bug 913. Backport candidate.
svn:r18203
2009-01-21 03:51:14 +00:00
Nick Mathewson
a87980c2eb Add a better (non-locale-having) ctypes implementation to avoid protocol and parsing mismatches on different platforms.
svn:r18189
2009-01-20 21:33:56 +00:00
Nick Mathewson
c4b8fef362 Remove svn $Id$s from our source, and remove tor --version --version.
The subversion $Id$ fields made every commit force a rebuild of
whatever file got committed.  They were not actually useful for
telling the version of Tor files in the wild.

svn:r17867
2009-01-04 00:35:51 +00:00
Nick Mathewson
52932d6f1a Remove some code that is #ifdefed out, and that we no longer seem to use, if we ever did.
svn:r17827
2008-12-30 04:16:49 +00:00
Nick Mathewson
e8a3fa91a6 Use a consistent naming standard for header file guard macros, taking care not to collide with any system headers. This tripped us up on Android.
svn:r17805
2008-12-29 02:21:02 +00:00
Nick Mathewson
4277b0e926 Remove some cargo-cult gcc hacks around tor_assert and predict_unlikely; instead, use the standard convert-to-boolean hack of "svn st"
svn:r17597
2008-12-11 20:23:46 +00:00
Nick Mathewson
7f793fa733 Simplify mmap object layout to avoid confusing static analysis tools, and us too.
svn:r17490
2008-12-05 02:17:41 +00:00
Nick Mathewson
6221bdd294 Add two lseek wrappers to compat.[ch]: one to return current fd position, and one to move the fd to the end of the file.
svn:r17454
2008-12-02 23:26:04 +00:00
Nick Mathewson
60738daf85 Define socklen_t before using it in compat.h
svn:r17444
2008-12-02 18:54:47 +00:00
Nick Mathewson
a790a13705 define get_uint8 and set_uint8 macros to make code cleaner.
svn:r17261
2008-11-12 14:39:25 +00:00
Steven Murdoch
9d68ed08e9 Patch from Jacob Appelbaum and me to make User option more robust, properly set supplementary groups, deprecated the Group option, and log more information on credential switching
svn:r17200
2008-11-07 02:06:12 +00:00
Nick Mathewson
0ab45fee73 Document some dmalloc stuff and some stupid C tricks.
svn:r17161
2008-10-27 16:30:52 +00:00
Nick Mathewson
f80ac31d74 Add a lockfile to the Tor data directory to avoid situations where two Tors start with the same datadir, or where a --list-fingerprints races with a server to create keys, or such.
svn:r16722
2008-09-01 20:06:26 +00:00
Roger Dingledine
6942bd66ea Fix compile on OpenBSD 4.4-current. Bugfix on 0.2.1.5-alpha.
Reported by Tas.


svn:r16713
2008-09-01 08:01:22 +00:00
Roger Dingledine
c5fef3c57f commit jake's patch to include strings with socks5 error numbers
svn:r16657
2008-08-25 21:02:22 +00:00
Nick Mathewson
88e6162649 r17848@tombo: nickm | 2008-08-22 12:10:11 -0400
Make definition of tor_mutex_t go into compat.h, so that it is possible to inline mutexes in critical objects.  Add init/uninit functions for mutexes allocated inside other structs.


svn:r16623
2008-08-22 16:24:52 +00:00
Nick Mathewson
9da0482007 r17358@pc-10-8-1-079: nickm | 2008-07-25 16:41:03 +0200
Split out the address manipulation functions from compat and util: they were about 21% of the total of those, and spread out too much.


svn:r16208
2008-07-25 14:43:24 +00:00
Nick Mathewson
3ce6e2fba2 r17346@aud-055: nickm | 2008-07-24 15:37:19 +0200
Make generic address manipulation functions work better.  Switch address policy code to use tor_addr_t, so it can handle IPv6.  That is a good place to start.


svn:r16178
2008-07-24 13:44:04 +00:00
Nick Mathewson
c5ec7a3677 Stop using __attribute__((nonnull)): It gets us occcasional warnings when we do something so foolish it can be detected without dataflow analysis, but it also eliminates some of our error checking code. Suggested by Peter Gutmann.
svn:r15803
2008-07-09 15:23:23 +00:00
Nick Mathewson
09cd8fa371 r19795@catbus: nickm | 2008-05-16 14:54:24 -0400
Rename tor_addr_t manipulation functions for a consistent style.


svn:r14639
2008-05-16 19:19:49 +00:00
Nick Mathewson
daefbfe691 r14371@tombo: nickm | 2008-02-21 16:13:18 -0500
Fix all -Wshorten-64-to-32 warnings that appear on my macbook.


svn:r13662
2008-02-21 21:15:31 +00:00
Nick Mathewson
1df0647c66 r18291@catbus: nickm | 2008-02-20 22:35:32 -0500
Resolve all DOCDOC issues, and document some other undocumented code, and fix a changelog entry.


svn:r13638
2008-02-21 03:38:46 +00:00
Nick Mathewson
93aa335516 r18269@catbus: nickm | 2008-02-20 17:28:24 -0500
Apply patch from Sebastian Hahn: stop imposing an arbitrary maximum on the number of file descriptors used for busy servers.  Bug reported by Olaf Selke.


svn:r13626
2008-02-20 22:28:26 +00:00
Nick Mathewson
9479dd3768 r18226@catbus: nickm | 2008-02-19 18:01:01 -0500
Brown-paper-bag time.  We were failing to count all the sockets from accept().


svn:r13595
2008-02-19 23:01:07 +00:00
Nick Mathewson
f4dc006fb5 r18198@catbus: nickm | 2008-02-19 14:30:30 -0500
Try to *fix* the socket counting problem, and add an info log to detect whether we really fixed it


svn:r13580
2008-02-19 19:30:41 +00:00
Nick Mathewson
418c2e1b6b r14181@tombo: nickm | 2008-02-15 16:48:17 -0500
Fix all but 2 DOCDOC items; defer many XXX020s (particularly those where fixing them would fix no bugs at the risk of introducing some bugs).


svn:r13529
2008-02-15 23:39:04 +00:00
Nick Mathewson
f3eaeb99a3 r18051@catbus: nickm | 2008-02-12 15:20:43 -0500
Re-tune mempool parametes based on testing on peacetime: use smaller chuncks, free them a little more aggressively, and try very hard to concentrate allocations on fuller chunks.  Also, lots of new documentation.


svn:r13484
2008-02-12 20:20:52 +00:00
Nick Mathewson
842a33ff20 Update some copyright notices: it is now 2008.
svn:r13412
2008-02-07 05:31:47 +00:00
Nick Mathewson
ac69319d3f r17899@catbus: nickm | 2008-02-05 14:14:06 -0500
Fix a couple of XXX020 items. Also, disable all "condition" sychronization code, since Tor does not use it yet


svn:r13380
2008-02-05 19:40:19 +00:00
Nick Mathewson
54029559d7 Apparently, our windows code for detecting ipv6 structures has worked for a while. Remove the special-case, remove the related XXXX020s, and add useful comments instead.
svn:r13377
2008-02-05 19:36:06 +00:00
Nick Mathewson
6d58d80e78 r17472@catbus: nickm | 2008-01-05 22:10:19 -0500
Another test for the increasingly bad check-spaces style checker to check: #else\n#if is almost a sure sign of a failure to use #elif.  Fortunately, we only did that 3 times.


svn:r13039
2008-01-06 03:16:08 +00:00
Roger Dingledine
1d8a8063b9 clean up copyrights, and assign 2007 copyrights to The Tor Project, Inc
svn:r12786
2007-12-12 21:09:01 +00:00
Nick Mathewson
bd49bba49e r17091@catbus: nickm | 2007-12-11 18:05:55 -0500
Fix compilation when --disable-threads is passed in.


svn:r12768
2007-12-11 23:06:51 +00:00
Nick Mathewson
f948caad7b r15161@tombo: nickm | 2007-12-05 11:30:37 -0500
Fix bug reported by Steve Murphy on or-talk: detect the s6_addr32 and s6_addr16 fields via autoconf.


svn:r12679
2007-12-05 16:30:52 +00:00
Nick Mathewson
593ab7e808 r15106@tombo: nickm | 2007-12-04 00:08:35 -0500
Change tor_addr_t to be a tagged union of in_addr and in6_addr, not of sockaddr_in and sockaddr_in6.  It's hardly used in the main code as it is, but let's get it right before it gets popular.


svn:r12660
2007-12-04 05:19:56 +00:00
Nick Mathewson
42172829ce r16016@catbus: nickm | 2007-10-21 20:44:19 -0400
Check a platform assumption we have made without checking for too long: "Characters are represented in ascii."


svn:r12088
2007-10-22 00:44:42 +00:00
Nick Mathewson
a237f25f9a r14651@catbus: nickm | 2007-08-17 21:37:03 -0400
Another attempt to confirm to msvc for bug 482.


svn:r11162
2007-08-18 01:38:11 +00:00
Nick Mathewson
1f244d3943 r14639@catbus: nickm | 2007-08-17 17:45:28 -0400
Compile without warnings on MinGW, even with --enable-gcc-warnings enabled.


svn:r11157
2007-08-17 21:46:34 +00:00
Nick Mathewson
f8b3927e07 r14634@catbus: nickm | 2007-08-17 16:43:49 -0400
Try to fix bug 482: do not rely on s6_addr16 or s6_addr32 on MSVC.  How ugly.


svn:r11155
2007-08-17 20:44:54 +00:00
Nick Mathewson
ba28346f2f r13907@Kushana: nickm | 2007-08-02 10:29:13 -0700
Try (once again) to fix mingw build wrt detecting ipv6 types.


svn:r11037
2007-08-02 17:30:42 +00:00
Nick Mathewson
484c8b776d r13872@Kushana: nickm | 2007-07-31 08:27:54 -0700
Rename IN4_ADDR and IN6_ADDR to try to avoid conflicting with Windows definitions.  This may fix the windows build.


svn:r11011
2007-08-01 15:57:34 +00:00
Nick Mathewson
25bd4204d0 r13964@catbus: nickm | 2007-07-28 22:55:10 -0400
Change "IN_ADDR" macro to "IN4_ADDR" in an attempt to fix mingw compilation


svn:r10963
2007-07-29 02:55:24 +00:00
Nick Mathewson
189bc7cf9f r13920@catbus: nickm | 2007-07-26 16:25:25 -0400
whitespace fixes


svn:r10935
2007-07-26 20:26:53 +00:00
Nick Mathewson
a1f4644a94 r13840@catbus: nickm | 2007-07-19 16:00:43 -0400
Apparently, this problem can occur on the whole BSD family. "Yay."


svn:r10884
2007-07-19 20:00:45 +00:00
Nick Mathewson
b2772f93cb r13838@catbus: nickm | 2007-07-19 15:50:16 -0400
Apparently, OSX does not define s6_addr32 or s6_addr16. How silly.


svn:r10883
2007-07-19 19:50:20 +00:00
Nick Mathewson
bbbf504281 r13827@catbus: nickm | 2007-07-19 14:42:25 -0400
Merge in some generic address manipulation code from croup.  Needs some work.


svn:r10880
2007-07-19 18:46:09 +00:00
Nick Mathewson
ae4ab0f617 r13454@kushana: nickm | 2007-06-20 14:22:44 -0400
Switch windows locking implementation to CRITICAL_SECTION, not Mutex: Mutex is heavier-weight, and meant for multi-process situations.


svn:r10739
2007-07-05 14:51:01 +00:00
Nick Mathewson
1bdcfd9203 r13570@catbus: nickm | 2007-06-30 20:41:05 -0400
Implement conditions in compat.c; switch windows to use "critical sections" instead of mutexes.  Apparently, mutexes are for IPC and critical sections are for multithreaded.


svn:r10716
2007-07-01 16:22:45 +00:00
Nick Mathewson
5adfa09fce r13477@catbus: nickm | 2007-06-17 14:22:03 -0400
Sun CC likes to give warnings for the do { } while(0) construction for making statement-like macros.  Define STMT_BEGIN/STMT_END macros that do the right thing, and use them everywhere.


svn:r10645
2007-06-17 18:22:39 +00:00
Nick Mathewson
71c0a13703 r13110@catbus: nickm | 2007-05-31 15:03:24 -0400
Fix windows build.


svn:r10424
2007-05-31 19:03:46 +00:00
Nick Mathewson
bb524e99c9 r12955@catbus: nickm | 2007-05-25 13:17:30 -0400
First bare stubs of ipv6 work: commit some (untested, hence doublessly broken) implementations of inet_ntop/pton for systems that lack them.


svn:r10326
2007-05-25 18:22:37 +00:00
Nick Mathewson
d3d86b17a7 r12916@catbus: nickm | 2007-05-24 12:43:45 -0400
Add math functions to round values to the nearest power of 2.  Make mempools more careful about making sure that the size of their chunks is a little less than a power of 2, not a little more.


svn:r10304
2007-05-24 17:12:57 +00:00
Nick Mathewson
4ec5e139c8 r12850@catbus: nickm | 2007-05-21 22:20:42 -0400
Partial backport candidate: do not rely on finding a \0 after an mmaped() router/extrainfo file.  Also, set journal length correctly when starting up.


svn:r10248
2007-05-22 02:20:52 +00:00
Nick Mathewson
e043b86f47 r12764@catbus: nickm | 2007-05-15 17:17:39 -0400
Enable (and cope with) more GCC 4.2 warnings.


svn:r10196
2007-05-15 21:17:48 +00:00
Nick Mathewson
227b2e0226 r12759@Kushana: nickm | 2007-04-20 08:47:20 -0400
Track the number of connection_t separately from the number of open sockets.  It is already possible to have connections that do not count: resolving conns, for one.  Once we move from socketpairs to linked conns, and once we do dns proxying, there will be lots of such connections.


svn:r9994
2007-04-21 17:24:18 +00:00
Nick Mathewson
d62e37b4a9 r12473@Kushana: nickm | 2007-03-06 15:49:45 -0500
Excise PREDICT and PREDICT_FALSE in favor of PREDICT_LIKELY and PREDICT_UNLIKELY.


svn:r9781
2007-03-09 21:39:19 +00:00
Nick Mathewson
5d1bee87ff r12468@Kushana: nickm | 2007-03-06 15:24:00 -0500
More unit tests: gcov is fun.


svn:r9748
2007-03-06 20:25:44 +00:00
Nick Mathewson
e2b1a77c3e r12006@catbus: nickm | 2007-02-28 16:06:24 -0500
On mingw, use "%I64u" to printf/scanf 64-bit integers, instead of the usual GCC "%llu".  This prevents a bug when saving 64-bit int configuration values on mingw; the high-order 32 bits would get truncated.  If the value was then reloaded, disaster would occur. (Fixes bug 400 and maybe also bug 397.)  Backport candidate.


svn:r9691
2007-02-28 21:07:19 +00:00
Nick Mathewson
dfbced7499 r11998@catbus: nickm | 2007-02-28 13:56:55 -0500
Correct an MSC_VER check.


svn:r9685
2007-02-28 18:57:03 +00:00
Nick Mathewson
e1176ece5a r11992@catbus: nickm | 2007-02-28 12:46:32 -0500
compile fix on mingw: mingw does not define _MSC_VER.


svn:r9682
2007-02-28 17:46:36 +00:00
Nick Mathewson
759c58151e r11775@catbus: nickm | 2007-02-12 16:39:09 -0500
Update copyright dates.


svn:r9570
2007-02-12 21:39:53 +00:00
Nick Mathewson
30e7c05075 r11774@catbus: nickm | 2007-02-12 16:31:47 -0500
Handle errors on opening cached-routers* more uniformly and sanely: log not-found errors at level INFO, and all other errors at level WARN.  Needs testing on win32.


svn:r9569
2007-02-12 21:39:44 +00:00
Nick Mathewson
76f896e714 r11607@catbus: nickm | 2007-01-30 17:19:27 -0500
Audit non-const char arguments; make a lot more of them const.


svn:r9466
2007-01-30 22:19:41 +00:00
Nick Mathewson
50771a6b48 r9380@Kushana: nickm | 2006-10-24 21:25:07 -0400
Add string.h include to compat.h so that strlcpy() and strlcat() will always be defined after including compat.h.  This should resolve warnings on centos.


svn:r8824
2006-10-25 01:25:17 +00:00
Nick Mathewson
7551c44a53 r9274@Kushana: nickm | 2006-10-19 16:16:58 -0400
Add unit tests for tor_mmap_file(); make tor_mmap_t.size always be the size of the file (not the size of the mapping); add an extra argument to read_file_to_str() so it can return the size of the result string.


svn:r8762
2006-10-19 23:05:02 +00:00
Nick Mathewson
93beeac01d Merge in some bsockets calls, all wrapped inside #if defined(USE_BSOCKETS)
svn:r8427
2006-09-19 20:41:31 +00:00
Nick Mathewson
000b7b287c r8724@Kushana: nickm | 2006-09-06 04:32:28 -0400
Fix spaces; restore support for mapping files over 4GB on win32 (?)


svn:r8326
2006-09-06 08:42:16 +00:00
Mike Chiussi
6ec9c1092a - made configure check if we are building for win32
- made configure link to required system dll's if building for win32
- added diffs for libevent 1.1b
- forced user to turn off eventdns if win32 is set 
- cleaned up tor_mmap_file()_win32 (not sure if it's stable)
- cleaned up some warnings and typos




svn:r8322
2006-09-06 01:49:55 +00:00
Nick Mathewson
f170e5798f r8692@Kushana: nickm | 2006-08-31 13:38:07 -0400
Fix bug 327 (part 2): Cast char to unsigned char before passing to toupper/tolower.  (Follow the same idiom as with isupper and friends, in case we run into the same problem on SGI or whereever it was.)


svn:r8310
2006-08-31 17:39:51 +00:00
Nick Mathewson
bc0c39f85d r8691@Kushana: nickm | 2006-08-31 13:30:46 -0400
Fix bug 327 (part 1): Use correct macro to test for GCC 3 or later.


svn:r8309
2006-08-31 17:39:47 +00:00
Nick Mathewson
fee33d2ff1 r8682@Kushana: nickm | 2006-08-29 17:58:59 -0400
Fix compilation on GCC2 by disabling fun attributes unless __GNUC_MAJOR__ >= 3.


svn:r8303
2006-08-29 21:59:20 +00:00
Nick Mathewson
6fcdcc7fc7 r8626@Kushana: nickm | 2006-08-27 23:45:46 -0400
Aw, crap.  Non-gcc bug.  We need regular windows builds.


svn:r8259
2006-08-28 03:46:21 +00:00
Nick Mathewson
ffab3b48a8 r7326@Kushana: nickm | 2006-08-10 23:50:49 -0700
And another GCC change: predict that tor_frees() are usually real frees, and tor_asserts() usually wont happen. Other test should wait till -fprofile-arcs


svn:r7022
2006-08-11 07:09:35 +00:00
Nick Mathewson
09a895e222 r7324@Kushana: nickm | 2006-08-10 23:23:15 -0700
Add more warnings to the list of those we tolerate. Start using GCC attributes more, for better error checking and better code generation.


svn:r7020
2006-08-11 07:09:17 +00:00
Nick Mathewson
7c596c166b r7029@Kushana: nickm | 2006-08-04 14:08:41 -0700
Remove now-spurious size and data arguments from tor_mmap_file


svn:r6987
2006-08-05 17:53:21 +00:00
Nick Mathewson
dbac3fb481 r7028@Kushana: nickm | 2006-08-04 13:10:16 -0700
Make data and size fields visible in tor_mmap_t; hide win magic differently.


svn:r6986
2006-08-05 17:53:08 +00:00
Nick Mathewson
bf72878cad r7012@Kushana: nickm | 2006-08-03 19:21:25 -0700
Add an "mmap handle" type to encapsulate bookkeeping elements of mmap issues; add prelim win32 impl


svn:r6980
2006-08-04 18:32:43 +00:00
Nick Mathewson
3843b1b3d0 r6978@Kushana: nickm | 2006-07-31 13:16:14 -0400
Add isupper and islower wrappers to compat.h


svn:r6957
2006-07-31 18:01:22 +00:00
Nick Mathewson
08a4114abf Another MSVC6 fix. Grnk.
svn:r6802
2006-07-21 14:53:23 +00:00
Nick Mathewson
e572d5990c MSVC6 is apparently terrified of unnatural cross-breeding between uint64_t and double, and needs more persuasion than usual to cast one to the other. Issue identified by Frediano Ziglio; patch revised for minimal impact on non-MSVC6 compilers.
svn:r6768
2006-07-17 00:39:05 +00:00
Roger Dingledine
35e95d7783 minor fixes
svn:r6710
2006-07-04 03:25:07 +00:00
Roger Dingledine
45065f1466 simplify code now that libevent considers all sockets pollable.
what we really mean now is ">= 0", which is clearer to test for.


svn:r6543
2006-06-05 09:08:10 +00:00
Nick Mathewson
86da3e0a0a Patch based on post by Mike C to or-dev; special-case based on use of MSVC, rather than on MS_WINDOWS, so that mingw builds.
svn:r6523
2006-06-03 18:52:31 +00:00
Nick Mathewson
64d487a2d6 Add a basic mmap function, with a "fake-it" wrapper to do read_file_from_str instead. Based on code from Michael Mohr.
svn:r6510
2006-05-28 16:54:39 +00:00
Nick Mathewson
89a8411ace Throw out this UNALIGNED_INT_ACCESS_OK nonsense. Even where it works, it is often way way slower than doing the right thing. Backport candidate.
svn:r6473
2006-05-23 08:23:03 +00:00
Nick Mathewson
0f0e14c6e3 normalize whitespace.
svn:r6173
2006-03-17 04:43:37 +00:00
Nick Mathewson
0c132ee2a1 Instead of listing a set of compilers that prefers __func__ to __FUNCTION__, use autoconf. Also, prefer __func__ in our own code: __func__ is a C99 standard, whereas __FUNCTION__ is not. [Fixes bug 254.]
svn:r6144
2006-03-13 00:25:36 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Roger Dingledine
6f579deff4 check for EADDRINUSE in a cross-platform way (unless i'm wrong)
svn:r5899
2006-02-03 12:25:46 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +00:00
Roger Dingledine
130d0e4d1d fix typo noticed by scrimbly
svn:r5522
2005-12-07 19:49:18 +00:00
Nick Mathewson
932106f54c Efficiency hack: call tor_fix_source_file late, not early. Add "BUG" domain. Domains are now bitmasks... just in case. Make some err msgs non-general.
svn:r5309
2005-10-25 07:05:03 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
6973ef9be4 Add a touch_file() function to compat so we can update cache mtimes.
svn:r5067
2005-09-14 23:27:52 +00:00
Nick Mathewson
d26523e089 Use tor_listdir in test.c instead of duplicating ode.
svn:r4981
2005-09-10 01:42:42 +00:00
Nick Mathewson
789374dbbd Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.
svn:r4770
2005-08-12 17:24:53 +00:00
Roger Dingledine
cfd6514482 and a nearby define
svn:r4643
2005-07-23 02:19:43 +00:00
Nick Mathewson
b98e4a0cd7 add parenthesis to U64_PRINTF_ARG macro
svn:r4642
2005-07-23 02:12:40 +00:00
Nick Mathewson
5fee58adfb Add a tor_memmem function
svn:r4452
2005-06-18 02:17:11 +00:00
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00