/usr/include/udport/udqueue.h is in libxgks-dev 2.6.1+dfsg.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | /*
* $Id: udqueue.h,v 1.1 2000/08/07 23:15:04 emmerson Exp $
*/
#ifndef UD_QUEUE_H
#define UD_QUEUE_H
#include "udposix.h"
#include <stddef.h>
#include <uthread.h>
#include "udfifo.h"
/*
* Access modes:
*/
#define UDQUEUE_WAIT 0 /* wait until action possible */
#define UDQUEUE_NOWAIT 1 /* error return if action not immediately */
/* possible */
#define UDQUEUE_FORCE 2 /* discard oldest if necessary */
/*
* Queue data structure. WARNING: Private definition: don't depend on the
* details of this structure!
*/
struct Udqueue {
const char* cookie; /* valid-structure cookie */
Udfifo fifo; /* single-threaded, non-suspending
* FIFO */
uthread_mutex_t mutex; /* to manage FIFO access */
uthread_cond_t cond; /* to manage waits */
int mutex_created; /* mutex created? */
int cond_created; /* condition variable created? */
volatile int getmode; /* wait, nowait */
volatile int putmode; /* wait, nowait, force */
int status; /* status of queue */
};
typedef struct Udqueue Udqueue;
/*
* Return values:
*/
#define UDQUEUE_EFAILURE UDFIFO_EFAILURE /* -1 */
#define UDQUEUE_ESUCCESS UDFIFO_ESUCCESS /* 0 */
#define UDQUEUE_EFORCED UDFIFO_EFORCED /* 1 (success, but oldest */
/* element discarded) */
#define UDQUEUE_EEND 2 /* end of queue */
/*
* Initialize a queue.
*/
UD_EXTERN_FUNC(
void udqueue_init, (
Udqueue *queue, /* the queue */
size_t eltsize, /* size of an element in bytes */
int numelts /* maximum number of elements */
));
/*
* Set the mode putting into a queue.
*/
UD_EXTERN_FUNC(
int udqueue_setputmode, (
Udqueue *queue, /* the queue */
int mode /* UDQUEUE_WAIT, UDQUEUE_NOWAIT,
* UDQUEUE_FORCE */
));
/*
* Set the mode for getting from a queue.
*/
UD_EXTERN_FUNC(
int udqueue_setgetmode, (
Udqueue *queue, /* the queue */
int mode /* UDQUEUE_WAIT, UDQUEUE_NOWAIT */
));
/*
* Add to a queue.
*/
UD_EXTERN_FUNC(
int udqueue_put, (
Udqueue *queue, /* the queue */
const void *new, /* the element to add */
void *old /* (putmode == UDQUEUE_FORCE && old != NULL) =>
* discarded, oldest element */
));
/*
* Remove from a queue.
*/
UD_EXTERN_FUNC(
int udqueue_get, ( /* UDQUEUE_SUCCESS or UDQUEUE_FAILURE */
Udqueue *queue, /* the queue */
void *old /* old != NULL => the oldest element */
));
/*
* Return the number of elements in a queue.
*/
UD_EXTERN_FUNC(
int udqueue_count, (
Udqueue *queue /* the queue */
));
/*
* Return the number of empty spaces in a queue in terms of elements.
*/
UD_EXTERN_FUNC(
int udqueue_space, (
Udqueue *queue /* the queue */
));
/*
* Destroy a queue.
*/
UD_EXTERN_FUNC(
void udqueue_destroy, (
Udqueue *queue /* the queue */
));
#endif /* UD_QUEUE_H not defined above */
|