gvisor icon indicating copy to clipboard operation
gvisor copied to clipboard

Add support for /proc/[pid]/limits

Open jseba opened this issue 3 years ago • 5 comments

This adds support for the /proc/[pid]/limits file to view information from ulimit or setrlimit. It prints the output in the exact format that the Linux kernel uses, which is hand-spaced columns instead of tabs or a columnar printer. In order to support the file format, helpers have been added to get the textual names and units for the limit types.

jseba avatar Jul 18 '22 21:07 jseba

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Jul 18 '22 21:07 google-cla[bot]

Need to add a test case in https://github.com/google/gvisor/blob/master/test/syscalls/linux/rlimits.cc.

avagin avatar Aug 15 '22 05:08 avagin

The PR looks good overall.

avagin avatar Aug 15 '22 05:08 avagin

Need to add a test case in https://github.com/google/gvisor/blob/master/test/syscalls/linux/rlimits.cc.

Can do, forgot about the C++ tests. What test case were you thinking of? That changing the various limits shows up in the proc file?

jseba avatar Aug 15 '22 16:08 jseba

@jseba I think about something very basic: read a file and check one or two limits are shown properly.

avagin avatar Aug 15 '22 21:08 avagin

Apologies for taking so long to get back to this, I rebased and added a simple unit test to read the limits file after changing it via setrlimit

jseba avatar Dec 14 '22 19:12 jseba

@avagin friendly ping when you get a chance to review again, I'd appreciate it

jseba avatar Jan 24 '23 21:01 jseba

@jseba pls merge the fix to the proper commit.

avagin avatar Jan 24 '23 23:01 avagin

@jseba pls merge the fix to the proper commit.

Do I rebase it into the unit test commit and force push?

jseba avatar Jan 25 '23 00:01 jseba

@jseba yes. We want to have the clean history in the main repo.

avagin avatar Jan 25 '23 00:01 avagin

@jseba yes. We want to have the clean history in the main repo.

gotcha, not sure how copybara works but I squashed the unit test fix into its commit, let me know if I need to squash the whole PR into one commit

jseba avatar Jan 25 '23 00:01 jseba