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
fe21d4ff
Commit
fe21d4ff
authored
Feb 14, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trackrdrd: Added assert.c, removed some code duplication
parent
00989a7e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
50 deletions
+70
-50
Makefile.am
trackrdrd/src/Makefile.am
+2
-1
assert.c
trackrdrd/src/assert.c
+55
-0
child.c
trackrdrd/src/child.c
+2
-18
trackrdrd.c
trackrdrd/src/trackrdrd.c
+6
-31
trackrdrd.h
trackrdrd/src/trackrdrd.h
+5
-0
No files found.
trackrdrd/src/Makefile.am
View file @
fe21d4ff
...
...
@@ -19,7 +19,8 @@ trackrdrd_SOURCES = \
worker.c
\
sandbox.c
\
child.c
\
handler.c
handler.c
\
assert.c
trackrdrd_LDADD
=
\
$(VARNISHSRC)
/lib/libvarnishcompat/libvarnishcompat.la
\
...
...
trackrdrd/src/assert.c
0 → 100644
View file @
fe21d4ff
/*-
* Copyright (c) 2012 UPLEX Nils Goroll Systemoptimierung
* Copyright (c) 2012 Otto Gmbh & Co KG
* All rights reserved
* Use only with permission
*
* Authors: Geoffrey Simmons <geoffrey.simmons@uplex.de>
* Nils Goroll <nils.goroll@uplex.de>
*
* Portions adopted from varnishlog.c from the Varnish project
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include "trackrdrd.h"
void
ASRT_Fail
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
int
err
,
int
xxx
)
{
(
void
)
xxx
;
LOG_Log
(
LOG_ALERT
,
"Condition (%s) failed in %s(), %s line %d"
,
cond
,
func
,
file
,
line
);
if
(
err
)
LOG_Log
(
LOG_ALERT
,
"errno = %d (%s)"
,
err
,
strerror
(
err
));
abort
();
}
trackrdrd/src/child.c
View file @
fe21d4ff
...
...
@@ -136,7 +136,7 @@ struct hashtable_s {
unsigned
occ_hi
;
/* Occupancy high water mark */
unsigned
occ_hi_this
;
/* Occupancy high water mark this reporting
interval*/
interval
*/
};
typedef
struct
hashtable_s
hashtable
;
...
...
@@ -153,9 +153,6 @@ static hashtable htbl;
errno, 0); \
} while (0)
static
void
assert_failure
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
int
err
,
int
xxx
);
static
void
entry_assert_failure
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
hashentry
*
he
,
int
err
,
int
xxx
)
...
...
@@ -170,25 +167,12 @@ entry_assert_failure(const char *func, const char *file, int line,
(
de
),
(
de
)
->
magic
,
(
de
)
->
state
,
(
de
)
->
xid
,
(
de
)
->
tid
,
(
de
)
->
end
);
else
LOG_Log
(
LOG_ALERT
,
"Dataentry %p NULL!"
,
(
de
));
assert_failure
(
func
,
file
,
line
,
cond
,
err
,
xxx
);
ASRT_Fail
(
func
,
file
,
line
,
cond
,
err
,
xxx
);
}
#endif
/*--------------------------------------------------------------------*/
static
void
assert_failure
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
int
err
,
int
xxx
)
{
(
void
)
xxx
;
LOG_Log
(
LOG_ALERT
,
"Condition (%s) failed in %s(), %s line %d"
,
cond
,
func
,
file
,
line
);
if
(
err
)
LOG_Log
(
LOG_ALERT
,
"errno = %d (%s)"
,
err
,
strerror
(
err
));
abort
();
}
static
inline
void
check_entry
(
hashentry
*
he
,
unsigned
xid
,
unsigned
tid
)
{
...
...
trackrdrd/src/trackrdrd.c
View file @
fe21d4ff
...
...
@@ -72,18 +72,6 @@
#include "revision.h"
#include "usage.h"
/* Hack, because we cannot have #ifdef in the macro definition SIGDISP */
#define _UNDEFINED(SIG) ((#SIG)[0] == 0)
#define UNDEFINED(SIG) _UNDEFINED(SIG)
#define SIGDISP(SIG, action) \
do { if (UNDEFINED(SIG)) break; \
if (sigaction((SIG), (&action), NULL) != 0) \
LOG_Log(LOG_ALERT, \
"Cannot install handler for " #SIG ": %s", \
strerror(errno)); \
} while(0)
static
volatile
sig_atomic_t
reload
;
static
struct
sigaction
restart_action
;
...
...
@@ -97,19 +85,6 @@ restart(int sig)
reload
=
1
;
}
static
void
assert_failure
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
int
err
,
int
xxx
)
{
(
void
)
xxx
;
LOG_Log
(
LOG_ALERT
,
"Condition (%s) failed in %s(), %s line %d"
,
cond
,
func
,
file
,
line
);
if
(
err
)
LOG_Log
(
LOG_ALERT
,
"errno = %d (%s)"
,
err
,
strerror
(
err
));
abort
();
}
/*--------------------------------------------------------------------*/
/* Handle for the PID file */
...
...
@@ -167,6 +142,10 @@ parent_main(pid_t child_pid, struct VSM_data *vd, int endless)
LOG_Log0
(
LOG_INFO
,
"Management process starting"
);
restart_action
.
sa_handler
=
restart
;
AZ
(
sigemptyset
(
&
restart_action
.
sa_mask
));
restart_action
.
sa_flags
&=
~
SA_RESTART
;
term
=
0
;
reload
=
0
;
/* install signal handlers */
...
...
@@ -340,7 +319,7 @@ main(int argc, char * const *argv)
exit
(
EXIT_FAILURE
);
}
VAS_Fail
=
assert_failure
;
VAS_Fail
=
ASRT_Fail
;
if
(
d_flag
)
LOG_SetLevel
(
LOG_DEBUG
);
...
...
@@ -370,10 +349,6 @@ main(int argc, char * const *argv)
AZ
(
sigemptyset
(
&
terminate_action
.
sa_mask
));
terminate_action
.
sa_flags
&=
~
SA_RESTART
;
restart_action
.
sa_handler
=
restart
;
AZ
(
sigemptyset
(
&
restart_action
.
sa_mask
));
restart_action
.
sa_flags
&=
~
SA_RESTART
;
stacktrace_action
.
sa_handler
=
HNDL_Abort
;
ignore_action
.
sa_handler
=
SIG_IGN
;
...
...
trackrdrd/src/trackrdrd.h
View file @
fe21d4ff
...
...
@@ -43,6 +43,11 @@
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) < (y) ? (y) : (x))
/* assert.c */
void
ASRT_Fail
(
const
char
*
func
,
const
char
*
file
,
int
line
,
const
char
*
cond
,
int
err
,
int
xxx
);
/* handler.c */
/* Hack, because we cannot have #ifdef in the macro definition SIGDISP */
...
...
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