summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-28 21:15:15 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-28 21:16:26 +0200
commiteb18825fce3c5705a359ff96f0118f8ea517aa7b (patch)
tree4151e37b7ecc9c00292d34ca6177aaf75aafb4e7
parentd43c7d55f49de8b5fd52f55bb88bf3b972c33484 (diff)
downloadserenity-eb18825fce3c5705a359ff96f0118f8ea517aa7b.zip
Base: Add man pages for create_shared_buffer() and share_buffer_with()
-rw-r--r--Base/usr/share/man/man2/create_shared_buffer.md23
-rw-r--r--Base/usr/share/man/man2/share_buffer_with.md24
2 files changed, 47 insertions, 0 deletions
diff --git a/Base/usr/share/man/man2/create_shared_buffer.md b/Base/usr/share/man/man2/create_shared_buffer.md
new file mode 100644
index 0000000000..3396d67011
--- /dev/null
+++ b/Base/usr/share/man/man2/create_shared_buffer.md
@@ -0,0 +1,23 @@
+## Name
+
+create\_shared\_buffer - create a shareable memory buffer
+
+## Synopsis
+```**c++
+#include <SharedBuffer.h>
+
+int create_shared_buffer(int size, void** buffer);
+```
+
+## Description
+
+Creates a new memory region that can be shared with other processes. The region is only accessible to the creating process by default.
+
+## Return value
+
+If a region is successfully created, `create_shared_buffer()` stores a pointer to the memory in `buffer` and returns a buffer ID. Otherwise, it returns -1 and sets `errno` to describe the error.
+
+## Errors
+
+* `EINVAL`: `size` is zero or negative.
+* `EFAULT`: `buffer` is not a valid address.
diff --git a/Base/usr/share/man/man2/share_buffer_with.md b/Base/usr/share/man/man2/share_buffer_with.md
new file mode 100644
index 0000000000..d8e2c8e664
--- /dev/null
+++ b/Base/usr/share/man/man2/share_buffer_with.md
@@ -0,0 +1,24 @@
+## Name
+
+share\_buffer\_with - allow another process to map a shareable buffer
+
+## Synopsis
+```**c++
+#include <SharedBuffer.h>
+
+int share_buffer_with(int shared_buffer_id, pid_t peer_pid);
+```
+
+## Description
+
+Gives the process with PID `peer_pid` permission to map the shareable buffer with ID `shared_buffer_id`.
+
+## Return value
+
+On success, returns 0. Otherwise, returns -1 and `errno` is set.
+
+## Errors
+
+* `EINVAL`: `peer_pid` is invalid, or `shared_buffer_id` is not a valid ID.
+* `EPERM`: The calling process does not have access to the buffer with `shared_buffer_id`.
+* `ESRCH`: No process with PID `peer_pid` is found.