.\" Copyright (c) 1989, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)statfs.2 6.5 (Berkeley) 7/23/91 .\" .\" Modified Sat Jul 24 11:27:31 1993 by Rik Faith (faith@cs.unc.edu) .\" Translated 6 Feb 1998 by Vicente Pastor Gómez .\" Translation revised 26 April 1998 by Juan Piernas .\" .TH STATFS 2 "21 agosto 1997" "Linux 2.0.30" "Manual del Programador de Linux" .SH NOMBRE statfs, fstatfs \- obtiene estadísticas del sistema de ficheros .SH SINOPSIS .B #include .sp .BI "int statfs(const char *" path ", struct statfs *" buf ); .br .BI "int fstatfs(int " fd ", struct statfs *" buf ); .SH DESCRIPCIÓN .B statfs devuelve información de un sistema de ficheros montado. .I path el el camino de cualquier fichero en el sistema de ficheros montado. .I buf es un puntero a una estructura .I statfs definida como sigue: .RS .nf struct statfs { long f_type; /* tipo sistema ficheros (ver bajo) */ long f_bsize; /* tamaño óptimo de bloque de transferencia */ long f_blocks; /* total de bloques de datos en el sistema de ficheros */ long f_bfree; /* bloques libres en el sf */ long f_bavail; /* bloques libres disponibles para no-superusuarios */ long f_files; /* total de nodos de ficheros en el sf */ long f_ffree; /* nodos de ficheros libres en el sf */ fsid_t f_fsid; /* id del sistema de ficheros */ long f_namelen; /* longitud máxima de nombre de ficheros */ long f_spare[6]; /* de sobra, para más tarde */ }; .fi .RE .PP Tipos de sistema de ficheros: .RS .nf linux/affs_fs.h: AFFS_SUPER_MAGIC 0xADFF linux/efs_fs.h: EFS_SUPER_MAGIC 0x00414A53 linux/ext_fs.h: EXT_SUPER_MAGIC 0x137D linux/ext2_fs.h: EXT2_OLD_SUPER_MAGIC 0xEF51 EXT2_SUPER_MAGIC 0xEF53 linux/hpfs_fs.h: HPFS_SUPER_MAGIC 0xF995E849 linux/iso_fs.h: ISOFS_SUPER_MAGIC 0x9660 linux/minix_fs.h: MINIX_SUPER_MAGIC 0x137F /* minix orig.*/ MINIX_SUPER_MAGIC2 0x138F /* minix 30 carac.*/ MINIX2_SUPER_MAGIC 0x2468 /* minix V2 */ MINIX2_SUPER_MAGIC2 0x2478 /* minix V2, nombres 30 carac. */ linux/msdos_fs.h: MSDOS_SUPER_MAGIC 0x4d44 linux/ncp_fs.h: NCP_SUPER_MAGIC 0x564c linux/nfs_fs.h: NFS_SUPER_MAGIC 0x6969 linux/proc_fs.h: PROC_SUPER_MAGIC 0x9fa0 linux/smb_fs.h: SMB_SUPER_MAGIC 0x517B linux/sysv_fs.h: XENIX_SUPER_MAGIC 0x012FF7B4 SYSV4_SUPER_MAGIC 0x012FF7B5 SYSV2_SUPER_MAGIC 0x012FF7B6 COH_SUPER_MAGIC 0x012FF7B7 linux/ufs_fs.h: UFS_MAGIC 0x00011954 linux/xfs_fs.h: XFS_SUPER_MAGIC 0x58465342 linux/xia_fs.h: _XIAFS_SUPER_MAGIC 0x012FD16D .fi .RE .PP Nadie sabe lo que .I f_fsid se supone que contiene (vea más abajo). .PP Los campos no definidos para un sistema de ficheros particular se ponen a 0. .B fstatfs devuelve la misma información sobre un fichero abierto referenciado por el descriptor .IR fd . .SH "VALOR DEVUELTO" Si hubo éxito se devuelve cero. Si hubo error, se devuelve \-1, y .I errno es actualizado apropiadamente. .SH ERRORES Para .BR statfs : .TP .B ENOTDIR Un componente del camino .I path no es un directorio. .TP .B ENAMETOOLONG .I path es demasiado largo. .TP .B ENOENT El fichero al que se refiere .I path no existe. .TP .B EACCES El permiso de búsqueda se deniega para un componente del camino .IR path . .TP .B ELOOP Se encontraron demasiados enlaces simbólicos al traducir .IR path . .TP .B EFAULT .I buf o .I path apuntan a una dirección inválida. .TP .B EIO Ocurrió un error de E/S mientras se leía o escribía en el sistema de ficheros. .TP .B ENOMEM No había suficiente memoria disponible en el núcleo. .TP .B ENOSYS El sistema de ficheros sobre el que se encuentra .I path no soporta .BR statfs . .PP Para .BR fstatfs : .TP .B EBADF .I fd no es un descriptor de fichero válido. .TP .B EFAULT .I buf apunta a una dirección inválida. .TP .B EIO Ocurrió un error de E/S mientras se leía o escribía en el sistema de ficheros. .TP .B ENOSYS El sistema de ficheros sobre el que está abierto .I fd no soporta .BR statfs . .SH "CONFORME A" La versión de Linux de .B statfs está inspirada en la de 4.4BSD (aunque no usan la misma estructura). .SS f_fsid Solaris y POSIX 1003.1-2001 poseen una llamada al sistema .I statvfs que devuelve una estructura .B "statvfs" (definida en .IR "" ) con un campo .IR f_fsid de tipo .B "unsigned long" . Linux, SunOS, HPUX y 4.4BSD poseen una llamada al sistema .I statfs que devuelve una estructura .B "statfs" (definida en .IR "" ) con un campo .IR f_fsid de tipo .B fsid_t , donde .I fsid_t está definido como .BR "struct { int val[2]; }" . Lo mismo se aplica para FreeBSD, salvo que utiliza el fichero de cabecera .IR "" . La idea general es que .I f_fsid contenga información aleatoria de manera que el par .RI ( f_fsid , ino ) determine unívocamente un fichero. Algunos SOs usan (una variante de) el número de dispositivo, o el número de dispositivo combinado con el tipo de sistema de ficheros. Muchos SOs restringen el acceso al campo .I f_fsid solamente al superusuario (poniéndolo a cero para aquellos usuarios sin privilegios), ya que este campo es usado en el manejo de ficheros del sistema de ficheros cuando es exportado mediante NFS, y conceder acceso a él es un problema de seguridad. .LP En algunos SOs .I fsid puede ser usado como segundo parámetro en la llamada al sistema .I sysfs(). .SH "VÉASE TAMBIÉN" .BR stat (2)