QlgStatvfs()--Get File System Information (using NLS-enabled path name)


  Syntax
 #include <sys/statvfs.h>

 int QlgStatvfs(Qlg_Path_Name_T *path, struct statvfs *buf);  
  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes for statvfs().

The QlgStatvfs() function, like the statvfs() function, gets status information about the file system that contains the file named by the path argument. The difference is that the QlgStatvfs() function takes a pointer to a Qlg_Path_Name_T structure, while statvfs() takes a pointer to a character string.

Limited information about the path parameter is provided here. For more information about the path parameter and for a discussion of other parameters, authorities required, return values, and related information, see statvfs()--Get File System Information.


Parameters

path
(Input) A pointer to a Qlg_Path_Name_T structure that contains a path name or a pointer to a path name of the file from which file system information is required. For more information about the Qlg_Path_Name_T structure, see Path name format.

Related Information


Example

The following example gets status information about a file system.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <sys/statvfs.h>
#include <stdio.h>
#include <sys/types.h>

main() {

  struct statvfs info;
 #define mypath "/"
  const char US_const[3]= "US";
  const char Language_const[4] ="ENU";
  typedef struct pnstruct
  {
    Qlg_Path_Name_T qlg_struct;
    char pn[100]; /* This array size must be >= the  */
                    /* length of the path name or must */
                    /* be a pointer to the path name.  */
  };
  struct pnstruct path;

   /***************************************************************/
   /*   Initialize Qlg_Path_Name_T parameters                     */
   /***************************************************************/
  memset((void*)path name, 0x00, sizeof(struct pnstruct));
  path.qlg_struct.CCSID = 37;
  memcpy(path.qlg_struct.Country_ID,US_const,2);
  memcpy(path.qlg_struct.Language_ID,Language_const,3);
  path.qlg_struct.Path_Type = QLG_CHAR_SINGLE;
  path.qlg_struct.Path_Length = sizeof(mypath)-1;
  path.qlg_struct.Path_Name_Delimiter[0] = '/';
  memcpy(path.pn,mypath,sizeof(mypath)-1);

  if (-1 == QlgStatvfs((Qlg_Path_Name_T *)path name, &info))
    perror("QlgStatvfs() error");
  else {
    puts("QlgStatvfs() returned the following information");
    puts("about the Root ('/') file system:");
    printf("  f_bsize    : %u\n", info.f_bsize);
    printf("  f_blocks   : %08X%08X\n",
                           *((int *)&info.f_blocks[0]),
                           *((int *)&info.f_blocks[4]));
    printf("  f_bfree    : %08X%08X\n",
                           *((int *)&info.f_bfree[0]),
                           *((int *)&info.f_bfree[4]));
    printf("  f_files    : %u\n", info.f_files);
    printf("  f_ffree    : %u\n", info.f_ffree);
    printf("  f_fsid     : %u\n", info.f_fsid);
    printf("  f_flag     : %X\n", info.f_flag);
    printf("  f_namemax  : %u\n", info.f_namemax);
    printf("  f_pathmax  : %u\n", info.f_pathmax);
    printf("  f_basetype : %s\n", info.f_basetype);
  }
}

Output: The following information will vary from file system to file system.

QlgStatvfs() returned the following information
about the Root ('/') file system:
  f_bsize    : 4096
  f_blocks   : 00000000002BF800
  f_bfree    : 0000000000091703
  f_files    : 4294967295
  f_ffree    : 4294967295
  f_fsid     : 0
  f_flag     : 1A
  f_namemax  : 255
  f_pathmax  : 4294967295
  f_basetype : "root" (/)

API introduced: V5R1

[ Back to top | UNIX-Type APIs | APIs by category ]