Please give more details on what problems you are having. The setrlimit interfaces are there and using them is not a problem. It's just the case that almost none of the limits actually limit anything, and the settings are not inherited on exec. But just making the calls should work.