summaryrefslogtreecommitdiff
path: root/code/snippets/exceeding_soft_rlimits.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/snippets/exceeding_soft_rlimits.rb')
-rw-r--r--code/snippets/exceeding_soft_rlimits.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/code/snippets/exceeding_soft_rlimits.rb b/code/snippets/exceeding_soft_rlimits.rb
new file mode 100644
index 0000000..4b6f2ed
--- /dev/null
+++ b/code/snippets/exceeding_soft_rlimits.rb
@@ -0,0 +1,7 @@
+# Set the maximum number of open files to 3. We know this
+# will be maxed out because the standard streams occupy
+# the first three file descriptors.
+Process.setrlimit(:NOFILE, 3)
+
+File.open('/dev/null')
+