Skip to content

Commit

Permalink
fix: fix some warnings as errors
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
  • Loading branch information
Andreagit97 authored and poiana committed Sep 16, 2024
1 parent 62bb482 commit d4efc80
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion test/drivers/event_class/network_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
/*=============================== UNIX ===========================*/

/* Max length socket unix path. */
#define MAX_SUN_PATH 109
#define MAX_SUN_PATH 108

/* Unix Client: the `xyzxe-` prefix is used to avoid name collisions */
#define UNIX_CLIENT "/tmp/xyzxe-client"
Expand Down
24 changes: 12 additions & 12 deletions test/drivers/helpers/proc_parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
* in which we don't need them all.
*/
struct proc_info {
uint32_t tty;
pid_t ppid; /* The PID of the parent of this process. */
pid_t pgid; /* The process group ID of the process. */
char raw_args[MAX_NUM_ARGS][MAX_PATH];
const char* args[MAX_NUM_ARGS];
uint32_t uid;
uint32_t gid;
uint32_t vpid;
uint32_t vtid;
struct rlimit file_rlimit;
uint32_t loginuid;
char exepath[MAX_PATH];
uint32_t tty = 0;
pid_t ppid = 0; /* The PID of the parent of this process. */
pid_t pgid = 0; /* The process group ID of the process. */
char raw_args[MAX_NUM_ARGS][MAX_PATH] = {};
const char* args[MAX_NUM_ARGS] = {};
uint32_t uid = 0;
uint32_t gid = 0;
uint32_t vpid = 0;
uint32_t vtid = 0;
struct rlimit file_rlimit = {0, 0};
uint32_t loginuid = 0;
char exepath[MAX_PATH] = {};
};

bool get_proc_info(pid_t pid, proc_info* info);
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TEST(GenericTracepoints, sched_proc_exec) {
/* 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 @@ -182,7 +182,7 @@ TEST(GenericTracepoints, sched_proc_exec_success_memfd) {
/* 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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3) {
/*=============================== TRIGGER SYSCALL ===========================*/

/* Here we scan the parent just to obtain some info for the child */
struct proc_info info = {0};
struct proc_info info = {};
pid_t pid = ::getpid();
if(!get_proc_info(pid, &info)) {
FAIL() << "Unable to get all the info from proc" << std::endl;
Expand All @@ -23,7 +23,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3) {
/* We need to use `SIGCHLD` otherwise the parent won't receive any signal
* when the child terminates. We use `CLONE_FILES` just to test the flags.
*/
clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.flags = CLONE_FILES;
cl_args.exit_signal = SIGCHLD;
pid_t ret_pid = syscall(__NR_clone3, &cl_args, sizeof(cl_args));
Expand Down Expand Up @@ -122,7 +122,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3_create_child_with_2_threads
pid_t p1_t1 = 61001;
pid_t p1_t2 = 61004;

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 @@ -131,7 +131,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3_create_child_with_2_threads
/* Create a child process that will spawn a new thread */
if(ret_pid == 0) {
/* Spawn a new thread */
clone_args cl_args_child = {0};
clone_args cl_args_child = {};
cl_args_child.set_tid = (uint64_t)&p1_t2;
cl_args_child.set_tid_size = 1;
/* CLONE_PARENT has no additional effects if we are spawning a thread
Expand Down Expand Up @@ -223,14 +223,14 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3_child_clone_parent_flag) {
pid_t p1_t1 = 61024;
pid_t p2_t1 = 60128;

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;
pid_t ret_pid = syscall(__NR_clone3, &cl_args_parent, sizeof(cl_args_parent));

if(ret_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 = 1;
cl_args_child.flags = CLONE_PARENT;
Expand Down Expand Up @@ -327,7 +327,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3_child_new_namespace_from_ch

/* Here we create a child process in a new namespace. */
pid_t p1_t1[2] = {1, 61032};
clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.set_tid = (uint64_t)&p1_t1;
cl_args.set_tid_size = 2;
cl_args.flags = CLONE_NEWPID;
Expand Down Expand Up @@ -411,7 +411,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3_child_new_namespace_create_
/* Please note that a process can have the same pid number in different namespaces */
pid_t p1_t2[2] = {61036, 61036};

clone_args cl_args = {0};
clone_args cl_args = {};
cl_args.set_tid = (uint64_t)&p1_t1;
cl_args.set_tid_size = 2;
cl_args.flags = CLONE_NEWPID;
Expand All @@ -420,7 +420,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone3_child_new_namespace_create_

if(ret_pid == 0) {
/* Spawn a new thread */
clone_args cl_args_child = {0};
clone_args cl_args_child = {};
cl_args_child.set_tid = (uint64_t)&p1_t2;
cl_args_child.set_tid_size = 2;
cl_args_child.flags = CLONE_THREAD | CLONE_SIGHAND | CLONE_VM | CLONE_VFORK;
Expand Down Expand Up @@ -502,7 +502,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_clone) {
/*=============================== TRIGGER SYSCALL ===========================*/

/* Here we scan the parent just to obtain some info for the child */
struct proc_info info = {0};
struct proc_info info = {};
pid_t pid = ::getpid();
if(!get_proc_info(pid, &info)) {
FAIL() << "Unable to get all the info from proc" << std::endl;
Expand Down Expand Up @@ -611,7 +611,7 @@ TEST(GenericTracepoints, sched_proc_fork_case_fork) {
/*=============================== TRIGGER SYSCALL ===========================*/

/* Here we scan the parent just to obtain some info for the child */
struct proc_info info = {0};
struct proc_info info = {};
pid_t pid = ::getpid();
if(!get_proc_info(pid, &info)) {
FAIL() << "Unable to get all the info from proc" << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions test/drivers/test_suites/syscall_enter_suite/connect_e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ TEST(SyscallEnter, connectE_UNIX_failure) {
*/
#define UNIX_LONG_PATH \
"/unix_socket/test/too_long/too_long/too_long/too_long/unix_socket/test/too_long/too_long/" \
"too_long/too_longgg*"
"too_long/too_longgg"
#define EXPECTED_UNIX_LONG_PATH \
"/unix_socket/test/too_long/too_long/too_long/too_long/unix_socket/test/too_long/too_long/" \
"too_long/too_longgg"
"too_long/too_longg"

TEST(SyscallEnter, connectE_UNIX_max_path_failure) {
auto evt_test = get_syscall_event_test(__NR_connect, ENTER_EVENT);
Expand Down

0 comments on commit d4efc80

Please sign in to comment.