From 9120b05a4044b346be397b0ae5b9b7e9a8cbd0b1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 20 Mar 2019 04:26:30 +0100 Subject: [PATCH] Rename DNSLookupServer => LookupServer. --- Kernel/init.cpp | 4 ++-- Kernel/makeall.sh | 4 ++-- Kernel/sync.sh | 3 +-- LibC/netdb.cpp | 2 +- Servers/DNSLookupServer/.gitignore | 3 --- Servers/LookupServer/.gitignore | 3 +++ .../DNSPacket.h | 0 .../DNSRecord.h | 0 .../{DNSLookupServer => LookupServer}/Makefile | 6 +++--- .../{DNSLookupServer => LookupServer}/main.cpp | 18 +++++++++--------- 10 files changed, 21 insertions(+), 22 deletions(-) delete mode 100644 Servers/DNSLookupServer/.gitignore create mode 100644 Servers/LookupServer/.gitignore rename Servers/{DNSLookupServer => LookupServer}/DNSPacket.h (100%) rename Servers/{DNSLookupServer => LookupServer}/DNSRecord.h (100%) rename Servers/{DNSLookupServer => LookupServer}/Makefile (90%) rename Servers/{DNSLookupServer => LookupServer}/main.cpp (90%) diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 728a72c411a..b397255cc83 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -85,9 +85,9 @@ VFS* vfs; int error; - auto* dns_lookup_server_process = Process::create_user_process("/bin/DNSLookupServer", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0); + auto* dns_lookup_server_process = Process::create_user_process("/bin/LookupServer", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0); if (error != 0) { - dbgprintf("error spawning DNSLookupServer: %d\n", error); + dbgprintf("error spawning LookupServer: %d\n", error); hang(); } diff --git a/Kernel/makeall.sh b/Kernel/makeall.sh index 12bed3dc5f9..4307dac7280 100755 --- a/Kernel/makeall.sh +++ b/Kernel/makeall.sh @@ -12,8 +12,8 @@ $make_cmd -C ../LibM && \ (cd ../LibM && ./install.sh) && \ $make_cmd -C ../LibM clean && \ $make_cmd -C ../LibM clean && \ -$make_cmd -C ../Servers/DNSLookupServer clean && \ -$make_cmd -C ../Servers/DNSLookupServer && \ +$make_cmd -C ../Servers/LookupServer clean && \ +$make_cmd -C ../Servers/LookupServer && \ $make_cmd -C ../WindowServer clean && \ $make_cmd -C ../WindowServer && \ $make_cmd -C ../LibGUI clean && \ diff --git a/Kernel/sync.sh b/Kernel/sync.sh index be6c3bbbfb7..0edbe8fefa1 100755 --- a/Kernel/sync.sh +++ b/Kernel/sync.sh @@ -88,8 +88,7 @@ cp -v ../Applications/About/About mnt/bin/About cp -v ../Applications/TextEditor/TextEditor mnt/bin/TextEditor cp -v ../Applications/IRCClient/IRCClient mnt/bin/IRCClient ln -s IRCClient mnt/bin/irc -cp -v ../Servers/DNSLookupServer/DNSLookupServer mnt/bin/DNSLookupServer -ln -s DNSLookupServer mnt/bin/dns +cp -v ../Servers/LookupServer/LookupServer mnt/bin/LookupServer cp -v ../WindowServer/WindowServer mnt/bin/WindowServer cp -v kernel.map mnt/ sh sync-local.sh diff --git a/LibC/netdb.cpp b/LibC/netdb.cpp index e1d76739c2f..11055c1960f 100644 --- a/LibC/netdb.cpp +++ b/LibC/netdb.cpp @@ -44,7 +44,7 @@ hostent* gethostbyname(const char* name) sockaddr_un address; address.sun_family = AF_LOCAL; - strcpy(address.sun_path, "/tmp/.DNSLookupServer-socket"); + strcpy(address.sun_path, "/tmp/.LookupServer-socket"); int retries = 3; int rc = 0; diff --git a/Servers/DNSLookupServer/.gitignore b/Servers/DNSLookupServer/.gitignore deleted file mode 100644 index 29821a015df..00000000000 --- a/Servers/DNSLookupServer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -*.d -DNSLookupServer diff --git a/Servers/LookupServer/.gitignore b/Servers/LookupServer/.gitignore new file mode 100644 index 00000000000..2bdfd6d40d6 --- /dev/null +++ b/Servers/LookupServer/.gitignore @@ -0,0 +1,3 @@ +*.o +*.d +LookupServer diff --git a/Servers/DNSLookupServer/DNSPacket.h b/Servers/LookupServer/DNSPacket.h similarity index 100% rename from Servers/DNSLookupServer/DNSPacket.h rename to Servers/LookupServer/DNSPacket.h diff --git a/Servers/DNSLookupServer/DNSRecord.h b/Servers/LookupServer/DNSRecord.h similarity index 100% rename from Servers/DNSLookupServer/DNSRecord.h rename to Servers/LookupServer/DNSRecord.h diff --git a/Servers/DNSLookupServer/Makefile b/Servers/LookupServer/Makefile similarity index 90% rename from Servers/DNSLookupServer/Makefile rename to Servers/LookupServer/Makefile index 3dd231ad912..b82f3afe704 100644 --- a/Servers/DNSLookupServer/Makefile +++ b/Servers/LookupServer/Makefile @@ -1,8 +1,8 @@ -DNSLOOKUPSERVER_OBJS = \ +LOOKUPSERVER_OBJS = \ main.o -APP = DNSLookupServer -OBJS = $(DNSLOOKUPSERVER_OBJS) +APP = LookupServer +OBJS = $(LOOKUPSERVER_OBJS) STANDARD_FLAGS = -std=c++17 WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough diff --git a/Servers/DNSLookupServer/main.cpp b/Servers/LookupServer/main.cpp similarity index 90% rename from Servers/DNSLookupServer/main.cpp rename to Servers/LookupServer/main.cpp index 9f280c0f503..fad690f89bf 100644 --- a/Servers/DNSLookupServer/main.cpp +++ b/Servers/LookupServer/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char**argv) (void)argc; (void)argv; - unlink("/tmp/.DNSLookupServer-socket"); + unlink("/tmp/.LookupServer-socket"); HashMap dns_cache; @@ -43,7 +43,7 @@ int main(int argc, char**argv) sockaddr_un address; address.sun_family = AF_LOCAL; - strcpy(address.sun_path, "/tmp/.DNSLookupServer-socket"); + strcpy(address.sun_path, "/tmp/.LookupServer-socket"); int rc = bind(server_fd, (const sockaddr*)&address, sizeof(address)); if (rc < 0) { @@ -93,7 +93,7 @@ int main(int argc, char**argv) client_buffer[nrecv] = '\0'; auto hostname = String(client_buffer, nrecv, Chomp); - dbgprintf("DNSLookupServer: Got request for '%s'\n", hostname.characters()); + dbgprintf("LookupServer: Got request for '%s'\n", hostname.characters()); Vector addresses; @@ -107,7 +107,7 @@ int main(int argc, char**argv) break; } while (--retries); if (did_timeout) { - fprintf(stderr, "DNSLookupServer: Out of retries :(\n"); + fprintf(stderr, "LookupServer: Out of retries :(\n"); close(client_fd); continue; } @@ -213,7 +213,7 @@ Vector lookup(const String& hostname, bool& did_timeout) response_buffer[nrecv] = '\0'; if (nrecv < (int)sizeof(DNSPacket)) { - dbgprintf("DNSLookupServer: Response not big enough (%d) to be a DNS packet :(\n", nrecv); + dbgprintf("LookupServer: Response not big enough (%d) to be a DNS packet :(\n", nrecv); return { }; } @@ -225,15 +225,15 @@ Vector lookup(const String& hostname, bool& did_timeout) //printf("Additional count: %u\n", response_header.additional_count()); if (response_header.id() != request_header.id()) { - dbgprintf("DNSLookupServer: ID mismatch (%u vs %u) :(\n", response_header.id(), request_header.id()); + dbgprintf("LookupServer: ID mismatch (%u vs %u) :(\n", response_header.id(), request_header.id()); return { }; } if (response_header.question_count() != 1) { - dbgprintf("DNSLookupServer: Question count (%u vs %u) :(\n", response_header.question_count(), request_header.question_count()); + dbgprintf("LookupServer: Question count (%u vs %u) :(\n", response_header.question_count(), request_header.question_count()); return { }; } if (response_header.answer_count() < 1) { - dbgprintf("DNSLookupServer: Not enough answers (%u) :(\n", response_header.answer_count()); + dbgprintf("LookupServer: Not enough answers (%u) :(\n", response_header.answer_count()); return { }; } @@ -246,7 +246,7 @@ Vector lookup(const String& hostname, bool& did_timeout) for (word i = 0; i < response_header.answer_count(); ++i) { auto& record = *(const DNSRecord*)(&((const byte*)response_header.payload())[offset]); auto ipv4_address = IPv4Address((const byte*)record.data()); - dbgprintf("DNSLookupServer: Answer #%u: (question: %s), ttl=%u, length=%u, data=%s\n", + dbgprintf("LookupServer: Answer #%u: (question: %s), ttl=%u, length=%u, data=%s\n", i, question.characters(), record.ttl(),