[fs.op.space]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.op.space)

### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.space)

#### 31.12.13.35 Space [fs.op.space]

[ð](#lib:space)

`space_info filesystem::space(const path& p);
space_info filesystem::space(const path& p, error_code& ec) noexcept;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18564)

*Returns*: An object of type space_info[.](#1.sentence-1)

The value of the space_info object is determined as if by using POSIX statvfs to obtain a POSIX struct statvfs,
 and then multiplying its f_blocks, f_bfree,
 and f_bavail members by its f_frsize member,
 and assigning the results to the capacity, free,
 and available members respectively[.](#1.sentence-2)

Any members for which the
 value cannot be determined shall be set to static_cast<uintmax_t>(-1)[.](#1.sentence-3)

For the signature with argument ec, all members are set to static_cast<uintmax_t>(-1) if an error occurs[.](#1.sentence-4)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18577)

*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18581)

*Remarks*: The value of member space_info​::​available is operating system dependent[.](#3.sentence-1)

[*Note [1](#note-1)*:

available might be
 less than free[.](#3.sentence-2)

â *end note*]
