mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-06 08:55:44 +00:00
Problem: While removing cgroupsv1 code, I noticed my neovim Go config automatically changed fileperms to the new octal format and I didn't want that polluting my diffs. Decision: I thought it best to switch to the new octal format in a dedicated PR. Action: - Cursor switched to new octal format for all fileperm ocurrences in Go source and test files. - vendor/, docs/ and non-Go files were ignored. - Reviewed manually. Ref: https://go.dev/ref/spec#Go_1.13 Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
33 lines
657 B
Go
33 lines
657 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"syscall"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func setRLimits() error {
|
|
rlimits := new(syscall.Rlimit)
|
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
|
|
return fmt.Errorf("getting rlimits: %w", err)
|
|
}
|
|
rlimits.Cur = rlimits.Max
|
|
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
|
|
return fmt.Errorf("setting new rlimits: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func setUMask() {
|
|
// Be sure we can create directories with 0755 mode.
|
|
syscall.Umask(0o022)
|
|
}
|
|
|
|
func earlyInitHook() {
|
|
if err := setRLimits(); err != nil {
|
|
logrus.Errorf("Failed to set rlimits: %v", err)
|
|
}
|
|
|
|
setUMask()
|
|
}
|