2018-03-19 16:51:38 +01:00
|
|
|
// +build darwin linux
|
2016-11-13 01:04:55 +01:00
|
|
|
|
|
|
|
// fill in statvfs structure with OS specific values
|
|
|
|
// Statfs_t is different per-kernel, and only exists on some unixes (not Solaris for instance)
|
|
|
|
|
|
|
|
package sftp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
2018-09-21 12:01:55 +02:00
|
|
|
func (p sshFxpExtendedPacketStatVFS) respond(svr *Server) responsePacket {
|
2016-11-13 01:04:55 +01:00
|
|
|
stat := &syscall.Statfs_t{}
|
|
|
|
if err := syscall.Statfs(p.Path, stat); err != nil {
|
2018-09-21 12:01:55 +02:00
|
|
|
return statusFromError(p, err)
|
2016-11-13 01:04:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
retPkt, err := statvfsFromStatfst(stat)
|
|
|
|
if err != nil {
|
2018-09-21 12:01:55 +02:00
|
|
|
return statusFromError(p, err)
|
2016-11-13 01:04:55 +01:00
|
|
|
}
|
|
|
|
retPkt.ID = p.ID
|
|
|
|
|
2018-09-21 12:01:55 +02:00
|
|
|
return retPkt
|
2016-11-13 01:04:55 +01:00
|
|
|
}
|