fdmax

package module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 6 Imported by: 8 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

fdmax

Small Helper library that increases automatically the maximum number of file descriptors for the current go program. It can be simply imported as follows:

package main

import (
	"fmt"

	_ "github.com/projectdiscovery/fdmax/autofdmax"
)

func main() {
	fmt.Println("test")
}

Documentation

Index

Constants

View Source
const UnixMax uint64 = 999999

UnixMax on unix systems.

Variables

View Source
var (
	// ErrUnsupportedPlatform error if the platform doesn't support file descriptor increase via system api
	ErrUnsupportedPlatform = errors.New("unsupported platform")
)
View Source
var OSXMax uint64 = 24576

OSXMax on darwin. Populated from kern.maxfilesperproc at init on darwin; the literal here is a fallback for other platforms and when the sysctl fails.

Functions

func Set

func Set(maxLimit uint64) error

Set raises or lowers the soft RLIMIT_NOFILE. The hard limit is never lowered. When the request exceeds it, privileged callers get the hard limit raised to match; everyone else is clamped to the existing hard limit.

func SetWithUlimit added in v0.0.4

func SetWithUlimit(maxLimit uint64) error

Types

type Limits

type Limits struct {
	Current uint64
	Max     uint64
}

Limits contains the file system descriptor limits

func Get

func Get() (*Limits, error)

Get the current limits

func GetWithUlimit added in v0.0.4

func GetWithUlimit() (*Limits, error)

Directories

Path Synopsis
example
cmd command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL