From 4c13d78559af624baf7b92105fdd0308b56ca43f Mon Sep 17 00:00:00 2001 From: adjoly Date: Sat, 16 Aug 2025 21:43:15 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 15 +++++++++++++++ src/ping/send_icmp.c | 1 + src/ping/send_ping.c | 1 + src/utils.c | 2 ++ 4 files changed, 19 insertions(+) diff --git a/flake.nix b/flake.nix index 5dda341..b2f010d 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,21 @@ apps = forEachSupportedSystem ( { pkgs, system }: { + virtualBoyy = + let + scriptName = "run-virtualBoyy-vm"; + script = pkgs.writeShellScriptBin "${scriptName}" '' + ${inputs.keyzconf.packages.${system}.virtualBoyy { mount-enabled = true; }}/bin/run-virtualBoyy-vm \ + -enable-kvm \ + -m 8G \ + -smp 4 \ + -virtfs local,path=$(${pkgs.coreutils}/bin/pwd),mount_tag=host0,id=host0,security_model=none + ''; + in + { + type = "app"; + program = "${script}/bin/${scriptName}"; + }; virtualBoyy-headless = let scriptName = "run-virtualBoyy-vm-headless"; diff --git a/src/ping/send_icmp.c b/src/ping/send_icmp.c index b488c80..33d1ecd 100644 --- a/src/ping/send_icmp.c +++ b/src/ping/send_icmp.c @@ -49,6 +49,7 @@ void process_icmp(char *buf, int bytes, struct sockaddr_in *addr, int seq, append_time(rtt); + // TODO: fix the time and put the hostname with the ip printf("%d bytes from %s: icmp_seq=%d ttl=%d time=%.3f\n", bytes - len, inet_ntoa(addr->sin_addr), icmp->icmp_seq, ip->ip_ttl, rtt); } diff --git a/src/ping/send_ping.c b/src/ping/send_ping.c index d59a376..89490c5 100644 --- a/src/ping/send_ping.c +++ b/src/ping/send_ping.c @@ -81,6 +81,7 @@ int send_ping(int socket, struct sockaddr_in *dest, options_t opt) { return EXIT_SUCCESS; } +// TODO: fix this shitty loop int ping(args_t *args) { int ret; options_t opt = init_opt(args); diff --git a/src/utils.c b/src/utils.c index f80c396..20d22cf 100644 --- a/src/utils.c +++ b/src/utils.c @@ -61,10 +61,12 @@ bool check_for_timeout(struct timeval start, options_t opt) { return false; } +// TODO: fix the packet loss void print_stats(void) { printf("--- %s ping statistics ---\n", address); printf("%d packets transmitted, %d packets received, %.0f%% packet loss\n", tx_count, rx_count, (tx_count - rx_count / 2.0) * 100); + // TODO: fix this shit printf("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f\n", get_min_rtt(), get_avg_rtt(), get_max_rtt(), get_stddev_rtt()); }