func (p *Plugin) newFSCaller(fsFunc func(path string) (stats *FsStats, err error), fsLen int) *fsCaller {
** Copyright (C) 2001-2023 Zabbix SIA
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
var stuckMounts map[string]int
fsFunc func(path string) (stats *FsStats, err error)
outChanStuckUnchecked chan *FsStats
outChanStuckChecked chan interface{}
func (f *fsCaller) executeFunc(path string) {
stats, err := f.fsFunc(path)
f.outChanStuckUnchecked <- stats
func (f *fsCaller) checkNotStuckAndExecute(path string) {
f.outChanStuckChecked <- fmt.Errorf("mount '%s' is unavailable", path)
case stat := <-f.outChanStuckUnchecked:
f.outChanStuckChecked <- stat
f.outChanStuckChecked <- err
case <-time.After(timeout * time.Second):
f.outChanStuckChecked <- fmt.Errorf("operation on mount '%s' timed out", path)
case <-f.outChanStuckUnchecked:
case <-time.After(timeout * 12 * 3600 * time.Second):
func (f *fsCaller) run(path string) (stat *FsStats, err error) {