diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2021-11-11 11:34:09 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2021-11-11 11:45:19 +0900 |
commit | f5dcecf3456e5f52aa979cc2a59c5dc7b398e123 (patch) | |
tree | 268e038ee34d7f6fe0d753ab65f241db58e2872a /include/ruby | |
parent | ad84c5d1b047604cc36a12d388ff2caa1da954c1 (diff) | |
download | ruby-f5dcecf3456e5f52aa979cc2a59c5dc7b398e123.tar.gz |
rb_file_size: add doxygen
Must not be a bad idea to improve documents. [ci skip]
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/internal/intern/file.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/ruby/internal/intern/file.h b/include/ruby/internal/intern/file.h index 43f1fd7c60..7a6af99872 100644 --- a/include/ruby/internal/intern/file.h +++ b/include/ruby/internal/intern/file.h @@ -187,6 +187,23 @@ RBIMPL_ATTR_PURE() */ int rb_is_absolute_path(const char *path); +/** + * Queries the file size of the given file. Because this function calls + * `fstat(2)` internally, it is a failure to pass a closed file to this + * function. + * + * This function flushes the passed file's buffer if any. Can take time. + * + * @param[in] file A file object. + * @exception rb_eFrozenError `file` is frozen. + * @exception rb_eIOError `file` is closed. + * @exception rb_eSystemCallError Permission denied etc. + * @return The size of the passed file. + * @note Passing a non-regular file such as a UNIX domain socket to this + * function is not a failure. But the return value is + * unpredictable. POSIX's `<sys/stat.h>` states that "the use of + * this field is unspecified" then. + */ off_t rb_file_size(VALUE file); RBIMPL_SYMBOL_EXPORT_END() |