mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:27:45 +00:00
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
This commit is contained in:
parent
3f23a58fa1
commit
24888457d5
9 changed files with 117 additions and 98 deletions
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "Service.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
|
@ -83,7 +84,7 @@ void Service::setup_socket()
|
|||
auto socket_address = Core::SocketAddress::local(m_socket_path);
|
||||
auto un_optional = socket_address.to_sockaddr_un();
|
||||
if (!un_optional.has_value()) {
|
||||
dbg() << "Socket name " << m_socket_path << " is too long. BUG! This should have failed earlier!";
|
||||
dbgln("Socket name {} is too long. BUG! This should have failed earlier!", m_socket_path);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
auto un = un_optional.value();
|
||||
|
@ -114,9 +115,8 @@ void Service::setup_notifier()
|
|||
|
||||
void Service::handle_socket_connection()
|
||||
{
|
||||
#ifdef SERVICE_DEBUG
|
||||
dbg() << "Ready to read on behalf of " << name();
|
||||
#endif
|
||||
dbgln<debug_service>("Ready to read on behalf of {}", name());
|
||||
|
||||
if (m_accept_socket_connections) {
|
||||
int accepted_fd = accept(m_socket_fd, nullptr, nullptr);
|
||||
if (accepted_fd < 0) {
|
||||
|
@ -144,16 +144,14 @@ void Service::activate()
|
|||
|
||||
void Service::spawn(int socket_fd)
|
||||
{
|
||||
#ifdef SERVICE_DEBUG
|
||||
dbg() << "Spawning " << name();
|
||||
#endif
|
||||
dbgln<debug_service>("Spawning {}", name());
|
||||
|
||||
m_run_timer.start();
|
||||
pid_t pid = fork();
|
||||
|
||||
if (pid < 0) {
|
||||
perror("fork");
|
||||
dbg() << "Failed to spawn " << name() << ". Sucks, dude :(";
|
||||
dbgln("Failed to spawn {}. Sucks, dude :(", name());
|
||||
} else if (pid == 0) {
|
||||
// We are the child.
|
||||
|
||||
|
@ -241,7 +239,7 @@ void Service::did_exit(int exit_code)
|
|||
ASSERT(m_pid > 0);
|
||||
ASSERT(!m_multi_instance);
|
||||
|
||||
dbg() << "Service " << name() << " has exited with exit code " << exit_code;
|
||||
dbgln("Service {} has exited with exit code {}", name(), exit_code);
|
||||
|
||||
s_service_map.remove(m_pid);
|
||||
m_pid = -1;
|
||||
|
@ -261,7 +259,7 @@ void Service::did_exit(int exit_code)
|
|||
dbgln("Third time's a charm?");
|
||||
break;
|
||||
default:
|
||||
dbg() << "Giving up on " << name() << ". Good luck!";
|
||||
dbgln("Giving up on {}. Good luck!", name());
|
||||
return;
|
||||
}
|
||||
m_restart_attempts++;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "Service.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/Event.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
|
@ -53,9 +54,7 @@ static void sigchld_handler(int)
|
|||
if (pid == 0)
|
||||
break;
|
||||
|
||||
#ifdef SYSTEMSERVER_DEBUG
|
||||
dbg() << "Reaped child with pid " << pid << ", exit status " << status;
|
||||
#endif
|
||||
dbgln<debug_system_server>("Reaped child with pid {}, exit status {}", pid, status);
|
||||
|
||||
Service* service = Service::find_by_pid(pid);
|
||||
if (service == nullptr) {
|
||||
|
@ -71,18 +70,18 @@ static void parse_boot_mode()
|
|||
{
|
||||
auto f = Core::File::construct("/proc/cmdline");
|
||||
if (!f->open(Core::IODevice::ReadOnly)) {
|
||||
dbg() << "Failed to read command line: " << f->error_string();
|
||||
dbgln("Failed to read command line: {}", f->error_string());
|
||||
return;
|
||||
}
|
||||
const String cmdline = String::copy(f->read_all(), Chomp);
|
||||
dbg() << "Read command line: " << cmdline;
|
||||
dbgln("Read command line: {}", cmdline);
|
||||
|
||||
for (auto& part : cmdline.split_view(' ')) {
|
||||
auto pair = part.split_view('=', 2);
|
||||
if (pair.size() == 2 && pair[0] == "boot_mode")
|
||||
g_boot_mode = pair[1];
|
||||
}
|
||||
dbg() << "Booting in " << g_boot_mode << " mode";
|
||||
dbgln("Booting in {} mode", g_boot_mode);
|
||||
}
|
||||
|
||||
static void prepare_devfs()
|
||||
|
@ -234,7 +233,7 @@ int main(int, char**)
|
|||
}
|
||||
|
||||
// After we've set them all up, activate them!
|
||||
dbg() << "Activating " << services.size() << " services...";
|
||||
dbgln("Activating {} services...", services.size());
|
||||
for (auto& service : services)
|
||||
service.activate();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue