OLD | NEW |
(Empty) | |
| 1 diff --git a/src/common/compat.c b/src/common/compat.c |
| 2 --- a/src/common/compat.c |
| 3 +++ b/src/common/compat.c |
| 4 @@ -1542,6 +1542,11 @@ set_max_file_descriptors(rlim_t limit, int *max_out) |
| 5 * http://archives.seul.org/or/talk/Aug-2006/msg00210.html |
| 6 * For an iPhone, 9999 should work. For Windows and all other unknown |
| 7 * systems we use 15000 as the default. */ |
| 8 + |
| 9 +#ifdef __native_client__ |
| 10 +#undef HAVE_GETRLIMIT |
| 11 +#endif |
| 12 + |
| 13 #ifndef HAVE_GETRLIMIT |
| 14 #if defined(CYGWIN) || defined(__CYGWIN__) |
| 15 const char *platform = "Cygwin"; |
| 16 @@ -3225,4 +3230,3 @@ tor_sleep_msec(int msec) |
| 17 #endif |
| 18 } |
| 19 #endif |
| 20 - |
| 21 diff --git a/src/common/util.c b/src/common/util.c |
| 22 --- a/src/common/util.c |
| 23 +++ b/src/common/util.c |
| 24 @@ -2191,9 +2191,12 @@ check_private_dir(const char *dirname, cpd_check_t check, |
| 25 "%s (%d). Perhaps you are running Tor as the wrong user?", |
| 26 dirname, process_ownername, (int)running_uid, |
| 27 pw ? pw->pw_name : "<unknown>", (int)st.st_uid); |
| 28 - |
| 29 tor_free(process_ownername); |
| 30 +#ifdef __native_client__ |
| 31 + printf("\n>> nacl sometimes doesn't set UID properly, ignoring...\n"); |
| 32 +#else |
| 33 return -1; |
| 34 +#endif |
| 35 } |
| 36 if ( (check & (CPD_GROUP_OK|CPD_GROUP_READ)) |
| 37 && (st.st_gid != running_gid) ) { |
| 38 @@ -5421,4 +5424,3 @@ tor_weak_random_range(tor_weak_rng_t *rng, int32_t top) |
| 39 } while (result >= top); |
| 40 return result; |
| 41 } |
| 42 - |
| 43 diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c |
| 44 --- a/src/ext/csiphash.c |
| 45 +++ b/src/ext/csiphash.c |
| 46 @@ -56,7 +56,13 @@ |
| 47 # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) |
| 48 # include <sys/endian.h> |
| 49 # else |
| 50 -# include <endian.h> |
| 51 +# ifdef _NEWLIB_VERSION // if TOOLCHAIN=newlib |
| 52 + // newlib endian.h doesn't contain le64toh() |
| 53 + // nacl is little endian thus le64toh is a nop |
| 54 +# define le64toh(x) (x) |
| 55 +# else // the usual |
| 56 +# include <endian.h> |
| 57 +# endif |
| 58 # endif |
| 59 # if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ |
| 60 __BYTE_ORDER == __LITTLE_ENDIAN |
| 61 diff --git a/src/or/config.c b/src/or/config.c |
| 62 --- a/src/or/config.c |
| 63 +++ b/src/or/config.c |
| 64 @@ -1375,10 +1375,14 @@ options_act(const or_options_t *old_options) |
| 65 /* Write control ports to disk as appropriate */ |
| 66 control_ports_write_to_file(); |
| 67 |
| 68 +// nacl_io don't support file locking (yet) |
| 69 +// #TODO(dt) remove following,once file locking is supported |
| 70 +#ifndef __native_client__ |
| 71 if (running_tor && !have_lockfile()) { |
| 72 if (try_locking(options, 1) < 0) |
| 73 return -1; |
| 74 } |
| 75 +#endif |
| 76 |
| 77 if (consider_adding_dir_servers(options, old_options) < 0) |
| 78 return -1; |
| 79 @@ -7109,4 +7113,3 @@ init_cookie_authentication(const char *fname, const char *
header, |
| 80 tor_free(cookie_file_str); |
| 81 return retval; |
| 82 } |
| 83 - |
| 84 diff --git a/src/or/main.c b/src/or/main.c |
| 85 --- a/src/or/main.c |
| 86 +++ b/src/or/main.c |
| 87 @@ -2402,6 +2402,11 @@ void |
| 88 handle_signals(int is_parent) |
| 89 { |
| 90 #ifndef _WIN32 /* do signal stuff only on Unix */ |
| 91 +#ifdef __native_client__ |
| 92 +// nacl doesn't support signals(no support in libevent) |
| 93 +(void)is_parent; |
| 94 +return; |
| 95 +#endif |
| 96 int i; |
| 97 static const int signals[] = { |
| 98 SIGINT, /* do a controlled slow shutdown */ |
| 99 @@ -3127,4 +3132,3 @@ tor_main(int argc, char *argv[]) |
| 100 tor_cleanup(); |
| 101 return result; |
| 102 } |
| 103 - |
OLD | NEW |