Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc compile include/warn fixes #2448

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/core/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2906,7 +2906,8 @@ reactor::wakeup() {
_sleeping.store(false, std::memory_order_relaxed);

uint64_t one = 1;
::write(_notify_eventfd.get(), &one, sizeof(one));
auto res = ::write(_notify_eventfd.get(), &one, sizeof(one));
assert(res == sizeof(one) && "write(2) failed on _reactor._notify_eventfd");
}

void reactor::start_aio_eventfd_loop() {
Expand All @@ -2916,7 +2917,7 @@ void reactor::start_aio_eventfd_loop() {
future<> loop_done = repeat([this] {
return _aio_eventfd->readable().then([this] {
char garbage[8];
::read(_aio_eventfd->get_fd(), garbage, 8); // totally uninteresting
std::ignore = ::read(_aio_eventfd->get_fd(), garbage, 8); // totally uninteresting
return _stopping ? stop_iteration::yes : stop_iteration::no;
});
});
Expand All @@ -2931,7 +2932,8 @@ void reactor::stop_aio_eventfd_loop() {
return;
}
uint64_t one = 1;
::write(_aio_eventfd->get_fd(), &one, 8);
auto res = ::write(_aio_eventfd->get_fd(), &one, 8);
assert(res == 8 && "write(2) failed on _reactor._aio_eventfd");
}

inline
Expand Down
7 changes: 6 additions & 1 deletion src/core/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@

#ifdef SEASTAR_MODULE
module;
#endif

#include <atomic>
#include <cassert>
#include <cstdint>
#include <array>
#include <pthread.h>
#include <signal.h>

#ifdef SEASTAR_MODULE
module seastar;
#else
#include <seastar/core/reactor.hh>
Expand Down Expand Up @@ -66,7 +70,8 @@ void thread_pool::work(sstring name) {
std::atomic_thread_fence(std::memory_order_seq_cst);
if (_main_thread_idle.load(std::memory_order_relaxed)) {
uint64_t one = 1;
::write(_reactor._notify_eventfd.get(), &one, 8);
auto res = ::write(_reactor._notify_eventfd.get(), &one, 8);
assert(res == 8 && "write(2) failed on _reactor._notify_eventfd");
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion tests/perf/linux_perf_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* This file was copied from Scylla (https://github.com/scylladb/scylla)
*/

#include <cassert>

#include <seastar/testing/linux_perf_event.hh>

#include <linux/perf_event.h>
Expand Down Expand Up @@ -61,7 +63,8 @@ linux_perf_event::read() {
return 0;
}
uint64_t ret;
::read(_fd, &ret, sizeof(ret));
auto res = ::read(_fd, &ret, sizeof(ret));
assert(res == sizeof(ret) && "read(2) failed on perf_event fd");
return ret;
}

Expand Down
17 changes: 11 additions & 6 deletions tests/unit/unix_domain_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
/*
* Copyright (C) 2019 Red Hat, Inc.
*/
*/

#include <filesystem>

Expand Down Expand Up @@ -88,7 +88,7 @@ future<> ud_server_client::init_server() {
}
}
client_round();
}
}
});

return do_until([this](){return rounds_left<=0;}, [&lstn,this]() {
Expand Down Expand Up @@ -131,7 +131,7 @@ future<> ud_server_client::init_server() {
/// If 'client_path' is set, the client binds to the named path.
// Runs in a seastar::thread.
void ud_server_client::client_round() {
auto cc = client_path ?
auto cc = client_path ?
engine().net().connect(server_addr, socket_address{unix_domain_addr{*client_path}}).get() :
engine().net().connect(server_addr).get();

Expand All @@ -154,11 +154,16 @@ future<> ud_server_client::run() {

}

void rm(std::string_view what) {
auto res = system(fmt::format("rm -f {}", what).c_str());
BOOST_REQUIRE_EQUAL(res, 0);
}

// testing the various address types, both on the server and on the
// client side

SEASTAR_TEST_CASE(unixdomain_server) {
system("rm -f /tmp/ry");
rm("/tmp/ry");
ud_server_client uds("/tmp/ry", std::nullopt, 3);
return do_with(std::move(uds), [](auto& uds){
return uds.run();
Expand Down Expand Up @@ -205,15 +210,15 @@ SEASTAR_TEST_CASE(unixdomain_text) {
}

SEASTAR_TEST_CASE(unixdomain_bind) {
system("rm -f 111 112");
rm("111 112");
ud_server_client uds("111"s, "112"s, 1);
return do_with(std::move(uds), [](auto& uds){
return uds.run();
});
}

SEASTAR_TEST_CASE(unixdomain_short) {
system("rm -f 3");
rm("3");
ud_server_client uds("3"s, std::nullopt, 10);
return do_with(std::move(uds), [](auto& uds){
return uds.run();
Expand Down