summaryrefslogtreecommitdiff
path: root/Libraries/LibCore/CLocalSocket.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-07-13 19:42:03 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-13 22:57:24 +0200
commitffa8cb668faffd4c417cc7ff60215d732a088122 (patch)
treeb2b562056ba6bec73b7999335c2e9d9484cb4b2f /Libraries/LibCore/CLocalSocket.cpp
parent983245113afe1961376f5381ea4a77e4364b9d2d (diff)
downloadserenity-ffa8cb668faffd4c417cc7ff60215d732a088122.zip
AudioServer: Assorted infrastructure work
* Add a LibAudio, and move WAV file parsing there (via AWavFile and AWavLoader) * Add CLocalSocket, and CSocket::connect() variant for local address types. We make some small use of this in WindowServer (as that's where we modelled it from), but don't get too invasive as this PR is already quite large, and the WS I/O is a bit carefully done * Add an AClientConnection which will eventually be used to talk to AudioServer (and make use of it in Piano, though right now it really doesn't do anything except connect, using our new CLocalSocket...)
Diffstat (limited to 'Libraries/LibCore/CLocalSocket.cpp')
-rw-r--r--Libraries/LibCore/CLocalSocket.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Libraries/LibCore/CLocalSocket.cpp b/Libraries/LibCore/CLocalSocket.cpp
new file mode 100644
index 0000000000..20837a066f
--- /dev/null
+++ b/Libraries/LibCore/CLocalSocket.cpp
@@ -0,0 +1,19 @@
+#include <LibCore/CLocalSocket.h>
+#include <sys/socket.h>
+
+CLocalSocket::CLocalSocket(CObject* parent)
+ : CSocket(CSocket::Type::Local, parent)
+{
+ int fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
+ if (fd < 0) {
+ set_error(fd);
+ } else {
+ set_fd(fd);
+ set_mode(CIODevice::ReadWrite);
+ set_error(0);
+ }
+}
+
+CLocalSocket::~CLocalSocket()
+{
+}