aboutsummaryrefslogtreecommitdiff
path: root/hid/main.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-02 22:10:05 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-08-02 22:10:31 +0200
commit5f0d5bca705747ed1f8033160e8286e9428f3657 (patch)
tree323c46460fa29915450c9ab189abdc8b7ee2b3b1 /hid/main.go
parent442fa5d6607d6188be01d342e1bc7d24b977bd22 (diff)
downloadhaven-5f0d5bca705747ed1f8033160e8286e9428f3657.tar.gz
haven-5f0d5bca705747ed1f8033160e8286e9428f3657.tar.xz
haven-5f0d5bca705747ed1f8033160e8286e9428f3657.zip
hid: bump the FD limit
Diffstat (limited to 'hid/main.go')
-rw-r--r--hid/main.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/hid/main.go b/hid/main.go
index cf57b5e..40f47bc 100644
--- a/hid/main.go
+++ b/hid/main.go
@@ -3493,6 +3493,14 @@ func main() {
os.Exit(2)
}
+ // Note that this has become unnecessary since Go 1.19.
+ var limit syscall.Rlimit
+ if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err == nil &&
+ limit.Cur != limit.Max {
+ limit.Cur = limit.Max
+ syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit)
+ }
+
config = make(simpleConfig)
config.loadDefaults(configTable)
if err := config.updateFromFile(); err != nil && !os.IsNotExist(err) {