performance/fifoclient.c

///////////////////////////////////////////////////////////////////////////////
// Filename: fifoclient.c
///////////////////////////////////////////////////////////////////////////////
// Purpose: measures performance of fifos (together with fifoserver.c)
///////////////////////////////////////////////////////////////////////////////
// History:
// ========
//
// Date     Time     Name      Description   
// -------- -------- --------  ------------------------------------------------
// 96/02/29 06:42:57 muellerg: created
//
///////////////////////////////////////////////////////////////////////////////


// Feature test switches ///////////////////////////// Feature test switches //
    /* NONE */



// System headers /////////////////////////////////////////// System headers //

#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>


// Local headers ///////////////////////////////////////////// Local headers //

#include "../common.h"



// Macros /////////////////////////////////////////////////////////// Macros //
    /* NONE */



// File scope objects /////////////////////////////////// File scope objects //

const char *fifo_file="example_fifo";



// External variables, functions, and classes ///////////// External objects //
    /* NONE */



// Signal catching functions ///////////////////// Signal catching functions //
    /* NONE */



// Structures, unions, and class definitions /////////////////// Definitions //
    /* NONE */



// Functions and class implementation /// Functions and class implementation //
    /* NONE */



// Main /////////////////////////////////////////////////////////////// Main //


int 
main(int argc, char *argv[])
{
    error.set_program_name(argv[0]);    

    int fd = open(fifo_file, O_WRONLY);
    if(fd)
    {
        // tell server that we are there
        write(fd, "GO", 2);

        // do measurements
        writedata(argv[0], "write", fd, 0); // we don't know servers pid
    }
    else
        error.system("can't open fifo");

    return(EXIT_SUCCESS);
}