summaryrefslogtreecommitdiff
path: root/Kernel/SharedBuffer.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-28 11:45:19 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-28 12:55:58 +0100
commitf72e5bbb17cd54aa0e75e4436ddcd7ca0fda4648 (patch)
tree4f66b2ea3a3ebfbde38c95832a2b21de373af291 /Kernel/SharedBuffer.cpp
parent8460d02651a1669ba3cdcc7cf277ceda1c0447de (diff)
downloadserenity-f72e5bbb17cd54aa0e75e4436ddcd7ca0fda4648.zip
Kernel+LibC: Rename shared buffer syscalls to use a prefix
This feels a lot more consistent and Unixy: create_shared_buffer() => shbuf_create() share_buffer_with() => shbuf_allow_pid() share_buffer_globally() => shbuf_allow_all() get_shared_buffer() => shbuf_get() release_shared_buffer() => shbuf_release() seal_shared_buffer() => shbuf_seal() get_shared_buffer_size() => shbuf_get_size() Also, "shared_buffer_id" is shortened to "shbuf_id" all around.
Diffstat (limited to 'Kernel/SharedBuffer.cpp')
-rw-r--r--Kernel/SharedBuffer.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Kernel/SharedBuffer.cpp b/Kernel/SharedBuffer.cpp
index c411b58c18..32b67a4ecd 100644
--- a/Kernel/SharedBuffer.cpp
+++ b/Kernel/SharedBuffer.cpp
@@ -46,7 +46,7 @@ void SharedBuffer::sanity_check(const char* what)
found_refs += ref.count;
if (found_refs != m_total_refs) {
- dbg() << what << " sanity -- SharedBuffer{" << this << "} id: " << m_shared_buffer_id << " has total refs " << m_total_refs << " but we found " << found_refs;
+ dbg() << what << " sanity -- SharedBuffer{" << this << "} id: " << m_shbuf_id << " has total refs " << m_total_refs << " but we found " << found_refs;
for (const auto& ref : m_refs) {
dbg() << " ref from pid " << ref.pid << ": refcnt " << ref.count;
}
@@ -109,7 +109,7 @@ void SharedBuffer::share_with(pid_t peer_pid)
return;
for (auto& ref : m_refs) {
if (ref.pid == peer_pid) {
- // don't increment the reference count yet; let them get_shared_buffer it first.
+ // don't increment the reference count yet; let them shbuf_get it first.
sanity_check("share_with (old ref)");
return;
}
@@ -129,12 +129,12 @@ void SharedBuffer::deref_for_process(Process& process)
m_total_refs--;
if (ref.count == 0) {
#ifdef SHARED_BUFFER_DEBUG
- dbg() << "Releasing shared buffer reference on " << m_shared_buffer_id << " of size " << size() << " by PID " << process.pid();
+ dbg() << "Releasing shared buffer reference on " << m_shbuf_id << " of size " << size() << " by PID " << process.pid();
#endif
process.deallocate_region(*ref.region);
m_refs.unstable_remove(i);
#ifdef SHARED_BUFFER_DEBUG
- dbg() << "Released shared buffer reference on " << m_shared_buffer_id << " of size " << size() << " by PID " << process.pid();
+ dbg() << "Released shared buffer reference on " << m_shbuf_id << " of size " << size() << " by PID " << process.pid();
#endif
sanity_check("deref_for_process");
destroy_if_unused();
@@ -154,12 +154,12 @@ void SharedBuffer::disown(pid_t pid)
auto& ref = m_refs[i];
if (ref.pid == pid) {
#ifdef SHARED_BUFFER_DEBUG
- dbg() << "Disowning shared buffer " << m_shared_buffer_id << " of size " << size() << " by PID " << pid;
+ dbg() << "Disowning shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid;
#endif
m_total_refs -= ref.count;
m_refs.unstable_remove(i);
#ifdef SHARED_BUFFER_DEBUG
- dbg() << "Disowned shared buffer " << m_shared_buffer_id << " of size " << size() << " by PID " << pid;
+ dbg() << "Disowned shared buffer " << m_shbuf_id << " of size " << size() << " by PID " << pid;
#endif
destroy_if_unused();
return;
@@ -173,10 +173,10 @@ void SharedBuffer::destroy_if_unused()
sanity_check("destroy_if_unused");
if (m_total_refs == 0) {
#ifdef SHARED_BUFFER_DEBUG
- kprintf("Destroying unused SharedBuffer{%p} id: %d\n", this, m_shared_buffer_id);
+ kprintf("Destroying unused SharedBuffer{%p} id: %d\n", this, m_shbuf_id);
#endif
auto count_before = shared_buffers().resource().size();
- shared_buffers().resource().remove(m_shared_buffer_id);
+ shared_buffers().resource().remove(m_shbuf_id);
ASSERT(count_before != shared_buffers().resource().size());
}
}