History log of /haiku/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp
Revision Date Author Comments
# b7b57869 18-Jun-2023 Trung Nguyen <trungnt282910@gmail.com>

unix: Implement datagram sockets

Implement `SOCK_DGRAM` sockets for `AF_UNIX` family.

Change-Id: If3d6f408a7d881635ccf04b080391905fdc94b13
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6617
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# b7d9790f 15-May-2023 Jérôme Duval <jerome.duval@gmail.com>

unix: accept() shouldn't return B_TIMEOUT but B_WOULD_BLOCK

it's already handled when breaking the loop.

Change-Id: I47aa8105ff32e97aa4e1c0b2e9292e4516ee155a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6456
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 10ff9c6a 20-Mar-2021 Jérôme Duval <jerome.duval@gmail.com>

unix: sendmsg should return EPIPE after close

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
"[EPIPE] ... the socket is connection-mode and is no longer connected."
Change-Id: I6728b088d2f717b769697218edf26c76c59f488e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3816
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# f0c4b0a6 19-Mar-2021 Jérôme Duval <jerome.duval@gmail.com>

unix: get a read event when read-polling a read-shutdown socket

UnixEndpoint::Receivable(): EOF means there is nothing left to read, and
the shutdown happened on the read side or the write side.

also fix x86_64 build with trace

Change-Id: I54c806f0b900591c3d441240b8f6768dfb756bad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3808
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 64f6fcbc 17-Jan-2015 Hamish Morrison <hamishm53@gmail.com>

TCP, UNIX sockets: allow multiple calls to listen

* Subsequent calls to listen on an already-listening socket can resize
the backlog.
* While not explicitly spelled out by POSIX, this behaviour is
consistent with FreeBSD and Linux.


# 6d796a84 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 88e38c17 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replace uses of obsolescent BReference[able] API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39870 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10cb6261 15-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed destruction order of lock/reference that could lead to access already
deleted memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35467 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 48f1a5b4 24-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Patch by Eric Petit: A read select() should not block when there's not data
available anymore and the remote end has been write-shut-down. Fixes #3536.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30846 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d550262 03-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for SO_PEERCRED for Unix sockets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25305 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ea035707 02-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Support the new {send,read}_data_no_buffer() protocol hooks to avoid
unnecessary data copies and waste of memory.
* Changed the storage backend to ring_buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25300 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6057b5ee 01-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added a bit more debug output in UnixFifo, but disabled debug output in
all files by default.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25285 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 042be529 01-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

In Shutdown() pass an actual error code to notify(). B_OK is just
ignored. This fixes the hanging OpenSSH "multiplex" test. Save for the
"forwarding" test, which sometimes hangs due to a TCP bug, the complete
test suite passes, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25284 a95241bf-73f2-0310-859d-f6bbb57e9c96


# acb16f55 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added missing select notifications on shutdown().
* Notify read/write instead of write/error when disconnecting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e94e0a 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

For sockets in listening mode the read_avail() apparently has to return
something.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25142 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61ef761d 19-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Send() and Receive() select notified the wrong socket about readability
respectively writability.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25069 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59234b36 12-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for SCM_RIGHTS (sending file descriptors).
* Fixed shutdown(). It was computing the wrong fifo flags and set the
wrong ones from the wrong variable on the peer fifo.
* Generally made the Unix sockets behave more like they should. E.g.
after closing one end, it must still be possible to read from the
other (as long as there are buffered data). Also fine-tuned when to
return what errors from recv()/send().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24943 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c1add58a 11-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Resolved TODOs: We now do know whether the call comes from userland or
the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24919 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb8b342d 09-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Protocol module for Unix domain stream type sockets. The implementation
is almost complete, but still quite buggy (receiving data has a good
chance to drop into KDL).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24884 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64f6fcbccd78defbc9785f88423b6800028f5d0e 17-Jan-2015 Hamish Morrison <hamishm53@gmail.com>

TCP, UNIX sockets: allow multiple calls to listen

* Subsequent calls to listen on an already-listening socket can resize
the backlog.
* While not explicitly spelled out by POSIX, this behaviour is
consistent with FreeBSD and Linux.


# 6d796a84bd484ccc4fb072a29c663b660180ae51 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 88e38c178a96634d52920e2de8bb3cbd49869f93 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replace uses of obsolescent BReference[able] API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39870 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10cb62616f2725d77292d62dc977214b00e8ea38 15-Feb-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed destruction order of lock/reference that could lead to access already
deleted memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35467 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 48f1a5b4c933ab0e872328276cd0795cff596d49 24-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Patch by Eric Petit: A read select() should not block when there's not data
available anymore and the remote end has been write-shut-down. Fixes #3536.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30846 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0f1a7f1e76f31db24a21a42cbb01d7b9c 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d550262911f376e55323690a9c7fe269273002e 03-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for SO_PEERCRED for Unix sockets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25305 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ea035707b3d55375ed24f460add69e2d51c3076b 02-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Support the new {send,read}_data_no_buffer() protocol hooks to avoid
unnecessary data copies and waste of memory.
* Changed the storage backend to ring_buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25300 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6057b5ee44416b26f14a0b10c008889285c2a0bb 01-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added a bit more debug output in UnixFifo, but disabled debug output in
all files by default.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25285 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 042be52922f19953b8e4c4aca84181b2ec258aa6 01-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

In Shutdown() pass an actual error code to notify(). B_OK is just
ignored. This fixes the hanging OpenSSH "multiplex" test. Save for the
"forwarding" test, which sometimes hangs due to a TCP bug, the complete
test suite passes, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25284 a95241bf-73f2-0310-859d-f6bbb57e9c96


# acb16f5574015520e6b73a631209eadc3a001841 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added missing select notifications on shutdown().
* Notify read/write instead of write/error when disconnecting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e94e0a76f134d31da6082662a6bb139c43b9ee 24-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

For sockets in listening mode the read_avail() apparently has to return
something.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25142 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61ef761d69fc007db2ea443b938b34ba181f6745 19-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Send() and Receive() select notified the wrong socket about readability
respectively writability.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25069 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59234b36ce027000c55abc7ec2f6ff5b8f6f816b 12-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for SCM_RIGHTS (sending file descriptors).
* Fixed shutdown(). It was computing the wrong fifo flags and set the
wrong ones from the wrong variable on the peer fifo.
* Generally made the Unix sockets behave more like they should. E.g.
after closing one end, it must still be possible to read from the
other (as long as there are buffered data). Also fine-tuned when to
return what errors from recv()/send().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24943 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c1add58abb88e84c48c437d66e10fcd136f6d408 11-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Resolved TODOs: We now do know whether the call comes from userland or
the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24919 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb8b342d5610c48f6eb319d6726491e4f360e005 09-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Protocol module for Unix domain stream type sockets. The implementation
is almost complete, but still quite buggy (receiving data has a good
chance to drop into KDL).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24884 a95241bf-73f2-0310-859d-f6bbb57e9c96