spiegel_podman/cmd/podman/early_init_linux.go
Lokesh Mandvekar 74788a3fe1
fileperms: newer Go 1.13+ octal literal format
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>
2025-10-16 14:11:29 -04:00

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()
}