MCPcopy Create free account
hub / github.com/F-Stack/f-stack / freebsd4_getfsstat

Function freebsd4_getfsstat

freebsd/kern/vfs_syscalls.c:650–680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648};
649#endif
650int
651freebsd4_getfsstat(struct thread *td, struct freebsd4_getfsstat_args *uap)
652{
653 struct statfs *buf, *sp;
654 struct ostatfs osb;
655 size_t count, size;
656 int error;
657
658 if (uap->bufsize < 0)
659 return (EINVAL);
660 count = uap->bufsize / sizeof(struct ostatfs);
661 if (count > SIZE_MAX / sizeof(struct statfs))
662 return (EINVAL);
663 size = count * sizeof(struct statfs);
664 error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE,
665 uap->mode);
666 if (error == 0)
667 td->td_retval[0] = count;
668 if (size != 0) {
669 sp = buf;
670 while (count != 0 && error == 0) {
671 freebsd4_cvtstatfs(sp, &osb);
672 error = copyout(&osb, uap->buf, sizeof(osb));
673 sp++;
674 uap->buf++;
675 count--;
676 }
677 free(buf, M_STATFS);
678 }
679 return (error);
680}
681
682/*
683 * Implement fstatfs() for (NFS) file handles.

Callers

nothing calls this directly

Calls 4

kern_getfsstatFunction · 0.85
freebsd4_cvtstatfsFunction · 0.85
freeFunction · 0.70
copyoutFunction · 0.50

Tested by

no test coverage detected