/usr/include/udport/udqueue_err.h is in libxgks-dev 2.6.1-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 | /*
* $Id: udqueue_err.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 <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 {
Udfifo fifo; /* single-threaded, non-suspending
* FIFO */
pthread_mutex_t mutex; /* to manage FIFO access */
pthread_cond_t cond; /* to manage waits */
int mutex_created; /* mutex created? */
int cond_created; /* condition variable created? */
int getmode; /* wait, nowait */
int putmode; /* wait, nowait, force */
};
typedef struct Udqueue Udqueue;
/*
* Return values:
*/
/* negative */
#define UDQUEUE_ETHREAD (UDFIFO_ENOENT-1) /* thread problem: mutex, */
/* condition variable, etc. */
#define UDQUEUE_ENOENT UDFIFO_ENOENT /* no entry available */
#define UDQUEUE_ENOSPC UDFIFO_ENOSPC /* insufficient space */
#define UDQUEUE_ENOMEM UDFIFO_ENOMEM /* insufficient memory */
#define UDQUEUE_EINVAL UDFIFO_EINVAL /* invalid argument */
/* zero */
#define UDQUEUE_ESUCCESS UDFIFO_ESUCCESS /* success */
/* positive */
#define UDQUEUE_EFORCED UDFIFO_EFORCED /* success, but oldest */
/* element discarded */
/*
* Initialize a queue.
*/
UD_EXTERN_FUNC(
int udqueue_init, (
Udqueue *queue, /* the queue */
size_t eltsize, /* size of an element in bytes */
int numelts, /* maximum number of elements */
int getmode, /* UDQUEUE_WAIT, UDQUEUE_NOWAIT */
int putmode /* UDQUEUE_WAIT, UDQUEUE_NOWAIT,
* UDQUEUE_FORCE */
));
/*
* 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(
int udqueue_destroy, (
Udqueue *queue /* the queue */
));
#endif /* UD_QUEUE_H not defined above */
|