From 1b3ed08e7ec3ce3e15dd5811f47466fbe579450e Mon Sep 17 00:00:00 2001 From: Namilskyy Date: Wed, 29 Oct 2025 21:59:44 +0300 Subject: Implemented critical funcions and some structure/debug issues closed. --- src/non_critical/mod.rs | 20 ++++++++++++++++++++ src/non_critical/random_sounds.c | 4 ++-- src/non_critical/random_sounds.h | 4 ++-- src/non_critical/syscall_storm.c | 4 ++-- src/non_critical/syscall_storm.h | 4 ++-- 5 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/non_critical/mod.rs (limited to 'src/non_critical') diff --git a/src/non_critical/mod.rs b/src/non_critical/mod.rs new file mode 100644 index 0000000..abc91c8 --- /dev/null +++ b/src/non_critical/mod.rs @@ -0,0 +1,20 @@ +pub mod gui_destroyer; + +use std::os::raw::{c_char, c_int}; + +extern "C" { + // Tools + pub fn check_root() -> c_int; + pub fn check_pid(pid: c_int) -> c_int; + pub fn get_os_name() -> *mut c_char; + + // Random sounds + pub fn init_random_sounds(threads: c_int, time: c_int) -> c_int; + pub fn stop_random_sounds(); + + // Syscall storm + pub fn init_syscall_storm(threads: c_int, iterations: c_int) -> c_int; + pub fn stop_syscall_storm(); +} + + diff --git a/src/non_critical/random_sounds.c b/src/non_critical/random_sounds.c index 315c992..4e7ba76 100644 --- a/src/non_critical/random_sounds.c +++ b/src/non_critical/random_sounds.c @@ -21,13 +21,13 @@ static void* audio_hell() { } } -int init(int threads, int time) { +int init_random_sounds(int threads, int time) { for(int i = 0; i < MAX_THREADS; i++) { pthread_create(&THRS[i], NULL, audio_hell, NULL); } } -void stop() { +void stop_random_sounds() { for(int i = 0; i < MAX_THREADS; i++) { pthread_cancel(THRS[i]); } diff --git a/src/non_critical/random_sounds.h b/src/non_critical/random_sounds.h index 227935b..b336ec6 100644 --- a/src/non_critical/random_sounds.h +++ b/src/non_critical/random_sounds.h @@ -1,4 +1,4 @@ #pragma once -int init(int threads, int time); -void stop(); \ No newline at end of file +int init_random_sounds(int threads, int time); +void stop_random_sounds(); \ No newline at end of file diff --git a/src/non_critical/syscall_storm.c b/src/non_critical/syscall_storm.c index bfe7dde..ff7347d 100644 --- a/src/non_critical/syscall_storm.c +++ b/src/non_critical/syscall_storm.c @@ -19,7 +19,7 @@ static void* syscall_storm_linux(void* iterations) { } } -int init(int threads, int iterations) { +int init_syscall_storm(int threads, int iterations) { if (threads > 5) { printf("ERR: Max treads 5, %d required", threads); return NULL; @@ -34,7 +34,7 @@ int init(int threads, int iterations) { }; } -void stop() { +void stop_syscall_storm() { for(int i = 0; i < MAX_THREADS; i++) { pthread_cancel(THRS[i]); } diff --git a/src/non_critical/syscall_storm.h b/src/non_critical/syscall_storm.h index 6535f3a..1b83eea 100644 --- a/src/non_critical/syscall_storm.h +++ b/src/non_critical/syscall_storm.h @@ -1,4 +1,4 @@ #pragma once -int init(int threads, int iterations); -void stop(); \ No newline at end of file +int init_syscall_storm(int threads, int iterations); +void stop_syscall_storm(); \ No newline at end of file -- cgit v1.2.3