Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Stat (system call)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Functions== The [[C POSIX library]] header {{Mono|sys/stat.h}}, found on [[POSIX]] and other [[Unix-like]] [[operating system]]s, declares <code>stat()</code> and related functions. <syntaxhighlight lang="c"> int stat(const char *path, struct stat *buf); int lstat(const char *path, struct stat *buf); int fstat(int filedesc, struct stat *buf); </syntaxhighlight> Each function accepts a pointer to a <code>struct stat</code> buffer which the function loads with information about the specified file. As typical for system calls, each function returns 0 on success, or on failure, sets [[errno]] to indicate the failure condition and returns β1. The <code>stat()</code> and <code>lstat()</code> functions accept a [[Path (computing)|path]] argument that specifies a file. If the path identifies a [[symbolic link]], <code>stat()</code> returns attributes of the link target, whereas <code>lstat()</code> returns attributes of the link itself. The <code>fstat()</code> function accepts a [[file descriptor]] argument instead of a path, and returns attributes of the file that it identifies. The functions was extended to support [[large file support|large files]]. Functions <code>stat64()</code>, <code>lstat64()</code> and <code>fstat64()</code> load information into <code>struct stat64</code> buffer, which supports 64-bit sizes; allowing them to work with files 2 GiB and larger (up to 8 EiB). When the <code>_FILE_OFFSET_BITS</code> [[C macro|macro]] is defined to 64, the 64-bit functions are available as the original names.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)