Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
db1a420c
Commit
db1a420c
authored
Jun 28, 2018
by
Nick Mathewson
👁
Browse files
Move tor_gethostname to lib/net
parent
8c6ff9fe
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/common/compat.c
View file @
db1a420c
...
...
@@ -257,17 +257,6 @@ set_max_file_descriptors(rlim_t limit, int *max_out)
return
0
;
}
/** Get name of current host and write it to <b>name</b> array, whose
* length is specified by <b>namelen</b> argument. Return 0 upon
* successful completion; otherwise return return -1. (Currently,
* this function is merely a mockable wrapper for POSIX gethostname().)
*/
MOCK_IMPL
(
int
,
tor_gethostname
,(
char
*
name
,
size_t
namelen
))
{
return
gethostname
(
name
,
namelen
);
}
/** Hold the result of our call to <b>uname</b>. */
static
char
uname_result
[
256
];
/** True iff uname_result is set. */
...
...
src/common/compat.h
View file @
db1a420c
...
...
@@ -111,8 +111,6 @@
/* ===== Net compatibility */
MOCK_DECL
(
int
,
tor_gethostname
,(
char
*
name
,
size_t
namelen
));
/** Specified SOCKS5 status codes. */
typedef
enum
{
SOCKS5_SUCCEEDED
=
0x00
,
...
...
src/common/util.h
View file @
db1a420c
...
...
@@ -72,7 +72,6 @@ int64_t clamp_double_to_int64(double number);
/* String manipulation */
/* Time helpers */
long
tv_udiff
(
const
struct
timeval
*
start
,
const
struct
timeval
*
end
);
long
tv_mdiff
(
const
struct
timeval
*
start
,
const
struct
timeval
*
end
);
...
...
src/lib/net/gethostname.c
0 → 100644
View file @
db1a420c
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#include
"orconfig.h"
#include
"lib/net/gethostname.h"
#ifdef HAVE_UNISTD_H
#include
<unistd.h>
#endif
#ifdef _WIN32
#include
<winsock2.h>
#endif
/** Get name of current host and write it to <b>name</b> array, whose
* length is specified by <b>namelen</b> argument. Return 0 upon
* successful completion; otherwise return return -1. (Currently,
* this function is merely a mockable wrapper for POSIX gethostname().)
*/
MOCK_IMPL
(
int
,
tor_gethostname
,(
char
*
name
,
size_t
namelen
))
{
return
gethostname
(
name
,
namelen
);
}
src/lib/net/gethostname.h
0 → 100644
View file @
db1a420c
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_GETHOSTNAME_H
#define TOR_GETHOSTNAME_H
#include
"lib/testsupport/testsupport.h"
#include
<stddef.h>
MOCK_DECL
(
int
,
tor_gethostname
,(
char
*
name
,
size_t
namelen
));
#endif
src/lib/net/include.am
View file @
db1a420c
...
...
@@ -8,6 +8,7 @@ endif
src_lib_libtor_net_a_SOURCES = \
src/lib/net/address.c \
src/lib/net/alertsock.c \
src/lib/net/gethostname.c \
src/lib/net/ipv4.c \
src/lib/net/ipv6.c \
src/lib/net/resolve.c \
...
...
@@ -21,6 +22,7 @@ src_lib_libtor_net_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
noinst_HEADERS += \
src/lib/net/address.h \
src/lib/net/alertsock.h \
src/lib/net/gethostname.h \
src/lib/net/ipv4.h \
src/lib/net/ipv6.h \
src/lib/net/nettypes.h \
...
...
src/or/config.c
View file @
db1a420c
...
...
@@ -116,6 +116,7 @@
#include
"lib/process/restrict.h"
#include
"lib/process/setuid.h"
#include
"lib/process/subprocess.h"
#include
"lib/net/gethostname.h"
#include
"lib/encoding/keyval.h"
#include
"lib/fs/conffile.h"
...
...
src/test/test_config.c
View file @
db1a420c
...
...
@@ -49,6 +49,7 @@
#include
"or/routerinfo_st.h"
#include
"lib/fs/conffile.h"
#include
"lib/net/gethostname.h"
static
void
test_config_addressmap
(
void
*
arg
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment