Random IO Access for multi-user - Unix

This is a discussion on Random IO Access for multi-user - Unix ; Hi All Below coding for generate a file. Do you know how to write a code for random a a file for multi-user access ? We want testing FileSystem IO performance. #include #include #include #define FAIL -1 #define BSIZE 8192 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Random IO Access for multi-user

  1. Random IO Access for multi-user

    Hi All

    Below coding for generate a file. Do you know how to write a code for
    random a a file for multi-user access ?

    We want testing FileSystem IO performance.

    #include
    #include
    #include

    #define FAIL -1
    #define BSIZE 8192
    #define FSIZE 5000

    int writeit(int);
    int main(void)
    {
    if ( -1 == writeit(FSIZE)) printf("FILE OPERATION FAILED\n");

    }

    int writeit(int blocks)
    {
    char buf[BSIZE];
    int fdes;
    int i;
    int written;
    if ( (fdes = open("./testfile.bm",O_WRONLY|O_CREAT,0777)) < 0)
    return FAIL;
    for (i=0;i< blocks ; i++)
    {
    if (written = write(fdes,buf,BSIZE) != BSIZE) return FAIL;
    }
    return 0;

  2. Re: Random IO Access for multi-user

    moonhkt writes:
    >Hi All
    >
    >Below coding for generate a file. Do you know how to write a code for
    >random a a file for multi-user access ?
    >


    man pread
    man pwrite
    man lseek

    scott

+ Reply to Thread