Add number of free locks to podman info

This is a nice quality-of-life change that should help to debug
situations where someone runs out of locks (usually when a bunch
of unused volumes accumulate).

Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
Matt Heon
2023-06-05 14:00:40 -04:00
parent 3b39eb1333
commit 1013696ad2
10 changed files with 133 additions and 0 deletions

View File

@ -98,6 +98,16 @@ func (m *SHMLockManager) FreeAllLocks() error {
return m.locks.DeallocateAllSemaphores()
}
// AvailableLocks returns the number of free locks in the manager.
func (m *SHMLockManager) AvailableLocks() (*uint32, error) {
avail, err := m.locks.GetFreeLocks()
if err != nil {
return nil, err
}
return &avail, nil
}
// SHMLock is an individual shared memory lock.
type SHMLock struct {
lockID uint32