Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
tsn-measures
Commits
34fbbef0
Commit
34fbbef0
authored
Jun 10, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation errors
parent
f0347f53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
packet-exchange/src/utilities.c
packet-exchange/src/utilities.c
+12
-12
packet-exchange/src/utilities.h
packet-exchange/src/utilities.h
+2
-2
No files found.
packet-exchange/src/utilities.c
View file @
34fbbef0
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <inttypes.h>
#include <inttypes.h>
#include <stdint.h>
#include <signal.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <time.h>
#include <unistd.h>
#include <unistd.h>
#include "utilities.h"
#include "utilities.h"
(
void
)
(
*
previous_handlers
[
NSIG
])(
int
);
void
(
*
previous_handlers
[
NSIG
])(
int
);
static
(
void
)
(
*
sighand
)(
int
);
static
void
(
*
sighand
)(
int
);
uint64_t
ts_to_uint
(
struct
timespec
t
)
{
uint64_t
ts_to_uint
(
struct
timespec
t
)
{
return
t
.
tv_sec
*
NSEC_PER_SEC
+
t
.
tv_nsec
;
return
t
.
tv_sec
*
NSEC_PER_SEC
+
t
.
tv_nsec
;
...
@@ -36,30 +38,28 @@ uint64_t min(uint64_t a, uint64_t b) { return a < b ? a : b; }
...
@@ -36,30 +38,28 @@ uint64_t min(uint64_t a, uint64_t b) { return a < b ? a : b; }
static
void
sighand_wrapper
(
int
sig
)
{
static
void
sighand_wrapper
(
int
sig
)
{
// If we get un unexpected signal, report it, if not print the histogram
// If we get un unexpected signal, report it, if not print the histogram
if
(
sig
==
SIGINT
||
sig
==
SIGTERM
)
if
(
sig
==
SIGINT
||
sig
==
SIGTERM
)
(
*
sighand
)(
sig
);
// Will print the histogram
(
*
sighand
)(
sig
);
// Will print the histogram
else
else
printf
(
"Uknown signal interrupt: %s (%d)
\n
"
,
strsignal
(
sig
),
sig
);
printf
(
"Uknown signal interrupt: %s (%d)
\n
"
,
strsignal
(
sig
),
sig
);
// Execute the default handler
// Execute the default handler
if
(
previous_handlers
[
sig
]
==
SIG_DFL
)
{
if
(
previous_handlers
[
sig
]
==
SIG_DFL
)
{
signal
(
sig
,
SIG_DFL
);
signal
(
sig
,
SIG_DFL
);
raise
(
sig
);
raise
(
sig
);
}
}
else
if
(
previous_handlers
[
sig
]
==
SIG_IGN
)
{
else
if
(
previous_handlers
[
sig
]
==
SIG_IGN
)
{
return
;
return
;
}
}
else
{
else
{
(
*
previous_handlers
[
sig
])(
sig
);
(
*
previous_handlers
[
sig
])(
sig
);
}
}
}
}
void
init_signals
(
(
void
)(
*
_sighand
(
int
)
),
int
enable_histograms
)
{
void
init_signals
(
void
(
*
_sighand
)(
int
),
int
enable_histograms
)
{
sighand
=
_sighand
;
sighand
=
_sighand
;
if
(
enable_histograms
)
if
(
enable_histograms
)
for
(
int
i
=
0
;
i
<
NSIG
;
i
++
)
for
(
int
i
=
0
;
i
<
NSIG
;
i
++
)
signal
(
i
,
sighand_wrapper
);
signal
(
i
,
sighand_wrapper
);
}
}
packet-exchange/src/utilities.h
View file @
34fbbef0
...
@@ -28,9 +28,9 @@ uint64_t calcdiff_ns(struct timespec t1, struct timespec t2);
...
@@ -28,9 +28,9 @@ uint64_t calcdiff_ns(struct timespec t1, struct timespec t2);
uint64_t
max
(
uint64_t
a
,
uint64_t
b
);
uint64_t
max
(
uint64_t
a
,
uint64_t
b
);
uint64_t
min
(
uint64_t
a
,
uint64_t
b
);
uint64_t
min
(
uint64_t
a
,
uint64_t
b
);
void
init_signals
(
(
void
)(
*
_sighand
(
int
)
),
int
enable_histograms
);
void
init_signals
(
void
(
*
_sighand
)(
int
),
int
enable_histograms
);
extern
(
void
)
(
*
previous_handlers
[
NSIG
])(
int
);
extern
void
(
*
previous_handlers
[
NSIG
])(
int
);
#endif
#endif
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