"Fossies" - the Fresh Open Source Software Archive

Member "FunctionCheck-3.2.0/src/share/fc_fifo.h" (26 May 2012, 2821 Bytes) of package /linux/privat/old/FunctionCheck-3.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * FunctionCheck profiler
    3  * (C) Copyright 2000-2012 Yannick Perret
    4  *
    5  *  This program is free software; you can redistribute it and/or
    6  *  modify it under the terms of the GNU General Public License as
    7  *  published by the Free Software Foundation; either version 2 of the
    8  *  License, or (at your option) any later version.
    9  *
   10  *  This program is distributed in the hope that it will be useful,
   11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13  *  General Public License for more details.
   14  *
   15  *  You should have received a copy of the GNU General Public License
   16  *  along with this program; if not, write to the Free Software
   17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   18  */
   19 
   20 #ifndef __fc_fifo_h_
   21 #define __fc_fifo_h_
   22 
   23 #include <stdio.h>
   24 #include <stdlib.h>
   25 
   26 /* the FIFO type */
   27 #define FC_FIFO void volatile *
   28 #define FC_FIFO_NDEF NULL
   29 
   30 /* create a new FIFO. returns the FIFO or 'FC_FIFO_NDEF' on error
   31    'esize' is the size of each element in buffer, and 'id' is set to
   32    the ID of the shared buffer, for connections. 'single' is TRUE
   33    if the FIFO will be used with only one writer, and FALSE if
   34    many writers can access the FIFO (with fc_fifo_write) */
   35 FC_FIFO fc_fifo_create(unsigned int elements, unsigned int esize, unsigned int *id, unsigned int single);
   36 
   37 /* connect to an existing FIFO. returns the FIFO or FC_FIFO_NDEF.
   38    the 'id' is the ID given by 'fc_fifo_create' */
   39 FC_FIFO fc_fifo_connect(unsigned int id);
   40 
   41 /* deconnect the given FIFO. once done, no more access to the FIFO
   42    is possible.
   43    delete flag if shm has no more reference. */
   44 int fc_fifo_close(FC_FIFO fifo, unsigned int shmid, unsigned int delete);
   45 
   46 /* return pointer to data available in FIFO */
   47 void* fc_fifo_read_single(FC_FIFO fifo, unsigned int size, unsigned int ID);
   48 
   49 /* marked data returned by fc_fifo_read_single() as done */
   50 void fc_fifo_read_single_done(FC_FIFO fifo, unsigned int ID);
   51 
   52 /* return pointer to data space available in FIFO */
   53 void* fc_fifo_write_single(FC_FIFO fifo, unsigned int size, unsigned int ID);
   54 
   55 /* marked data returned by fc_fifo_write_single() as done */
   56 void fc_fifo_write_single_done(FC_FIFO fifo, unsigned int ID);
   57 
   58 /* read FC_INIT embedded in FC_FIFO structure */
   59 int fc_fifo_read_init(FC_FIFO fifo, void* init, unsigned int size, unsigned int ID);
   60 
   61 /* write FC_INIT embedded in FC_FIFO structure */
   62 int fc_fifo_write_init(FC_FIFO fifo, void* init, unsigned int size, unsigned int ID);
   63 
   64 /* read FC_LDYN embedded in FC_FIFO structure */
   65 int fc_fifo_read_ldyn(FC_FIFO fifo, void* ldyn, unsigned int size, unsigned int ID);
   66 
   67 /* write FC_LDYN embedded in FC_FIFO structure */
   68 int fc_fifo_write_ldyn(FC_FIFO fifo, void* ldyn, unsigned int size, unsigned int ID);
   69 
   70 #endif /* __fc_fifo_h_ */