ulimit alike in ruby?

P

Patrick Gundlach

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
 
T

Thomas Leitner

| 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
 
P

Patrick Gundlach

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).

yes, I think it does.

Patrick
 
D

David Ross

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

--- Patrick Gundlach
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).

yes, I think it does.

Patrick




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

Patrick Gundlach

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.
 
D

David Ross

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
Hello Kent,



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
 
D

David Ross

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 said:
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





__________________________________
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top