ulimit alike in ruby?

Discussion in 'Ruby' started by Patrick Gundlach, Jul 29, 2004.

  1. 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
    Patrick Gundlach, Jul 29, 2004
    #1
    1. Advertising

  2. | 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
    Thomas Leitner, Jul 29, 2004
    #2
    1. Advertising

  3. Patrick Gundlach

    Kent Sibilev Guest

    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
    >
    Kent Sibilev, Jul 29, 2004
    #3
  4. Hello Kent,

    Kent Sibilev <> 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
    Patrick Gundlach, Jul 29, 2004
    #4
  5. 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
    Patrick Gundlach, Jul 29, 2004
    #5
  6. Patrick Gundlach

    David Ross Guest

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

    --- Patrick Gundlach
    <> 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
    David Ross, Jul 29, 2004
    #6
  7. 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.
    Patrick Gundlach, Jul 29, 2004
    #7
  8. Patrick Gundlach

    David Ross Guest

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

    > Hello Kent,
    >
    > Kent Sibilev <> 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
    David Ross, Jul 29, 2004
    #8
  9. Patrick Gundlach

    David Ross Guest

    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 <> 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
    > <> wrote:
    >
    > > Hello Kent,
    > >
    > > Kent Sibilev <> 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 Ross, Jul 29, 2004
    #9
  10. Patrick Gundlach, Jul 29, 2004
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maciej Kalisiak

    "ulimit -s" has no effect?

    Maciej Kalisiak, Feb 5, 2004, in forum: Python
    Replies:
    16
    Views:
    2,132
    Josiah Carlson
    Feb 12, 2004
  2. Maxim Veksler

    ulimit on open sockets ?

    Maxim Veksler, Apr 10, 2007, in forum: Python
    Replies:
    6
    Views:
    520
    Alex Martelli
    Apr 14, 2007
  3. Jarek Zgoda

    Set ulimit when using subprocess.Popen?

    Jarek Zgoda, Jan 28, 2008, in forum: Python
    Replies:
    3
    Views:
    709
    Rob Wolfe
    Jan 28, 2008
  4. Greg Lindahl

    ulimit stack size and python threads

    Greg Lindahl, Jan 8, 2009, in forum: Python
    Replies:
    11
    Views:
    1,590
    Martin v. Löwis
    Jan 9, 2009
  5. Kalaky
    Replies:
    0
    Views:
    255
    Kalaky
    Oct 26, 2004
Loading...

Share This Page