Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
bcdd8cd1
Commit
bcdd8cd1
authored
May 05, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the -L/-T options -- config params tx.limit and tx.timeout,
just like the -L and -T options for the standard VSL tools
parent
aa3dbe6a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
15 deletions
+58
-15
child.c
src/child.c
+14
-0
config.c
src/config.c
+22
-12
regress.sh
src/test/regress.sh
+1
-1
trackrdrd.c
src/trackrdrd.c
+18
-2
trackrdrd.h
src/trackrdrd.h
+3
-0
No files found.
src/child.c
View file @
bcdd8cd1
...
...
@@ -53,6 +53,7 @@
#include <limits.h>
#include <stdarg.h>
#include <dlfcn.h>
#include <float.h>
#include "trackrdrd.h"
#include "config_common.h"
...
...
@@ -62,6 +63,7 @@
#include "vapi/vsl.h"
#include "miniobj.h"
#include "vas.h"
#include "vdef.h"
#define QUERY "VCL_log ~ \"^track \""
#define I_TAG "VSL"
...
...
@@ -659,6 +661,18 @@ CHILD_Main(int readconfig)
}
vsl
=
VSL_New
();
if
(
config
.
tx_limit
>
0
)
{
char
L
[
sizeof
(
"4294967296"
)
+
1
];
bprintf
(
L
,
"%u"
,
config
.
tx_limit
);
assert
(
VSL_Arg
(
vsl
,
'L'
,
L
)
>
0
);
}
if
(
config
.
tx_timeout
>=
0
)
{
char
T
[
DBL_MAX_10_EXP
-
DBL_MIN_10_EXP
+
2
];
bprintf
(
T
,
"%f"
,
config
.
tx_timeout
);
assert
(
VSL_Arg
(
vsl
,
'T'
,
T
)
>
0
);
}
if
(
EMPTY
(
config
.
varnish_bindump
))
{
vsm
=
VSM_New
();
AN
(
vsm
);
...
...
src/config.c
View file @
bcdd8cd1
...
...
@@ -106,6 +106,19 @@ conf_getUnsignedInt(const char *rval, unsigned *i)
return(0); \
}
#define confNonNegativeDouble(name,fld) \
if (strcmp(lval, (name)) == 0) { \
char *p; \
errno = 0; \
double d = strtod(rval, &p); \
if (errno) \
return errno; \
if (p[0] != '\0' || d < 0 || isnan(d) || !finite(d)) \
return EINVAL; \
config.fld = d; \
return 0; \
}
int
CONF_Add
(
const
char
*
lval
,
const
char
*
rval
)
{
...
...
@@ -132,6 +145,10 @@ CONF_Add(const char *lval, const char *rval)
confUnsigned
(
"restart.pause"
,
restart_pause
);
confUnsigned
(
"thread.restarts"
,
thread_restarts
);
confUnsigned
(
"monitor.interval"
,
monitor_interval
);
confUnsigned
(
"tx.limit"
,
tx_limit
);
confNonNegativeDouble
(
"idle.pause"
,
idle_pause
);
confNonNegativeDouble
(
"tx.timeout"
,
tx_timeout
);
if
(
strcmp
(
lval
,
"max.records"
)
==
0
)
{
unsigned
int
i
;
...
...
@@ -186,18 +203,6 @@ CONF_Add(const char *lval, const char *rval)
return
(
EINVAL
);
}
if
(
strcmp
(
lval
,
"idle.pause"
)
==
0
)
{
char
*
p
;
errno
=
0
;
double
d
=
strtod
(
rval
,
&
p
);
if
(
errno
)
return
errno
;
if
(
p
[
0
]
!=
'\0'
||
d
<
0
||
isnan
(
d
)
||
!
finite
(
d
))
return
EINVAL
;
config
.
idle_pause
=
d
;
return
0
;
}
return
EINVAL
;
}
...
...
@@ -235,6 +240,9 @@ CONF_Init(void)
bprintf
(
config
.
user_name
,
"%s"
,
pw
->
pw_name
);
config
.
uid
=
pw
->
pw_uid
;
config
.
gid
=
pw
->
pw_gid
;
config
.
tx_limit
=
0
;
config
.
tx_timeout
=
-
1
.;
}
/* XXX: stdout is /dev/null in child process */
...
...
@@ -281,4 +289,6 @@ CONF_Dump(int level)
confdump
(
level
,
"idle.pause = %f"
,
config
.
idle_pause
);
confdump
(
level
,
"thread.restarts = %u"
,
config
.
thread_restarts
);
confdump
(
level
,
"user = %s"
,
config
.
user_name
);
confdump
(
level
,
"tx.limit = %u"
,
config
.
tx_limit
);
confdump
(
level
,
"tx.timeout = %f"
,
config
.
tx_timeout
);
}
src/test/regress.sh
View file @
bcdd8cd1
...
...
@@ -29,7 +29,7 @@ rm -f $LOG $MSG
# "Not running as root" filtered so that the test is independent of
# the user running it
CKSUM
=
$(
grep
-v
'Worker 1'
$LOG
|
sed
-e
's/\(initializing\) \(.*\)/\1/'
|
sed
-e
's/\(Running as\) \([a-zA-Z0-9]*\)$/\1/'
|
grep
-v
'Not running as root'
|
cksum
)
if
[
"
$CKSUM
"
!=
'
2709219299 214213
'
]
;
then
if
[
"
$CKSUM
"
!=
'
625760318 214345
'
]
;
then
echo
"ERROR: Regression test incorrect reader log cksum:
$CKSUM
"
exit
1
fi
...
...
src/trackrdrd.c
View file @
bcdd8cd1
...
...
@@ -222,7 +222,8 @@ main(int argc, char * const *argv)
{
int
c
,
d_flag
=
0
,
D_flag
=
0
,
err
;
const
char
*
P_arg
=
NULL
,
*
l_arg
=
NULL
,
*
n_arg
=
NULL
,
*
f_arg
=
NULL
,
*
y_arg
=
NULL
,
*
c_arg
=
NULL
,
*
u_arg
=
NULL
,
*
N_arg
=
NULL
;
*
y_arg
=
NULL
,
*
c_arg
=
NULL
,
*
u_arg
=
NULL
,
*
N_arg
=
NULL
,
*
L_arg
=
NULL
,
*
T_arg
=
NULL
;
pid_t
child_pid
;
CONF_Init
();
...
...
@@ -234,7 +235,7 @@ main(int argc, char * const *argv)
}
cli_config_filename
[
0
]
=
'\0'
;
while
((
c
=
getopt
(
argc
,
argv
,
"u:P:Vn:hl:df:y:c:DN:"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"u:P:Vn:hl:df:y:c:DN:
L:T:
"
))
!=
-
1
)
{
switch
(
c
)
{
case
'P'
:
P_arg
=
optarg
;
...
...
@@ -269,6 +270,12 @@ main(int argc, char * const *argv)
case
'u'
:
u_arg
=
optarg
;
break
;
case
'L'
:
L_arg
=
optarg
;
break
;
case
'T'
:
T_arg
=
optarg
;
break
;
case
'h'
:
usage
(
EXIT_SUCCESS
);
default:
...
...
@@ -320,6 +327,15 @@ main(int argc, char * const *argv)
if
(
N_arg
)
bprintf
(
config
.
vsmfile
,
"%s"
,
N_arg
);
if
(
L_arg
&&
((
err
=
CONF_Add
(
"tx.limit"
,
L_arg
))
!=
0
))
{
fprintf
(
stderr
,
"-L: %s
\n
"
,
strerror
(
err
));
usage
(
EXIT_FAILURE
);
}
if
(
T_arg
&&
((
err
=
CONF_Add
(
"tx.timeout"
,
T_arg
))
!=
0
))
{
fprintf
(
stderr
,
"-T: %s
\n
"
,
strerror
(
err
));
usage
(
EXIT_FAILURE
);
}
if
(
LOG_Open
(
PACKAGE_NAME
)
!=
0
)
{
exit
(
EXIT_FAILURE
);
}
...
...
src/trackrdrd.h
View file @
bcdd8cd1
...
...
@@ -188,6 +188,7 @@ struct config {
#define DEF_IDLE_PAUSE 0.01
double
idle_pause
;
double
tx_timeout
;
uid_t
uid
;
gid_t
gid
;
...
...
@@ -222,6 +223,8 @@ struct config {
unsigned
thread_restarts
;
unsigned
chunk_size
;
#define DEF_CHUNK_SIZE 64
unsigned
tx_limit
;
}
config
;
void
CONF_Init
(
void
);
...
...
Write
Preview
Markdown
is supported
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