--- nono/host/netdriver.cpp 2026/04/29 17:04:28 1.1.1.1 +++ nono/host/netdriver.cpp 2026/04/29 17:04:33 1.1.1.3 @@ -1,20 +1,21 @@ // // nono -// Copyright (C) 2019 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // -#include "header.h" #include "netdriver.h" -#include "configfile.h" +#include "mainapp.h" #include "mystring.h" +#include "mythread.h" static void *netdriver_run(void *); -NetDriver *gNetDriver; +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"; @@ -22,10 +23,10 @@ NetDriver::NetDriver(const char *name, E monitor.Init(30, 7); fd = -1; - drivername = name; - parent = p; - mtx = m; - cv = c; + drivername = drivername_; + parent = parent_; + mtx = mtx_; + cv = cv_; } // デストラクタ @@ -64,7 +65,7 @@ NetDriver::InitRecvThread() void * netdriver_run(void *dummy) { - pthread_setname_np("netdriver"); + PTHREAD_SETNAME("netdriver"); pthread_detach(pthread_self()); gNetDriver->ThreadRun(); @@ -90,7 +91,7 @@ bool NetDriver::RunScript(const char *filename) { // ファイルが存在するか - std::string path = gConfig->SearchFile(filename); + std::string path = gMainApp.SearchFile(filename); if (path.empty()) { warnx("%s not found", filename); return false;