mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +00:00
Kernel: Use non-locking {Nonnull,}RefPtr for OpenFileDescription
This patch switches away from {Nonnull,}LockRefPtr to the non-locking smart pointers throughout the kernel. I've looked at the handful of places where these were being persisted and I don't see any race situations. Note that the process file descriptor table (Process::m_fds) was already guarded via MutexProtected.
This commit is contained in:
parent
36b0ecfe9e
commit
d1371d66f7
34 changed files with 82 additions and 80 deletions
|
@ -38,9 +38,9 @@ UNMAP_AFTER_INIT void PTYMultiplexer::initialize()
|
|||
MUST(the().after_inserting());
|
||||
}
|
||||
|
||||
ErrorOr<NonnullLockRefPtr<OpenFileDescription>> PTYMultiplexer::open(int options)
|
||||
ErrorOr<NonnullRefPtr<OpenFileDescription>> PTYMultiplexer::open(int options)
|
||||
{
|
||||
return m_freelist.with([&](auto& freelist) -> ErrorOr<NonnullLockRefPtr<OpenFileDescription>> {
|
||||
return m_freelist.with([&](auto& freelist) -> ErrorOr<NonnullRefPtr<OpenFileDescription>> {
|
||||
if (freelist.is_empty())
|
||||
return EBUSY;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
static PTYMultiplexer& the();
|
||||
|
||||
// ^CharacterDevice
|
||||
virtual ErrorOr<NonnullLockRefPtr<OpenFileDescription>> open(int options) override;
|
||||
virtual ErrorOr<NonnullRefPtr<OpenFileDescription>> open(int options) override;
|
||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return 0; }
|
||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override { return 0; }
|
||||
virtual bool can_read(OpenFileDescription const&, u64) const override { return true; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue