diff options
Diffstat (limited to 'usr/src/man/man2/stat.2')
-rw-r--r-- | usr/src/man/man2/stat.2 | 91 |
1 files changed, 13 insertions, 78 deletions
diff --git a/usr/src/man/man2/stat.2 b/usr/src/man/man2/stat.2 index df24fda9dc..ff1db97318 100644 --- a/usr/src/man/man2/stat.2 +++ b/usr/src/man/man2/stat.2 @@ -4,7 +4,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH stat 2 "10 Oct 2007" "SunOS 5.11" "System Calls" +.TH STAT 2 "Oct 10, 2007" .SH NAME stat, lstat, fstat, fstatat \- get file status .SH SYNOPSIS @@ -108,12 +108,10 @@ char st_fstype[_ST_FSTYPSZ]; Descriptions of structure members are as follows: .sp .ne 2 -.mk .na \fB\fBst_mode\fR\fR .ad .RS 14n -.rt The mode of the file as described for the \fBmknod()\fR function. In addition to the modes described on the \fBmknod\fR(2) manual page, the mode of a file can also be \fBS_IFSOCK\fR if the file is a socket, \fBS_IFDOOR\fR if the file @@ -124,24 +122,20 @@ or by \fBfstat()\fR when the \fBAT_SYMLINK_NOFOLLOW\fR flag is set. .sp .ne 2 -.mk .na \fB\fBst_ino\fR\fR .ad .RS 14n -.rt This field uniquely identifies the file in a given file system. The pair \fBst_ino\fR and \fBst_dev\fR uniquely identifies regular files. .RE .sp .ne 2 -.mk .na \fB\fBst_dev\fR\fR .ad .RS 14n -.rt This field uniquely identifies the file system that contains the file. Its value may be used as input to the \fBustat()\fR function to determine more information about this file system. No other meaning is associated with this @@ -150,12 +144,10 @@ value. .sp .ne 2 -.mk .na \fB\fBst_rdev\fR\fR .ad .RS 14n -.rt This field should be used only by administrative commands. It is valid only for block special or character special files and only has meaning on the system where the file was configured. @@ -163,57 +155,47 @@ where the file was configured. .sp .ne 2 -.mk .na \fB\fBst_nlink\fR\fR .ad .RS 14n -.rt This field should be used only by administrative commands. .RE .sp .ne 2 -.mk .na \fB\fBst_uid\fR\fR .ad .RS 14n -.rt The user \fBID\fR of the file's owner. .RE .sp .ne 2 -.mk .na \fB\fBst_gid\fR\fR .ad .RS 14n -.rt The group \fBID\fR of the file's group. .RE .sp .ne 2 -.mk .na \fB\fBst_size\fR\fR .ad .RS 14n -.rt For regular files, this is the address of the end of the file. For block special or character special, this is not defined. See also \fBpipe\fR(2). .RE .sp .ne 2 -.mk .na \fB\fBst_atime\fR\fR .ad .RS 14n -.rt Time when file data was last accessed. Some of the functions that change this member are: \fBcreat()\fR, \fBmknod()\fR, \fBpipe()\fR, \fButime\fR(2), and \fBread\fR(2). @@ -221,12 +203,10 @@ member are: \fBcreat()\fR, \fBmknod()\fR, \fBpipe()\fR, \fButime\fR(2), and .sp .ne 2 -.mk .na \fB\fBst_mtime\fR\fR .ad .RS 14n -.rt Time when data was last modified. Some of the functions that change this member are: \fBcreat()\fR, \fBmknod()\fR, \fBpipe()\fR, \fButime()\fR, and \fBwrite\fR(2). @@ -234,12 +214,10 @@ are: \fBcreat()\fR, \fBmknod()\fR, \fBpipe()\fR, \fButime()\fR, and .sp .ne 2 -.mk .na \fB\fBst_ctime\fR\fR .ad .RS 14n -.rt Time when file status was last changed. Some of the functions that change this member are: \fBchmod\fR(2), \fBchown\fR(2), \fBcreat\fR(2), \fBlink\fR(2), \fBmknod\fR(2), \fBpipe\fR(2), \fBrename\fR(2), \fBunlink\fR(2), @@ -248,36 +226,30 @@ member are: \fBchmod\fR(2), \fBchown\fR(2), \fBcreat\fR(2), \fBlink\fR(2), .sp .ne 2 -.mk .na \fB\fBst_blksize\fR\fR .ad .RS 14n -.rt A hint as to the "best" unit size for I/O operations. This field is not defined for block special or character special files. .RE .sp .ne 2 -.mk .na \fB\fBst_blocks\fR\fR .ad .RS 14n -.rt The total number of physical blocks of size 512 bytes actually allocated on disk. This field is not defined for block special or character special files. .RE .sp .ne 2 -.mk .na \fB\fBst_fstype\fR\fR .ad .RS 14n -.rt A null-teminated string that uniquely identifies the type of the filesystem that contains the file. .RE @@ -294,23 +266,19 @@ The \fBstat()\fR, \fBfstat()\fR, \fBlstat()\fR, and \fBfstatat()\fR functions will fail if: .sp .ne 2 -.mk .na \fB\fBEIO\fR\fR .ad .RS 13n -.rt An error occurred while reading from the file system. .RE .sp .ne 2 -.mk .na \fB\fBEOVERFLOW\fR\fR .ad .RS 13n -.rt 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 \fIbuf\fR. @@ -321,58 +289,48 @@ by \fIbuf\fR. The \fBstat()\fR, \fBlstat()\fR, and \fBfstatat()\fR functions will fail if: .sp .ne 2 -.mk .na \fB\fBEACCES\fR\fR .ad .RS 16n -.rt Search permission is denied for a component of the path prefix. .RE .sp .ne 2 -.mk .na \fB\fBEFAULT\fR\fR .ad .RS 16n -.rt The \fIbuf\fR or \fIpath\fR argument points to an illegal address. .RE .sp .ne 2 -.mk .na \fB\fBEINTR\fR\fR .ad .RS 16n -.rt A signal was caught during the execution of the \fBstat()\fR or \fBlstat()\fR function. .RE .sp .ne 2 -.mk .na \fB\fBELOOP\fR\fR .ad .RS 16n -.rt A loop exists in symbolic links encountered during the resolution of the \fIpath\fR argument. .RE .sp .ne 2 -.mk .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n -.rt The length of the \fIpath\fR argument exceeds {\fBPATH_MAX\fR}, or the length of a \fIpath\fR component exceeds {\fBNAME_MAX\fR} while \fB_POSIX_NO_TRUNC\fR is in effect. @@ -380,36 +338,30 @@ is in effect. .sp .ne 2 -.mk .na \fB\fBENOENT\fR\fR .ad .RS 16n -.rt A component of \fIpath\fR does not name an existing file or \fIpath\fR is an empty string. .RE .sp .ne 2 -.mk .na \fB\fBENOLINK\fR\fR .ad .RS 16n -.rt The \fIpath\fR argument points to a remote machine and the link to that machine is no longer active. .RE .sp .ne 2 -.mk .na \fB\fBENOTDIR\fR\fR .ad .RS 16n -.rt A component of the path prefix is not a directory, or the \fIfildes\fR argument does not refer to a valid directory when given a non-null relative path. .RE @@ -419,46 +371,38 @@ does not refer to a valid directory when given a non-null relative path. The \fBfstat()\fR and \fBfstatat()\fR functions will fail if: .sp .ne 2 -.mk .na \fB\fBEBADF\fR\fR .ad .RS 11n -.rt The \fIfildes\fR argument is not a valid open file descriptor. The \fIfildes\fR argument to \fBfstatat()\fR can also have the valid value of \fBAT_FDCWD\fR. .RE .sp .ne 2 -.mk .na \fB\fBEFAULT\fR\fR .ad .RS 11n -.rt The \fIbuf\fR argument points to an illegal address. .RE .sp .ne 2 -.mk .na \fB\fBEINTR\fR\fR .ad .RS 11n -.rt A signal was caught during the execution of the \fBfstat()\fR function. .RE .sp .ne 2 -.mk .na \fB\fBENOLINK\fR\fR .ad .RS 11n -.rt The \fIfildes\fR argument points to a remote machine and the link to that machine is no longer active. .RE @@ -468,12 +412,10 @@ machine is no longer active. The \fBstat()\fR, \fBfstat()\fR, and \fBlstat()\fR functions may fail if: .sp .ne 2 -.mk .na \fB\fBEOVERFLOW\fR\fR .ad .RS 13n -.rt One of the members is too large to store in the \fBstat\fR structure pointed to by \fIbuf\fR. .RE @@ -483,24 +425,20 @@ by \fIbuf\fR. The \fBstat()\fR and \fBlstat()\fR functions may fail if: .sp .ne 2 -.mk .na \fB\fBELOOP\fR\fR .ad .RS 16n -.rt More than {\fBSYMLOOP_MAX\fR} symbolic links were encountered during the resolution of the \fIpath\fR argument. .RE .sp .ne 2 -.mk .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n -.rt As a result of encountering a symbolic link in resolution of the\fIpath\fR argument, the length of the substituted pathname strings exceeds {\fBPATH_MAX\fR}. @@ -511,12 +449,10 @@ argument, the length of the substituted pathname strings exceeds The \fBstat()\fR and \fBfstatat()\fR functions may fail if: .sp .ne 2 -.mk .na \fB\fBENXIO\fR\fR .ad .RS 9n -.rt The \fIpath\fR argument names a character or block device special file and the corresponding I/O device has been retired by the fault management framework. .RE @@ -578,17 +514,17 @@ while ((dp = readdir(dir)) != NULL) { /* Get entry's information. */ if (stat(dp->d_name, &statbuf) == -1) continue; - + /* Print out type, permissions, and number of links. */ printf("%10.10s", sperm (statbuf.st_mode)); printf("%4d", statbuf.st_nlink); - + /* Print out owners name if it is found using getpwuid(). */ if ((pwd = getpwuid(statbuf.st_uid)) != NULL) printf(" %-8.8s", pwd->pw_name); else printf(" %-8d", statbuf.st_uid); - + /* Print out group name if it's found using getgrgid(). */ if ((grp = getgrgid(statbuf.st_gid)) != NULL) printf(" %-8.8s", grp->gr_name); @@ -598,10 +534,10 @@ while ((dp = readdir(dir)) != NULL) { /* Print size of file. */ printf(" %9jd", (intmax_t)statbuf.st_size); tm = localtime(&statbuf.st_mtime); - + /* Get localized date string. */ strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm); - + printf(" %s %s\en", datestring, dp->d_name); } .fi @@ -674,17 +610,16 @@ See \fBattributes\fR(5) for descriptions of the following attributes: .sp .TS -tab() box; -cw(2.75i) |cw(2.75i) -lw(2.75i) |lw(2.75i) -. -ATTRIBUTE TYPEATTRIBUTE VALUE +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE _ -Interface StabilityCommitted +Interface Stability Committed _ -MT-LevelAsync-Signal-Safe +MT-Level Async-Signal-Safe _ -Standard See below. +Standard See below. .TE .sp |