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. 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. Thanks, Jeremy