aboutsummaryrefslogtreecommitdiffstats
path: root/src/firemon/procevent.c
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2021-06-20 18:31:12 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2021-06-27 15:23:22 -0300
commit5106b2ec404d4085cb4f741aeca9f2bdc95878a9 (patch)
tree599ad4edd21adc5eb9f89d1c801f21c6ec710739 /src/firemon/procevent.c
parentgcov: fix indentation (diff)
downloadfirejail-5106b2ec404d4085cb4f741aeca9f2bdc95878a9.tar.gz
firejail-5106b2ec404d4085cb4f741aeca9f2bdc95878a9.tar.zst
firejail-5106b2ec404d4085cb4f741aeca9f2bdc95878a9.zip
gcov: use no-op functions if not enabled
Instead of wrapping every gcov function call in an ifdef. Note: The usage of `((void)0)` is based on section 7.2 of the C99 standard (N1256)[1] [2]: > 7.2 Diagnostics <assert.h> > > 1 The header <assert.h> defines the assert macro and refers to another > macro, > > NDEBUG > > which is not defined by <assert.h>. If NDEBUG is defined as a macro > name at the point in the source file where <assert.h> is included, the > assert macro is defined simply as > > #define assert(ignore) ((void)0) See also assert.h(0p) from POSIX.1-2017[3]. Note: This is a continuation of commit b408b20c7 ("gcov: fix build failure with gcc 11.1.0") / PR #4373. [1] http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf [2] https://port70.net/~nsz/c/c99/n1256.html#7.2 [3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html
Diffstat (limited to 'src/firemon/procevent.c')
-rw-r--r--src/firemon/procevent.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/firemon/procevent.c b/src/firemon/procevent.c
index 79f487582..716a9cba4 100644
--- a/src/firemon/procevent.c
+++ b/src/firemon/procevent.c
@@ -18,6 +18,7 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/ 19*/
20#include "firemon.h" 20#include "firemon.h"
21#include "../include/gcov_wrapper.h"
21#include <sys/socket.h> 22#include <sys/socket.h>
22#include <linux/connector.h> 23#include <linux/connector.h>
23#include <linux/netlink.h> 24#include <linux/netlink.h>
@@ -30,10 +31,6 @@
30#include <fcntl.h> 31#include <fcntl.h>
31#include <sys/uio.h> 32#include <sys/uio.h>
32 33
33#ifdef HAVE_GCOV
34#include "../include/gcov_wrapper.h"
35#endif
36
37#define PIDS_BUFLEN 4096 34#define PIDS_BUFLEN 4096
38#define SERVER_PORT 889 // 889-899 is left unassigned by IANA 35#define SERVER_PORT 889 // 889-899 is left unassigned by IANA
39 36
@@ -234,9 +231,7 @@ static void __attribute__((noreturn)) procevent_monitor(const int sock, pid_t my
234 tv.tv_usec = 0; 231 tv.tv_usec = 0;
235 232
236 while (1) { 233 while (1) {
237#ifdef HAVE_GCOV
238 __gcov_flush(); 234 __gcov_flush();
239#endif
240 235
241#define BUFFSIZE 4096 236#define BUFFSIZE 4096
242 char __attribute__ ((aligned(NLMSG_ALIGNTO)))buf[BUFFSIZE]; 237 char __attribute__ ((aligned(NLMSG_ALIGNTO)))buf[BUFFSIZE];