#include <sys/statvfs.h> int QlgStatvfs64(Qlg_Path_Name_T *path, struct statvfs64 *bufService Program Name: QP0LLIB1
The QlgStatvfs64() function, like the statvfs64() function, gets status information about the file system that contains the file named by the path argument. The difference is that the QlgStatvfs64() function takes a pointer to a Qlg_Path_Name_T structure, while statvfs64() takes a pointer to a character string.
Limited information on the path parameter is provided here. For more information on the path parameter and for a discussion of other parameters, authorities required, return values, and related information, see statvfs()--Get File System Information.
See Code disclaimer information for information pertaining to code examples.
The following example gets information about a file system.
#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, 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 == (QlgStatvfs64((Qlg_Path_Name_T *)&path, (struct statvfs64 *)&info))) { perror("QlgStatvfs64() error"); } else { puts("QlgStatvfs64() returned the following information"); puts("about the Root ('/') file system:"); printf(" f_bsize : %u\n", info.f_bsize); printf(" f_blocks : %llu\n", info.f_blocks); printf(" f_bfree : %llu\n", info.f_bfree); 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); } }
Top | UNIX-Type APIs | APIs by category |