Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): replace {0} zero-init with {} #1731

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/drivers/helpers/file_opener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ void file_opener::close()
}
}

const bool file_opener::is_tmpfile_supported() const
bool file_opener::is_tmpfile_supported() const
{
return m_tmpfile_supported;
}

const int file_opener::get_fd() const
int file_opener::get_fd() const
{
return m_fd;
}

const int file_opener::get_flags() const
int file_opener::get_flags() const
{
return m_flags;
}
Expand Down
6 changes: 3 additions & 3 deletions test/drivers/helpers/file_opener.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class file_opener
~file_opener();

void close();
const bool is_tmpfile_supported() const;
const int get_fd() const;
const int get_flags() const;
bool is_tmpfile_supported() const;
int get_fd() const;
int get_flags() const;
const char* get_pathname() const;

private:
Expand Down
6 changes: 3 additions & 3 deletions test/drivers/start_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ int open_engine(int argc, char** argv)
{0, 0, 0, 0}};

// They should live until we call 'scap_open'
scap_modern_bpf_engine_params modern_bpf_params = {0};
scap_bpf_engine_params bpf_params = {0};
scap_kmod_engine_params kmod_params = {0};
scap_modern_bpf_engine_params modern_bpf_params = {};
scap_bpf_engine_params bpf_params = {};
scap_kmod_engine_params kmod_params = {};
int ret = 0;
const scap_vtable* vtable = nullptr;
scap_open_args oargs = {};
Expand Down
76 changes: 38 additions & 38 deletions test/drivers/test_suites/actions_suite/dynamic_snaplen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST(Actions, dynamic_snaplen_negative_fd)
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "HTTP/\0";

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -103,7 +103,7 @@ TEST(Actions, dynamic_snaplen_no_socket)
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "HTTP/\0";

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -180,16 +180,16 @@ TEST(Actions, dynamic_snaplen_HTTP)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "HTTP/\0";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -265,8 +265,8 @@ TEST(Actions, dynamic_snaplen_partial_HTTP_OPT)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
Expand All @@ -275,7 +275,7 @@ TEST(Actions, dynamic_snaplen_partial_HTTP_OPT)
char buf[data_len] = "OP\0";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -351,16 +351,16 @@ TEST(Actions, dynamic_snaplen_HTTP_TRACE)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "TRACE\0";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -436,8 +436,8 @@ TEST(Actions, dynamic_snaplen_MYSQL)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr, PPM_PORT_MYSQL);

/* Send a message to the server */
Expand All @@ -447,7 +447,7 @@ TEST(Actions, dynamic_snaplen_MYSQL)
buf[3] = 3;
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -523,16 +523,16 @@ TEST(Actions, dynamic_snaplen_not_MYSQL)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr, PPM_PORT_MYSQL);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "1111\0";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -608,8 +608,8 @@ TEST(Actions, dynamic_snaplen_POSTGRES)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr, PPM_PORT_POSTGRES);

/* Send a message to the server */
Expand All @@ -619,7 +619,7 @@ TEST(Actions, dynamic_snaplen_POSTGRES)
buf[1] = 0;
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -695,16 +695,16 @@ TEST(Actions, dynamic_snaplen_not_POSTGRES)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr, PPM_PORT_POSTGRES);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "00\0";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -780,8 +780,8 @@ TEST(Actions, dynamic_snaplen_MONGO)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
Expand All @@ -790,7 +790,7 @@ TEST(Actions, dynamic_snaplen_MONGO)
*(int32_t *)(&buf[12]) = 0x01; // this 1 and it's ok
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -866,8 +866,8 @@ TEST(Actions, dynamic_snaplen_not_MONGO)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
Expand All @@ -876,7 +876,7 @@ TEST(Actions, dynamic_snaplen_not_MONGO)
*(int32_t *)(&buf[12]) = 0x07;
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -955,16 +955,16 @@ TEST(Actions, dynamic_snaplen_fullcapture_port_range)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "simple message";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -1048,16 +1048,16 @@ TEST(Actions, dynamic_snaplen_statsd_port)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "simple message";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -1141,16 +1141,16 @@ TEST(Actions, dynamic_snaplen_no_statsd_port)

int32_t client_socket_fd = 0;
int32_t server_socket_fd = 0;
sockaddr_in client_addr = {0};
sockaddr_in server_addr = {0};
sockaddr_in client_addr = {};
sockaddr_in server_addr = {};
evt_test->connect_ipv4_client_to_server(&client_socket_fd, &client_addr, &server_socket_fd, &server_addr);

/* Send a message to the server */
const unsigned data_len = DEFAULT_SNAPLEN * 2;
char buf[data_len] = "simple message";
uint32_t sendto_flags = 0;

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TEST(GenericTracepoints, sched_proc_exit_no_children)
/* We need to use `SIGCHLD` otherwise the parent won't receive any signal
* when the child terminates.
*/
clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down Expand Up @@ -108,7 +108,7 @@ TEST(GenericTracepoints, sched_proc_exit_prctl_subreaper)
pid_t p2_t1 = 61030;
pid_t p3_t1 = 61050;

clone_args cl_args_parent = {0};
clone_args cl_args_parent = {};
cl_args_parent.set_tid = (uint64_t)&p1_t1;
cl_args_parent.set_tid_size = 1;
cl_args_parent.exit_signal = SIGCHLD;
Expand All @@ -122,14 +122,13 @@ TEST(GenericTracepoints, sched_proc_exit_prctl_subreaper)
exit(EXIT_FAILURE);
}

clone_args cl_args_child = {0};
clone_args cl_args_child = {};
cl_args_child.set_tid = (uint64_t)&p2_t1;
cl_args_child.set_tid_size = 1;
cl_args_child.exit_signal = SIGCHLD;
pid_t p2_t1_pid = syscall(__NR_clone3, &cl_args_child, sizeof(cl_args_child));
if(p2_t1_pid == 0)
{
clone_args cl_args_child = {0};
cl_args_child.set_tid = (uint64_t)&p3_t1;
cl_args_child.set_tid_size = 1;
cl_args_child.exit_signal = SIGCHLD;
Expand Down Expand Up @@ -225,7 +224,7 @@ TEST(GenericTracepoints, sched_proc_exit_child_namespace_reaper)
pid_t p3_t1[2] = {3, 59026};

/* p1_t1 is in the new namespace */
clone_args cl_args_parent = {0};
clone_args cl_args_parent = {};
cl_args_parent.set_tid = (uint64_t)&p1_t1;
cl_args_parent.set_tid_size = 2;
cl_args_parent.flags = CLONE_NEWPID;
Expand All @@ -234,14 +233,13 @@ TEST(GenericTracepoints, sched_proc_exit_child_namespace_reaper)

if(p1_t1_pid == 0)
{
clone_args cl_args_child = {0};
clone_args cl_args_child = {};
cl_args_child.set_tid = (uint64_t)&p2_t1;
cl_args_child.set_tid_size = 2;
cl_args_child.exit_signal = SIGCHLD;
pid_t p2_t1_pid = syscall(__NR_clone3, &cl_args_child, sizeof(cl_args_child));
if(p2_t1_pid == 0)
{
clone_args cl_args_child = {0};
cl_args_child.set_tid = (uint64_t)&p3_t1;
cl_args_child.set_tid_size = 2;
cl_args_child.exit_signal = SIGCHLD;
Expand Down Expand Up @@ -337,7 +335,7 @@ TEST(GenericTracepoints, sched_proc_exit_child_namespace_reaper_die)
pid_t p2_t1[2] = {2, 59025};

/* p1_t1 is in the new namespace */
clone_args cl_args_parent = {0};
clone_args cl_args_parent = {};
cl_args_parent.set_tid = (uint64_t)&p1_t1;
cl_args_parent.set_tid_size = 2;
cl_args_parent.flags = CLONE_NEWPID;
Expand All @@ -346,7 +344,7 @@ TEST(GenericTracepoints, sched_proc_exit_child_namespace_reaper_die)

if(p1_t1_pid == 0)
{
clone_args cl_args_child = {0};
clone_args cl_args_child = {};
cl_args_child.set_tid = (uint64_t)&p2_t1;
cl_args_child.set_tid_size = 2;
cl_args_parent.exit_signal = SIGCHLD;
Expand Down Expand Up @@ -407,7 +405,7 @@ TEST(GenericTracepoints, sched_proc_exit_child_namespace_reaper_die)
static int child_func(void* arg)
{
pid_t p2_t1 = 57006;
clone_args cl_args_child = {0};
clone_args cl_args_child = {};
cl_args_child.set_tid = (uint64_t)&p2_t1;
cl_args_child.set_tid_size = 1;
pid_t p2_t1_pid = syscall(__NR_clone3, &cl_args_child, sizeof(cl_args_child));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TEST(GenericTracepoints, sched_switch)
/* We need to use `SIGCHLD` otherwise the parent won't receive any signal
* when the child terminates.
*/
clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));

Expand Down
Loading
Loading