mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
Kernel+Userland: Remove sys$shbuf_allow_all() and userland wrappers
Nobody is using globally shared shbufs anymore, so let's remove them.
This commit is contained in:
parent
968c1fa00a
commit
b818cf898e
13 changed files with 0 additions and 70 deletions
|
@ -156,7 +156,6 @@ namespace Kernel {
|
|||
S(dbgputch) \
|
||||
S(dbgputstr) \
|
||||
S(watch_file) \
|
||||
S(shbuf_allow_all) \
|
||||
S(mprotect) \
|
||||
S(realpath) \
|
||||
S(get_process_name) \
|
||||
|
|
|
@ -336,7 +336,6 @@ public:
|
|||
int sys$mknod(Userspace<const Syscall::SC_mknod_params*>);
|
||||
int sys$shbuf_create(int, void** buffer);
|
||||
int sys$shbuf_allow_pid(int, pid_t peer_pid);
|
||||
int sys$shbuf_allow_all(int);
|
||||
void* sys$shbuf_get(int shbuf_id, Userspace<size_t*> size);
|
||||
int sys$shbuf_release(int shbuf_id);
|
||||
int sys$shbuf_seal(int shbuf_id);
|
||||
|
|
|
@ -65,8 +65,6 @@ void SharedBuffer::sanity_check(const char* what)
|
|||
bool SharedBuffer::is_shared_with(ProcessID peer_pid) const
|
||||
{
|
||||
LOCKER(shared_buffers().lock(), Lock::Mode::Shared);
|
||||
if (m_global)
|
||||
return true;
|
||||
for (auto& ref : m_refs) {
|
||||
if (ref.pid == peer_pid) {
|
||||
return true;
|
||||
|
@ -80,18 +78,6 @@ void* SharedBuffer::ref_for_process_and_get_address(Process& process)
|
|||
{
|
||||
LOCKER(shared_buffers().lock());
|
||||
ASSERT(is_shared_with(process.pid()));
|
||||
if (m_global) {
|
||||
bool found = false;
|
||||
for (auto& ref : m_refs) {
|
||||
if (ref.pid == process.pid()) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
m_refs.append(Reference(process.pid()));
|
||||
}
|
||||
|
||||
for (auto& ref : m_refs) {
|
||||
if (ref.pid == process.pid()) {
|
||||
if (!ref.region) {
|
||||
|
@ -112,8 +98,6 @@ void* SharedBuffer::ref_for_process_and_get_address(Process& process)
|
|||
void SharedBuffer::share_with(ProcessID peer_pid)
|
||||
{
|
||||
LOCKER(shared_buffers().lock());
|
||||
if (m_global)
|
||||
return;
|
||||
for (auto& ref : m_refs) {
|
||||
if (ref.pid == peer_pid) {
|
||||
// don't increment the reference count yet; let them shbuf_get it first.
|
||||
|
|
|
@ -65,7 +65,6 @@ public:
|
|||
bool is_shared_with(ProcessID peer_pid) const;
|
||||
void* ref_for_process_and_get_address(Process& process);
|
||||
void share_with(ProcessID peer_pid);
|
||||
void share_globally() { m_global = true; }
|
||||
void deref_for_process(Process& process);
|
||||
bool disown(ProcessID pid);
|
||||
static void share_all_shared_buffers(Process& from_process, Process& with_process);
|
||||
|
@ -86,7 +85,6 @@ public:
|
|||
private:
|
||||
int m_shbuf_id { -1 };
|
||||
bool m_writable { true };
|
||||
bool m_global { false };
|
||||
NonnullRefPtr<AnonymousVMObject> m_vmobject;
|
||||
Vector<Reference, 2> m_refs;
|
||||
unsigned m_total_refs { 0 };
|
||||
|
|
|
@ -96,20 +96,6 @@ int Process::sys$shbuf_allow_pid(int shbuf_id, pid_t peer_pid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$shbuf_allow_all(int shbuf_id)
|
||||
{
|
||||
REQUIRE_PROMISE(shared_buffer);
|
||||
LOCKER(shared_buffers().lock());
|
||||
auto it = shared_buffers().resource().find(shbuf_id);
|
||||
if (it == shared_buffers().resource().end())
|
||||
return -EINVAL;
|
||||
auto& shared_buffer = *(*it).value;
|
||||
if (!shared_buffer.is_shared_with(m_pid))
|
||||
return -EPERM;
|
||||
shared_buffer.share_globally();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$shbuf_release(int shbuf_id)
|
||||
{
|
||||
REQUIRE_PROMISE(shared_buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue