summaryrefslogtreecommitdiffstats
path: root/upstream/archlinux/man3p/fstat.3p
diff options
context:
space:
mode:
Diffstat (limited to 'upstream/archlinux/man3p/fstat.3p')
-rw-r--r--upstream/archlinux/man3p/fstat.3p194
1 files changed, 194 insertions, 0 deletions
diff --git a/upstream/archlinux/man3p/fstat.3p b/upstream/archlinux/man3p/fstat.3p
new file mode 100644
index 00000000..1b873b41
--- /dev/null
+++ b/upstream/archlinux/man3p/fstat.3p
@@ -0,0 +1,194 @@
+'\" et
+.TH FSTAT "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\"
+.SH PROLOG
+This manual page is part of the POSIX Programmer's Manual.
+The Linux implementation of this interface may differ (consult
+the corresponding Linux manual page for details of Linux behavior),
+or the interface may not be implemented on Linux.
+.\"
+.SH NAME
+fstat
+\(em get file status
+.SH SYNOPSIS
+.LP
+.nf
+#include <sys/stat.h>
+.P
+int fstat(int \fIfildes\fP, struct stat *\fIbuf\fP);
+.fi
+.SH DESCRIPTION
+The
+\fIfstat\fR()
+function shall obtain information about an open file associated with
+the file descriptor
+.IR fildes ,
+and shall write it to the area pointed to by
+.IR buf .
+.P
+If
+.IR fildes
+references a shared memory object, the implementation shall update in
+the
+.BR stat
+structure pointed to by the
+.IR buf
+argument the
+.IR st_uid ,
+.IR st_gid ,
+.IR st_size ,
+and
+.IR st_mode
+fields, and only the S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH, and
+S_IWOTH file permission bits need be valid.
+The implementation may update other fields and flags.
+.P
+If
+.IR fildes
+references a typed memory object, the implementation shall update in
+the
+.BR stat
+structure pointed to by the
+.IR buf
+argument the
+.IR st_uid ,
+.IR st_gid ,
+.IR st_size ,
+and
+.IR st_mode
+fields, and only the S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH, and
+S_IWOTH file permission bits need be valid. The implementation
+may update other fields and flags.
+.P
+The
+.IR buf
+argument is a pointer to a
+.BR stat
+structure, as defined in
+.IR <sys/stat.h> ,
+into which information is placed concerning the file.
+.P
+For all other file types defined in this volume of POSIX.1\(hy2017, the structure members
+.IR st_mode ,
+.IR st_ino ,
+.IR st_dev ,
+.IR st_uid ,
+.IR st_gid ,
+.IR st_atim ,
+.IR st_ctim ,
+and
+.IR st_mtim
+shall have meaningful values and the value of the
+.IR st_nlink
+member shall be set to the number of links to the file.
+.P
+An implementation that provides additional or alternative file access
+control mechanisms may, under implementation-defined conditions,
+cause
+\fIfstat\fR()
+to fail.
+.P
+The
+\fIfstat\fR()
+function shall update any time-related fields (as described in the Base Definitions volume of POSIX.1\(hy2017,
+.IR "Section 4.9" ", " "File Times Update"),
+before writing into the
+.BR stat
+structure.
+.SH "RETURN VALUE"
+Upon successful completion, 0 shall be returned. Otherwise, \-1 shall be
+returned and
+.IR errno
+set to indicate the error.
+.SH ERRORS
+The
+\fIfstat\fR()
+function shall fail if:
+.TP
+.BR EBADF
+The
+.IR fildes
+argument is not a valid file descriptor.
+.TP
+.BR EIO
+An I/O error occurred while reading from the file system.
+.TP
+.BR EOVERFLOW
+The file size in bytes or the number of blocks allocated to the file or
+the file serial number cannot be represented correctly in the structure
+pointed to by
+.IR buf .
+.P
+The
+\fIfstat\fR()
+function may fail if:
+.TP
+.BR EOVERFLOW
+One of the values is too large to store into the structure pointed to
+by the
+.IR buf
+argument.
+.LP
+.IR "The following sections are informative."
+.SH EXAMPLES
+.SS "Obtaining File Status Information "
+.P
+The following example shows how to obtain file status information for a
+file named
+.BR /home/cnd/mod1 .
+The structure variable
+.IR buffer
+is defined for the
+.BR stat
+structure. The
+.BR /home/cnd/mod1
+file is opened with read/write privileges and is passed to the open
+file descriptor
+.IR fildes .
+.sp
+.RS 4
+.nf
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+.P
+struct stat buffer;
+int status;
+\&...
+fildes = open("/home/cnd/mod1", O_RDWR);
+status = fstat(fildes, &buffer);
+.fi
+.P
+.RE
+.SH "APPLICATION USAGE"
+None.
+.SH RATIONALE
+None.
+.SH "FUTURE DIRECTIONS"
+None.
+.SH "SEE ALSO"
+.IR "\fIfstatat\fR\^(\|)"
+.P
+The Base Definitions volume of POSIX.1\(hy2017,
+.IR "Section 4.9" ", " "File Times Update",
+.IR "\fB<sys_stat.h>\fP",
+.IR "\fB<sys_types.h>\fP"
+.\"
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1-2017, Standard for Information Technology
+-- Portable Operating System Interface (POSIX), The Open Group Base
+Specifications Issue 7, 2018 Edition,
+Copyright (C) 2018 by the Institute of
+Electrical and Electronics Engineers, Inc and The Open Group.
+In the event of any discrepancy between this version and the original IEEE and
+The Open Group Standard, the original IEEE and The Open Group Standard
+is the referee document. The original Standard can be obtained online at
+http://www.opengroup.org/unix/online.html .
+.PP
+Any typographical or formatting errors that appear
+in this page are most likely
+to have been introduced during the conversion of the source files to
+man page format. To report such errors, see
+https://www.kernel.org/doc/man-pages/reporting_bugs.html .