This allows for external information to be passed to restore code.
Similar to c087777e37 ("Plumb restore context to afterLoad()").
Updates #1956.
PiperOrigin-RevId: 614125262
The documentation for EPOLLET (which repeatedly instructs users to read/write
until EAGAIN or short read) suggests that its intent is to only cause an epoll
notification when an FD registered with EPOLLET transitions from not-readable
to readable, or not-writable to writable. In practice, however, the actual
implementation for at least Unix domain sockets will trigger an epoll
notification on *every* send (cf. `net/unix/af_unix.c:unix_stream_sendmsg()` =>
"`other->sk_data_ready(other)`" => `net/core/sock.c:sock_def_readable()`), and
nginx (which registers Unix domain sockets with EPOLLET and - apparently
incorrectly - does *not* read from them until EAGAIN or short read) depends on
this property.
PiperOrigin-RevId: 601911295
...they were getting out of control.
The two interface methods now take the same RecvArgs inputs, and return
RecvOutput.
I left `data [][]byte` as an explicit argument since it's technically an
argument (passed into Recv method), but acts like an output in that data is
written to it.
PiperOrigin-RevId: 578625002
This Recv method is called with mm.activeRWMutex in mm.CopyOutFrom, which can
lead to lock order violatations because Release()ing a RightsControlMessage can
trigger filesystem operations (like inotify) which may need filesystem locks.
Instead, we plumb these "unusedRights" messages allll the way up to the
EndpointReader, where they can be safely released outside of mm.activeRWMutex.
PiperOrigin-RevId: 578584323
SO_ACCEPTCONN returns true for TCP sockets which are in a listening state.
Added this socket option support for unix sockets.
PiperOrigin-RevId: 577008617
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.
Signed-off-by: Andrei Vagin <avagin@gmail.com>
This change introduces the nsfs file system. Each new namespace allocates
a new nsfs inode.
Here are reasons why we need these inodes:
* each namespace has to have an unique id.
* proc/pid/ns/ contains one entry for each namespace. Bind mounting one of
the files in this directory to somewhere else in the filesystem keeps the
corresponding namespace alive even if all processes currently in
the namespace terminate.
* setns() allows the calling process to join an existing namespace specified
by a file descriptor.
PiperOrigin-RevId: 550694515
Earlier SetBoundSocketFD() was taking ownership of bound socket FD only on
success. Having it take ownership unconditionally is cleaner.
PiperOrigin-RevId: 516903597
Now there's the unnamed one, and "higherID" which is the lock for the
endpoint that has a higher ID.
The lock dependency should consistently be "lower ID" -> "higher ID".
PiperOrigin-RevId: 491716600
This CL does the following:
- Add the ability for nested locks to have names.
- Give names to all current uses of nested locks in the codebase.
- Truncate `lockdep` debug stack traces to avoid the clutter from the
`lockdep` code itself
- Simplify `lockdep` to not longer require `classMap`.
PiperOrigin-RevId: 491486620
Earlier we were panicking if connectionedEndpoint.boundSocketFD was already set.
Now we return the error associated with syserr.ErrAlreadyBound when we see that
the socket is already bound. This situation can be easily triggered by double
bind(2) on the same socket. Fortunately, this feature is off by default.
Added better error handling for failures.
Added a regression test for this.
PiperOrigin-RevId: 476538438