poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] std: new standard function `openproc'


From: Jose E. Marchesi
Subject: [COMMITTED] std: new standard function `openproc'
Date: Wed, 19 Jan 2022 02:45:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

2022-01-19  Jose E. Marchesi  <jemarch@gnu.org>

        * libpoke/std.pk (openproc): New function.
        * doc/poke.texi (openproc): New section.
---
 ChangeLog      |  5 +++++
 doc/poke.texi  | 17 +++++++++++++++++
 libpoke/std.pk |  5 +++++
 3 files changed, 27 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ad02f6ff..edff6c0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-19  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * libpoke/std.pk (openproc): New function.
+       * doc/poke.texi (openproc): New section.
+
 2022-01-18  Luca Saiu  <positron@gnu.org>
 
        * bootstrap.conf (bootstrap_post_import_hook): Use the specified
diff --git a/doc/poke.texi b/doc/poke.texi
index a681a49b..d074c5a8 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -12310,6 +12310,7 @@ memory of some process.
 @menu
 * open::                       Creating IO spaces.
 * opensub::                     IO sub spaces.
+* openproc::                    IO proc spaces.
 * close::                      Destroying IO spaces.
 * flush::                      Flushing IO spaces.
 * get_ios::                    Getting the current IO space.
@@ -12413,6 +12414,22 @@ provided and they contradict the flags of the 
underlying IOS then
 Trying to access a sub space whose base IOS has been closed results in
 a @code{E_io} exception.
 
+@node openproc
+@subsubsection @code{openproc}
+@cindex @code{openproc}
+
+The @code{openproc} standard function allows you to create IO spaces
+to access the memory of some running program, given its process ID.
+The prototype is:
+
+@example
+fun openproc = (uint<64> @var{pid}, uint<64> @var{flags} = 0) int<32>
+@end example
+
+@noindent
+where @var{pid} is the process ID whose memory we want to poke and
+@var{flags} is a set of open flags.
+
 @node close
 @subsubsection @code{close}
 @cindex @code{close}
diff --git a/libpoke/std.pk b/libpoke/std.pk
index fd6829ac..61789ed0 100644
--- a/libpoke/std.pk
+++ b/libpoke/std.pk
@@ -356,6 +356,11 @@ fun opensub = (int<32> ios,
   return open (handler, flags);
 }
 
+fun openproc = (uint<64> pid, uint<64> flags = 0) int<32>:
+{
+  return open (format ("pid://%u64d", pid), flags);
+}
+
 /*** Miscellanea.  */
 
 var NULL = 0#B;
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]