Jeremy Evans <jer...@openbsd.org> writes: > On 11/04 11:19, Jeremie Courreges-Anglas wrote: >> Jeremy Evans <jer...@openbsd.org> writes: >> >> > This is based on the ruby-tame port I worked on at c2k15, which >> > apparently was too early. Using this, you can access pledge(2) >> > from ruby via: >> > >> > require 'pledge' >> > Pledge.pledge('rpath') # stdio added automatically, as ruby needs it >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> This bugs me, since "stdio" is needed by pretty much any program. the >> following program dies with SIGABRT: >> >> #include <unistd.h> >> >> int >> main(void) >> { >> if (pledge("", NULL) == -1) >> return 1; >> return 0; >> } >> >> Why would the ruby interface be different? > > Pretty much any program is not all programs. It is possible for a C > program to run without the stdio promise, if it purely operates on > shared memory and just calls _exit(2) when it wants to exit, as > specified in the man page.
Duh, I had completely missed that bit. I must admit it's been a long time since I've last looked at the manpage. My bad. > It is impossible for a ruby program to run without stdio, there are > various things ruby does internally that require stdio. > > Also, good ruby APIs would not require you to explicity specify > something that is always implicitly required. Ruby is not C. I see, please ignore my initial concerns. > Thanks, > Jeremy > -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE