diff --git a/apps/httpd/httpd.cc b/apps/httpd/httpd.cc index 9682e25b63..3af1e6f686 100644 --- a/apps/httpd/httpd.cc +++ b/apps/httpd/httpd.cc @@ -40,7 +40,7 @@ public: void listen(ipv4_addr addr) { listen_options lo; lo.reuse_address = true; - _listeners.push_back(the_reactor.listen(make_ipv4_address(addr), lo)); + _listeners.push_back(engine.listen(make_ipv4_address(addr), lo)); do_accepts(_listeners.size() - 1); } void do_accepts(int which) { @@ -305,11 +305,11 @@ int main(int ac, char** av) { std::cout << opts << "\n"; return 1; } - the_reactor.configure(configuration); - the_reactor.start().then([&server] { + engine.configure(configuration); + engine.start().then([&server] { server.listen({{}, 10000}); }); - the_reactor.run(); + engine.run(); return 0; } diff --git a/core/reactor.cc b/core/reactor.cc index 7a6a5bf57d..a3d19a70f9 100644 --- a/core/reactor.cc +++ b/core/reactor.cc @@ -391,7 +391,7 @@ file_desc readable_eventfd::try_create_eventfd(size_t initial) { } future readable_eventfd::wait() { - return the_reactor.readable(*_fd._s).then([this] { + return engine.readable(*_fd._s).then([this] { uint64_t count; int r = ::read(_fd.get_fd(), &count, sizeof(count)); assert(r == sizeof(count)); @@ -408,7 +408,7 @@ socket_address make_ipv4_address(ipv4_addr addr) { } void schedule(std::unique_ptr t) { - the_reactor.add_task(std::move(t)); + engine.add_task(std::move(t)); } data_source posix_data_source(pollable_fd& fd) { @@ -450,7 +450,7 @@ posix_data_sink_impl::do_write(size_t idx) { server_socket posix_network_stack::listen(socket_address sa, listen_options opt) { - return server_socket(std::make_unique(the_reactor.posix_listen(sa, opt))); + return server_socket(std::make_unique(engine.posix_listen(sa, opt))); } void network_stack_registry::register_stack(sstring name, @@ -498,4 +498,4 @@ reactor::get_options_description() { network_stack_registrator nsr_posix{"posix", true}; -reactor the_reactor; +reactor engine; diff --git a/core/reactor.hh b/core/reactor.hh index 8c638ac18f..34c7c1fe52 100644 --- a/core/reactor.hh +++ b/core/reactor.hh @@ -407,11 +407,11 @@ private: friend class timer; }; -extern reactor the_reactor; +extern reactor engine; inline pollable_fd_state::~pollable_fd_state() { - the_reactor.forget(*this); + engine.forget(*this); } // A temporary_buffer either points inside a larger buffer, or, if the requested size @@ -594,24 +594,24 @@ public: file(file&& x) : _fd(x._fd) { x._fd = -1; } template future dma_read(uint64_t pos, CharType* buffer, size_t len) { - return the_reactor.read_dma(*this, pos, buffer, len); + return engine.read_dma(*this, pos, buffer, len); } future dma_read(uint64_t pos, std::vector iov) { - return the_reactor.read_dma(*this, pos, std::move(iov)); + return engine.read_dma(*this, pos, std::move(iov)); } template future dma_write(uint64_t pos, const CharType* buffer, size_t len) { - return the_reactor.write_dma(*this, pos, buffer, len); + return engine.write_dma(*this, pos, buffer, len); } future dma_write(uint64_t pos, std::vector iov) { - return the_reactor.write_dma(*this, pos, std::move(iov)); + return engine.write_dma(*this, pos, std::move(iov)); } future<> flush() { - return the_reactor.flush(*this); + return engine.flush(*this); } friend class reactor; @@ -855,32 +855,32 @@ output_stream::flush() { inline future pollable_fd::read_some(char* buffer, size_t size) { - return the_reactor.read_some(*_s, buffer, size); + return engine.read_some(*_s, buffer, size); } inline future pollable_fd::read_some(uint8_t* buffer, size_t size) { - return the_reactor.read_some(*_s, buffer, size); + return engine.read_some(*_s, buffer, size); } inline future pollable_fd::read_some(const std::vector& iov) { - return the_reactor.read_some(*_s, iov); + return engine.read_some(*_s, iov); } inline future pollable_fd::write_all(const char* buffer, size_t size) { - return the_reactor.write_all(*_s, buffer, size); + return engine.write_all(*_s, buffer, size); } inline future pollable_fd::write_all(const uint8_t* buffer, size_t size) { - return the_reactor.write_all(*_s, buffer, size); + return engine.write_all(*_s, buffer, size); } inline future pollable_fd::accept() { - return the_reactor.accept(*_s); + return engine.accept(*_s); } inline @@ -894,7 +894,7 @@ future<> timer::expired() { inline timer::~timer() { if (_armed) { - the_reactor.del_timer(this); + engine.del_timer(this); } } @@ -903,7 +903,7 @@ void timer::arm(clock_type::time_point until) { assert(!_armed); _armed = true; _expiry = until; - the_reactor.add_timer(this); + engine.add_timer(this); } inline @@ -915,7 +915,7 @@ inline void timer::suspend() { assert(_armed); _armed = false; - the_reactor.del_timer(this); + engine.del_timer(this); } inline diff --git a/tests/fileiotest.cc b/tests/fileiotest.cc index 35a8138c25..690126c65f 100644 --- a/tests/fileiotest.cc +++ b/tests/fileiotest.cc @@ -14,7 +14,7 @@ struct file_test { int main(int ac, char** av) { static constexpr auto max = 10000; - the_reactor.open_file_dma("testfile.tmp").then([] (file f) { + engine.open_file_dma("testfile.tmp").then([] (file f) { auto ft = new file_test{std::move(f)}; for (size_t i = 0; i < max; ++i) { ft->par.wait().then([ft, i] { @@ -44,7 +44,7 @@ int main(int ac, char** av) { ::exit(0); }); }); - the_reactor.run(); + engine.run(); return 0; } diff --git a/tests/ip_test.cc b/tests/ip_test.cc index 9bfa715059..9f67eec8a9 100644 --- a/tests/ip_test.cc +++ b/tests/ip_test.cc @@ -16,7 +16,7 @@ int main(int ac, char** av) { netif.run(); ipv4 inet(&netif); inet.set_host_address(ipv4_address(0xc0a87a02)); - the_reactor.run(); + engine.run(); return 0; } diff --git a/tests/l3_test.cc b/tests/l3_test.cc index c88d282942..44b4304aea 100644 --- a/tests/l3_test.cc +++ b/tests/l3_test.cc @@ -21,7 +21,7 @@ int main(int ac, char** av) { netif.run(); l3_protocol arp(&netif, 0x0806); dump_arp_packets(arp); - the_reactor.run(); + engine.run(); return 0; } diff --git a/tests/tcp_test.cc b/tests/tcp_test.cc index 3272baa0f8..fb8065fa47 100644 --- a/tests/tcp_test.cc +++ b/tests/tcp_test.cc @@ -38,8 +38,8 @@ int main(int ac, char** av) { ipv4 inet(&netif); inet.set_host_address(ipv4_address(0xc0a87a02)); tcp_test tt(inet); - the_reactor.start().then([&tt] { tt.run(); }); - the_reactor.run(); + engine.start().then([&tt] { tt.run(); }); + engine.run(); } diff --git a/tests/test-reactor.cc b/tests/test-reactor.cc index b17d8da850..8b7d7532d0 100644 --- a/tests/test-reactor.cc +++ b/tests/test-reactor.cc @@ -43,9 +43,9 @@ int main(int ac, char** av) ipv4_addr addr{{}, 10000}; listen_options lo; lo.reuse_address = true; - test t(the_reactor.posix_listen(make_ipv4_address(addr), lo)); + test t(engine.posix_listen(make_ipv4_address(addr), lo)); t.start_accept(); - the_reactor.run(); + engine.run(); return 0; } diff --git a/tests/timertest.cc b/tests/timertest.cc index 4fa0b32522..0993d3b35d 100644 --- a/tests/timertest.cc +++ b/tests/timertest.cc @@ -36,8 +36,8 @@ struct timer_test { int main(int ac, char** av) { timer_test t; - the_reactor.start().then([&t] { t.run(); }); - the_reactor.run(); + engine.start().then([&t] { t.run(); }); + engine.run(); } diff --git a/tests/virtiotest.cc b/tests/virtiotest.cc index e92a505cd3..af8e3810cb 100644 --- a/tests/virtiotest.cc +++ b/tests/virtiotest.cc @@ -74,7 +74,7 @@ void echo_packets(net::device& netif) { int main(int ac, char** av) { auto vnet = create_virtio_net_device("tap0"); echo_packets(*vnet); - the_reactor.run(); + engine.run(); return 0; }