Skip to content

Commit

Permalink
Merge pull request #20643 from protosam/main
Browse files Browse the repository at this point in the history
fix max open files limit for qemu
  • Loading branch information
openshift-merge-bot[bot] authored Nov 11, 2023
2 parents bc7c01d + 5e0471b commit a22c290
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions cmd/podman/early_init_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"fmt"
"os"
"syscall"
)

func setRLimitsNoFile() error {
var rLimitNoFile syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimitNoFile); err != nil {
return fmt.Errorf("getting RLIMITS_NOFILE: %w", err)
}
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &syscall.Rlimit{
Max: rLimitNoFile.Max,
Cur: rLimitNoFile.Max,
})
if err != nil {
return fmt.Errorf("setting new RLIMITS_NOFILE: %w", err)
}
return nil
}

func earlyInitHook() {
if err := setRLimitsNoFile(); err != nil {
fmt.Fprintf(os.Stderr, "Failed to set RLIMITS_NOFILE: %s\n", err.Error())
}
}
4 changes: 2 additions & 2 deletions cmd/podman/early_init_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !linux
// +build !linux
//go:build !linux && !darwin
// +build !linux,!darwin

package main

Expand Down

0 comments on commit a22c290

Please sign in to comment.