Salesforce

C Program to Determine Your File System Block Size

« Go Back

Information

 
TitleC Program to Determine Your File System Block Size
URL Name18292
Article Number000172476
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: Unix
Question/Problem Description
Sample C program which can be used to determine file system block 
size.
How to find the Operating System blocksize using a C program?

Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
On some UNIX Operating Systems, it can be difficult to determine the 
file system block size once it has been created.
On HP-UX you can get this information by the simple command:

  df -g <mount point of file system>

Example:  df -g /usr   

If you cannot find any OS manual references on how to get the block 
size, try the C program below. 1) Use your editor to write and save 
fssize.c.
2) Compile with  "cc fssize.c -o fssize" OR "make fssize".

    /*            fssize.c             */

    #include <sys/types.h>
    #include <sys/stat.h>
    #include <errno.h>
 
    main(argc, argv)
    int argc;
    char *argv[];

    {
    int             ret;
    struct stat     bur;

       if (argc == 1)
       {
           ret = stat(argv[0], &bur);
       }
       else
       {
           ret = stat(argv[1], &bur);
       }

       if (ret < 0)

       {
           printf("stat failed, errno = %d\n",errno);
           exit();
       }

       printf("File system block size is = %d\n",bur.st_blksize);
   }
3) Run the generated executable fssize to get the file system block 
size.

NOTE: This program is NOT supported.  It has been tested on several 
UNIX systems but may or may not compile and run on your system.  See 
your UNIX manual if the stat() function fails.
Workaround
Notes
Keyword Phrase
Last Modified Date3/24/2015 4:23 PM

Powered by