Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Linux programozás nagyházi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eckl, Máté
Linux programozás nagyházi
Commits
12abc2e3
Commit
12abc2e3
authored
May 27, 2016
by
dnsadmin
Browse files
Options
Downloads
Patches
Plain Diff
Port beállíthatóság és némi manual javítás
parent
53fbe76c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.cpp
+23
-12
23 additions, 12 deletions
main.cpp
with
23 additions
and
12 deletions
main.cpp
+
23
−
12
View file @
12abc2e3
...
...
@@ -32,14 +32,14 @@ void print_help();
int
main
(
int
argc
,
char
*
argv
[])
{
int
cli_option
;
int
thread_num
=
1
;
int
thread_num
=
1
,
port
=
53
;
char
working_dir
[
PATH_MAX
]
=
{
0
};
getcwd
(
working_dir
,
PATH_MAX
-
1
);
bool
run_as_daemon
=
false
;
std
::
vector
<
command
>
command_list
;
while
((
cli_option
=
getopt
(
argc
,
argv
,
"dkvt:w:h"
))
!=
-
1
)
while
((
cli_option
=
getopt
(
argc
,
argv
,
"dkvt:w:
p:
h"
))
!=
-
1
)
{
int
t
i
=
0
;
int
t
mp
=
0
;
switch
(
cli_option
)
{
case
'd'
:
...
...
@@ -52,13 +52,18 @@ int main(int argc, char *argv[])
verbose
=
true
;
break
;
case
't'
:
t
i
=
atoi
(
optarg
);
if
(
t
i
>
0
)
thread_num
=
t
i
;
t
mp
=
atoi
(
optarg
);
if
(
t
mp
>
0
)
thread_num
=
t
mp
;
break
;
case
'w'
:
strncpy
(
working_dir
,
optarg
,
PATH_MAX
-
1
);
break
;
case
'p'
:
tmp
=
atoi
(
optarg
);
if
(
tmp
>
1
)
port
=
tmp
;
break
;
case
'h'
:
print_help
();
exit
(
EXIT_SUCCESS
);
...
...
@@ -87,7 +92,7 @@ int main(int argc, char *argv[])
if
(
getuid
()
!=
0
)
{
log_on_demand
(
LOG_ERR
,
"You should run with root privileges!"
);
log_on_demand
(
LOG_ERR
,
"You should run
it
with root privileges!"
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -150,7 +155,7 @@ int main(int argc, char *argv[])
memset
(
&
server_address
,
0
,
sizeof
(
server_address
));
server_address
.
sin6_family
=
AF_INET6
;
server_address
.
sin6_addr
=
in6_addr_any
;
server_address
.
sin6_port
=
htons
(
10053
);
server_address
.
sin6_port
=
htons
(
port
);
server
.
init
(
general_sockaddr_wp
((
sockaddr
*
)
&
server_address
,
sizeof
(
server_address
)));
if
(
verbose
)
...
...
@@ -192,12 +197,18 @@ Therefore and some other reason the server must be run with root privileges.
In daemon mode, the working directory must contain the dns.db file.
There are some command line options with which you can make
modifications to the default attributes of the runtime.
See them below.
Options:
-d Run as daemon
-t
threads
Number of threads to start. Only makes sense with -d.
-k Kill daemon
-w
workind_dir
Set working directory. Absolute path needed.
-d Run as daemon
.
-t
THREAD_NUMBER
Number of threads to start. Only makes sense with -d.
-k Kill daemon
.
-w
WORKING_DIR
Set working directory. Absolute path needed.
If not set, the actual PWD will be used.
-p PORT Specifies the port for the server to bind to.
Only makes sense with -d
-v Verbose
-h help
)"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment