--- nono/host/netdriver.cpp 2026/04/29 17:04:30 1.1.1.2 +++ nono/host/netdriver.cpp 2026/04/29 17:04:37 1.1.1.4 @@ -1,31 +1,32 @@ // // nono -// Copyright (C) 2019 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // -#include "header.h" #include "netdriver.h" #include "mainapp.h" #include "mystring.h" +#include "mythread.h" static void *netdriver_run(void *); std::unique_ptr gNetDriver; // コンストラクタ -NetDriver::NetDriver(const char *name, EthernetDevice *p, - std::mutex *m, std::condition_variable *c) +NetDriver::NetDriver(const char *drivername_, EthernetDevice *parent_, + std::mutex *mtx_, std::condition_variable *cv_) { logname = "netdriver"; devname = "NetDriver"; - monitor.Init(30, 7); + monitor_size = nnSize(30, 7); fd = -1; - drivername = name; - parent = p; - mtx = m; - cv = c; + drivername = drivername_; + parent = parent_; + mtx = mtx_; + cv = cv_; } // デストラクタ @@ -34,8 +35,8 @@ NetDriver::~NetDriver() } // モニタ -bool -NetDriver::MonitorUpdate() +void +NetDriver::MonitorUpdate(TextScreen& monitor) { monitor.Clear(); @@ -46,7 +47,6 @@ NetDriver::MonitorUpdate() monitor.Print(5, 4, "%9s %9s", "Packets", "Bytes"); monitor.Print(0, 5, "Send %9" PRIu64 " %9" PRIu64, tx_pkts, tx_bytes); monitor.Print(0, 6, "Recv %9" PRIu64 " %9" PRIu64, rx_pkts, rx_bytes); - return true; } // スレッドが必要な継承クラスが呼ぶ @@ -64,7 +64,7 @@ NetDriver::InitRecvThread() void * netdriver_run(void *dummy) { - pthread_setname_np("netdriver"); + PTHREAD_SETNAME("netdriver"); pthread_detach(pthread_self()); gNetDriver->ThreadRun();