pike.git / src / modules / _Stdio / efuns.c

version» Context lines:

pike.git/src/modules/_Stdio/efuns.c:545:    *! Number of free files in the filesystem.    *! @member int "favail"    *! Number of available files in the filesystem.    *! This is usually the same as the @expr{"ffree"@} value, and can    *! usually be adjusted with eg tunefs(1M).    *! @member string "fsname"    *! Name assigned to the filesystem. This item is not available    *! on all systems.    *! @member string "fstype"    *! Type of filesystem (eg @expr{"nfs"@}). This item is not -  *! available on all systems. +  *! available on all systems. For some more uncommon filesystems +  *! this may be an integer representing the magic number for the +  *! filesystem type (cf @tt{statfs(2)@} on eg Linux systems).    *! @endmapping    *!    *! @note    *! Please note that not all members are present on all OSs.    *!    *! @seealso    *! @[file_stat()]    */   #ifdef __NT__   
pike.git/src/modules/_Stdio/efuns.c:607: Inside #if defined(__NT__)
   push_int(total_sectors);    push_static_text("bfree");    push_int(free_sectors);    push_static_text("bavail");    push_int(free_sectors);    f_aggregate_mapping( 8 );   }      #else /* !__NT__ */    - #if !defined(HAVE_STRUCT_STATFS) && !defined(HAVE_STRUCT_FS_DATA) + #if !defined(HAVE_STRUCT_STATFS) && !defined(HAVE_STRUCT_FS_DATA)   #undef HAVE_STATFS   #endif    -  + #if defined(HAVE_STATFS) && defined(HAVE_STATVFS) && !defined(HAVE_STATVFS_F_BASETYPE) + /* Linux libc doesn't provide fs type info in statvfs(2), +  * so use statfs(2) instead. +  */ + #undef HAVE_STATVFS + #endif +    #if defined(HAVE_STATVFS) || defined(HAVE_STATFS) || defined(HAVE_USTAT)   #ifdef HAVE_SYS_STATVFS_H   /* Kludge for broken SCO headerfiles */   #ifdef _SVID3   #include <sys/statvfs.h>   #else   #define _SVID3   #include <sys/statvfs.h>   #undef _SVID3   #endif /* _SVID3 */   #endif /* HAVE_SYS_STATVFS_H */   #ifdef HAVE_SYS_VFS_H   #include <sys/vfs.h>   #endif /* HAVE_SYS_VFS_H */   #ifdef HAVE_SYS_STATFS_H   #include <sys/statfs.h> -  + #ifdef HAVE_LINUX_MAGIC_H + #include <linux/magic.h> + #endif /* HAVE_LINUX_MAGIC_H */   #endif /* HAVE_SYS_STATFS_H */   #ifdef HAVE_SYS_PARAM_H   #include <sys/param.h>   #endif /* HAVE_SYS_PARAM_H */   #ifdef HAVE_SYS_MOUNT_H   #include <sys/mount.h>   #endif /* HAVE_SYS_MOUNT_H */   #if !defined(HAVE_STATVFS) && !defined(HAVE_STATFS)   #ifdef HAVE_USTAT_H   #include <ustat.h>
pike.git/src/modules/_Stdio/efuns.c:748: Inside #if defined(HAVE_STATFS) and #if defined(HAVE_STRUCT_STATFS)
   push_static_text("blocks"); push_int(st.f_blocks);    push_static_text("bfree"); push_int(st.f_bfree);    push_static_text("files"); push_int(st.f_files);    push_static_text("ffree"); push_int(st.f_ffree);    push_static_text("favail"); push_int(st.f_ffree);    num_fields += 6;   #ifdef HAVE_STATFS_F_BAVAIL    push_static_text("bavail"); push_int(st.f_bavail);    num_fields++;   #endif /* HAVE_STATFS_F_BAVAIL */ +  push_static_text("fstype"); +  switch(st.f_type) { +  case BTRFS_SUPER_MAGIC: push_static_text("btrfs"); break; +  case EXT2_SUPER_MAGIC: push_static_text("ext"); break; +  case ISOFS_SUPER_MAGIC: push_static_text("isofs"); break; +  case JFFS2_SUPER_MAGIC: push_static_text("jffs2"); break; +  case MSDOS_SUPER_MAGIC: push_static_text("msdos"); break; +  case NFS_SUPER_MAGIC: push_static_text("nfs"); break; + #ifndef NTFS_SB_MAGIC + #define NTFS_SB_MAGIC 0x5346544e + #endif +  case NTFS_SB_MAGIC: push_static_text("ntfs"); break; +  case PROC_SUPER_MAGIC: push_static_text("procfs"); break; +  case RAMFS_MAGIC: push_static_text("ramfs"); break; +  case REISERFS_SUPER_MAGIC: push_static_text("reiserfs"); break; +  case SMB_SUPER_MAGIC: push_static_text("smb"); break; +  case SYSFS_MAGIC: push_static_text("sysfs"); break; +  case TMPFS_MAGIC: push_static_text("tmpfs"); break; +  case XENFS_SUPER_MAGIC: push_static_text("xenfs"); break; +  default: +  push_int(st.f_type); +  break; +  } +  num_fields++;   #else /* !HAVE_STRUCT_STATFS */   #ifdef HAVE_STRUCT_FS_DATA    /* ULTRIX */    push_static_text("blocksize"); push_int(st.fd_bsize);    push_static_text("blocks"); push_int(st.fd_btot);    push_static_text("bfree"); push_int(st.fd_bfree);    push_static_text("bavail"); push_int(st.fd_bfreen);    num_fields += 4;   #else /* !HAVE_STRUCT_FS_DATA */   #error No struct to hold statfs() data.