From 18f3079a090fc55ee784f53be1e26406b05422f9 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Fri, 19 Jul 2024 01:04:55 -0300 Subject: [PATCH] Update docs to use consistent terms --- README.md | 24 +++++++++---------- .../examples/bsdcapsicum.rb/2_fork_example.rb | 12 +++++----- .../bsdcapsicum.rb/3_set_rights_example.rb | 12 +++++----- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 1be4537..3a375b4 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,9 @@ require "bsd/capsicum" print "[parent] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes" : "no"), "\n" fork do - print "[subprocess] Enter capability mode: ", (BSD::Capsicum.enter! ? "ok" : "error"), "\n" - print "[subprocess] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes" : "no"), "\n" - print "[subprocess] Exit", "\n" + print "[child] Enter capability mode: ", (BSD::Capsicum.enter! ? "ok" : "error"), "\n" + print "[child] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes" : "no"), "\n" + print "[child] Exit", "\n" exit 42 end Process.wait @@ -60,9 +60,9 @@ print "[parent] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes ## # [parent] In capability mode: no -# [subprocess] Enter capability mode: ok -# [subprocess] In capability mode: yes -# [subprocess] Exit +# [child] Enter capability mode: ok +# [child] In capability mode: yes +# [child] Exit # [parent] In capability mode: no ``` @@ -87,15 +87,15 @@ file.sync = true print "[parent] Obtain file descriptor (with all capabilities)", "\n" fork do BSD::Capsicum.set_rights!(file, %i[CAP_READ]) - print "[subprocess] Reduce capabilities to read", "\n" + print "[child] Reduce capabilities to read", "\n" file.gets - print "[subprocess] Read OK", "\n" + print "[child] Read OK", "\n" begin file.write "foo" rescue Errno::ENOTCAPABLE => ex - print "[subprocess] Error: #{ex.message} (#{ex.class})", "\n" + print "[child] Error: #{ex.message} (#{ex.class})", "\n" end end Process.wait @@ -104,9 +104,9 @@ print "[parent] Write OK", "\n" ## # [parent] Obtain file descriptor (with all capabilities) -# [subprocess] Reduce capabilities to read -# [subprocess] Read OK -# [subprocess] Error: Capabilities insufficient @ io_write - /home/user/bsdcapsicum.txt (Errno::ENOTCAPABLE) +# [child] Reduce capabilities to read +# [child] Read OK +# [child] Error: Capabilities insufficient @ io_write - /home/user/bsdcapsicum.txt (Errno::ENOTCAPABLE) # [parent] Write OK ``` diff --git a/share/examples/bsdcapsicum.rb/2_fork_example.rb b/share/examples/bsdcapsicum.rb/2_fork_example.rb index 7e76f8c..5dd2229 100644 --- a/share/examples/bsdcapsicum.rb/2_fork_example.rb +++ b/share/examples/bsdcapsicum.rb/2_fork_example.rb @@ -3,9 +3,9 @@ require "bsd/capsicum" print "[parent] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes" : "no"), "\n" fork do - print "[subprocess] Enter capability mode: ", (BSD::Capsicum.enter! ? "ok" : "error"), "\n" - print "[subprocess] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes" : "no"), "\n" - print "[subprocess] Exit", "\n" + print "[child] Enter capability mode: ", (BSD::Capsicum.enter! ? "ok" : "error"), "\n" + print "[child] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes" : "no"), "\n" + print "[child] Exit", "\n" exit 42 end Process.wait @@ -13,7 +13,7 @@ print "[parent] In capability mode: ", (BSD::Capsicum.in_capability_mode? ? "yes ## # [parent] In capability mode: no -# [subprocess] Enter capability mode: ok -# [subprocess] In capability mode: yes -# [subprocess] Exit +# [child] Enter capability mode: ok +# [child] In capability mode: yes +# [child] Exit # [parent] In capability mode: no diff --git a/share/examples/bsdcapsicum.rb/3_set_rights_example.rb b/share/examples/bsdcapsicum.rb/3_set_rights_example.rb index 1cf4931..15a3d3a 100644 --- a/share/examples/bsdcapsicum.rb/3_set_rights_example.rb +++ b/share/examples/bsdcapsicum.rb/3_set_rights_example.rb @@ -7,15 +7,15 @@ file.sync = true print "[parent] Obtain file descriptor (with all capabilities)", "\n" fork do BSD::Capsicum.set_rights!(file, %i[CAP_READ]) - print "[subprocess] Reduce capabilities to read", "\n" + print "[child] Reduce capabilities to read", "\n" file.gets - print "[subprocess] Read OK", "\n" + print "[child] Read OK", "\n" begin file.write "foo" rescue Errno::ENOTCAPABLE => ex - print "[subprocess] Error: #{ex.message} (#{ex.class})", "\n" + print "[child] Error: #{ex.message} (#{ex.class})", "\n" end end Process.wait @@ -24,7 +24,7 @@ print "[parent] Write OK", "\n" ## # [parent] Obtain file descriptor (with all capabilities) -# [subprocess] Reduce capabilities to read -# [subprocess] Read OK -# [subprocess] Error: Capabilities insufficient @ io_write - /home/user/bsdcapsicum.txt (Errno::ENOTCAPABLE) +# [child] Reduce capabilities to read +# [child] Read OK +# [child] Error: Capabilities insufficient @ io_write - /home/user/bsdcapsicum.txt (Errno::ENOTCAPABLE) # [parent] Write OK