Noel Yap
Noel Yap

Reputation: 19768

How to get soft limit of max open file handles

I have the following:

    var limit syscall.Rlimit
    if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
        log.Fatal("Getrlimit:" + err.Error())
    }
    vlog.Infof("%v file descriptors out of a maximum of %v available\n", limit.Cur, limit.Max)

but limit.Max is the hard limit, not the soft limit. How do I go about getting the soft limit?

Upvotes: 1

Views: 1055

Answers (1)

Ollie
Ollie

Reputation: 439

limit.Cur is the soft limit. limit.Max is the hard limit.

Upvotes: 1

Related Questions