mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
r8724@Kushana: nickm | 2006-09-06 04:32:28 -0400
Fix spaces; restore support for mapping files over 4GB on win32 (?) svn:r8326
This commit is contained in:
parent
dffa692d05
commit
000b7b287c
@ -167,22 +167,22 @@ tor_mmap_file(const char *filename)
|
|||||||
res->mmap_handle = res->file_handle = INVALID_HANDLE_VALUE;
|
res->mmap_handle = res->file_handle = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
res->file_handle = CreateFile(filename,
|
res->file_handle = CreateFile(filename,
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (res->file_handle == INVALID_HANDLE_VALUE)
|
if (res->file_handle == INVALID_HANDLE_VALUE)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
res->base.size = GetFileSize(res->file_handle, NULL);
|
res->base.size = GetFileSize(res->file_handle, NULL);
|
||||||
|
|
||||||
res->mmap_handle = CreateFileMapping(res->file_handle,
|
res->mmap_handle = CreateFileMapping(res->file_handle,
|
||||||
NULL,
|
NULL,
|
||||||
PAGE_READONLY,
|
PAGE_READONLY,
|
||||||
0,
|
(res->base.size >> 32),
|
||||||
res->base.size,
|
(res->base.size & 0xfffffffful),
|
||||||
NULL);
|
NULL);
|
||||||
if (res->mmap_handle != INVALID_HANDLE_VALUE)
|
if (res->mmap_handle != INVALID_HANDLE_VALUE)
|
||||||
goto err;
|
goto err;
|
||||||
@ -426,8 +426,8 @@ void
|
|||||||
set_socket_nonblocking(int socket)
|
set_socket_nonblocking(int socket)
|
||||||
{
|
{
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
unsigned long nonblocking = 1;
|
unsigned long nonblocking = 1;
|
||||||
ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
|
ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
|
||||||
#else
|
#else
|
||||||
fcntl(socket, F_SETFL, O_NONBLOCK);
|
fcntl(socket, F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
#endif
|
||||||
@ -572,7 +572,7 @@ set_max_file_descriptors(unsigned long limit, unsigned long cap)
|
|||||||
log_fn(LOG_INFO, LD_NET,
|
log_fn(LOG_INFO, LD_NET,
|
||||||
"This platform is missing getrlimit(). Proceeding.");
|
"This platform is missing getrlimit(). Proceeding.");
|
||||||
if (limit < cap) {
|
if (limit < cap) {
|
||||||
log_info(LD_CONFIG, "ConnLimit must be at most %d. Using that.", (int) cap);
|
log_info(LD_CONFIG, "ConnLimit must be at most %d. Using that.", (int)cap);
|
||||||
limit = cap;
|
limit = cap;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -809,8 +809,6 @@ static int uname_result_is_set = 0;
|
|||||||
const char *
|
const char *
|
||||||
get_uname(void)
|
get_uname(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_UNAME
|
#ifdef HAVE_UNAME
|
||||||
struct utsname u;
|
struct utsname u;
|
||||||
#endif
|
#endif
|
||||||
@ -864,7 +862,6 @@ get_uname(void)
|
|||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.dwOSVersionInfoSize = sizeof(info);
|
info.dwOSVersionInfoSize = sizeof(info);
|
||||||
if (! GetVersionEx((LPOSVERSIONINFO)&info)) {
|
if (! GetVersionEx((LPOSVERSIONINFO)&info)) {
|
||||||
|
|
||||||
strlcpy(uname_result, "Bizarre version of Windows where GetVersionEx"
|
strlcpy(uname_result, "Bizarre version of Windows where GetVersionEx"
|
||||||
" doesn't work.", sizeof(uname_result));
|
" doesn't work.", sizeof(uname_result));
|
||||||
uname_result_is_set = 1;
|
uname_result_is_set = 1;
|
||||||
@ -1004,7 +1001,6 @@ spawn_func(void (*func)(void *), void *data)
|
|||||||
|
|
||||||
/** End the current thread/process.
|
/** End the current thread/process.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
spawn_exit(void)
|
spawn_exit(void)
|
||||||
{
|
{
|
||||||
@ -1161,7 +1157,7 @@ tor_mutex_acquire(tor_mutex_t *m)
|
|||||||
tor_assert(0);
|
tor_assert(0);
|
||||||
break;
|
break;
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
log_warn(LD_GENERAL, "Failed to acquire mutex: %d", (int) GetLastError());
|
log_warn(LD_GENERAL, "Failed to acquire mutex: %d",(int) GetLastError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
@ -319,9 +319,7 @@ unsigned long tor_get_thread_id(void);
|
|||||||
#define VER_SUITE_SINGLEUSERTS 0x00000100
|
#define VER_SUITE_SINGLEUSERTS 0x00000100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2761,7 +2761,7 @@ options_init_from_torrc(int argc, char **argv)
|
|||||||
fname = tor_strdup(dflt);
|
fname = tor_strdup(dflt);
|
||||||
} else {
|
} else {
|
||||||
#ifndef MS_WINDOWS
|
#ifndef MS_WINDOWS
|
||||||
char *fn;
|
char *fn;
|
||||||
fn = expand_filename("~/.torrc");
|
fn = expand_filename("~/.torrc");
|
||||||
if (fn && file_status(fn) == FN_FILE) {
|
if (fn && file_status(fn) == FN_FILE) {
|
||||||
fname = fn;
|
fname = fn;
|
||||||
|
Loading…
Reference in New Issue
Block a user