Ulimit alike in ruby?

Dear ruby-hackers,

is there any way to set resource limits in ruby? I am starting a
program (popen) that should not create files > 1 MB, so I think that
the linux/unix syscall setrlimit would be the best way for that.
Sure I can write an sh-wrapper or c-wrapper around the ruby process,
but I'd like to avoid that. But I haven't found any kernel#ulimit or
alike methods in ruby.

Patrick

Dear ruby-hackers,

is there any way to set resource limits in ruby? I am starting a
program (popen) that should not create files > 1 MB, so I think that
the linux/unix syscall setrlimit would be the best way for that.
Sure I can write an sh-wrapper or c-wrapper around the ruby process,
but I'd like to avoid that. But I haven't found any kernel#ulimit or
alike methods in ruby.

You could write an extension in C that calls the setrlimit function.
Have a look at pickaxe and the section named "Extending Ruby".

*hth*,
Thomas

Check out http://raa.ruby-lang.org/project/rlimit/

I haven't tried it though.

Cheers,
Kent.

···

On Jul 29, 2004, at 8:06 AM, Patrick Gundlach wrote:

Dear ruby-hackers,

is there any way to set resource limits in ruby? I am starting a
program (popen) that should not create files > 1 MB, so I think that
the linux/unix syscall setrlimit would be the best way for that.
Sure I can write an sh-wrapper or c-wrapper around the ruby process,
but I'd like to avoid that. But I haven't found any kernel#ulimit or
alike methods in ruby.

Patrick

Hello Thomas,

[...]

You could write an extension in C that calls the setrlimit function.
Have a look at pickaxe and the section named "Extending Ruby".

Thanks for the pointer! That looks doable (just did a quick test).

*hth*,

yes, I think it does.

Patrick

Hello Kent,

Kent Sibilev <ksibilev@bellsouth.net> writes:

Check out http://raa.ruby-lang.org/project/rlimit/

rlimit as well as the other project mentioned there
(library/resource) is gone.

But thanks for the pointer, I should look at raa more often.

Patrick

Hello Thomas,

You could write an extension in C that calls the setrlimit function.
Have a look at pickaxe and the section named "Extending Ruby".

That is what I did now. I always skipped this chapter of pickaxe
'cause I was too afraid of it :-). Thanks again for your suggestion.

Patrick

Thanks to David and Andrew for this nice book; I will buy a paper
copy of it when the new edition comes out.

I think rlimit is what you are looking for. It is
already made. --David Ross

--- Patrick Gundlach

···

<clr3.10.randomuser@spamgourmet.com> wrote:

Hello Thomas,

[...]

> You could write an extension in C that calls the
setrlimit function.
> Have a look at pickaxe and the section named
"Extending Ruby".

Thanks for the pointer! That looks doable (just did
a quick test).

> *hth*,

yes, I think it does.

Patrick

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

Oh shoot me for not reading all the emails. I will get
the link to rlimits for you. It is a good library.
--David Ross
--- Patrick Gundlach

···

<clr3.10.randomuser@spamgourmet.com> wrote:

Hello Kent,

Kent Sibilev <ksibilev@bellsouth.net> writes:

> Check out http://raa.ruby-lang.org/project/rlimit/

rlimit as well as the other project mentioned there
(library/resource) is gone.

But thanks for the pointer, I should look at raa
more often.

Patrick

__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

http://rubycc.rubyforge.org/rlimit_1_0.tgz

Here is the link to rlimit_1_0. Thankfully I was able
to find guy 6 months ago and asked him for the backup
files. --David

···

--- David Ross <drossruby@yahoo.com> wrote:

Oh shoot me for not reading all the emails. I will
get
the link to rlimits for you. It is a good library.
--David Ross
--- Patrick Gundlach
<clr3.10.randomuser@spamgourmet.com> wrote:

> Hello Kent,
>
> Kent Sibilev <ksibilev@bellsouth.net> writes:
>
> > Check out
http://raa.ruby-lang.org/project/rlimit/
>
> rlimit as well as the other project mentioned
there
> (library/resource) is gone.
>
> But thanks for the pointer, I should look at raa
> more often.
>
> Patrick
>
>

__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

David, thanks for the url

http://rubycc.rubyforge.org/rlimit_1_0.tgz

I go for rlimit you pointed out...

Patrick