8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / auditd / queue.h
blobdd0d6a82f672036c51cc97fa73599783909f7ab9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 #ifndef _QUEUE_H
28 #define _QUEUE_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include <pthread.h>
35 #include <stddef.h>
37 typedef struct aln audit_link_t;
38 struct aln {
39 audit_link_t *aln_next;
42 /* one audit_rec_t per audit record */
44 typedef struct abq audit_rec_t;
45 struct abq {
46 audit_link_t abq_l;
47 int abq_ref_count;
48 size_t abq_buf_len; /* space allocated */
49 size_t abq_data_len; /* space used */
50 char abq_buffer[1]; /* variable length */
52 #define AUDIT_REC_HEADER offsetof(audit_rec_t, abq_buffer[0])
54 /* one audit_q_t entry per audit record per plugin */
56 typedef struct aqq audit_q_t; /* plugin queued data */
57 struct aqq {
58 audit_link_t aqq_l;
59 audit_rec_t *aqq_data;
60 uint64_t aqq_sequence;
63 /* queue head */
65 typedef struct auq au_queue_t;
67 struct auq {
68 void *auq_head;
69 void *auq_tail;
70 int auq_count;
71 pthread_mutex_t auq_lock;
74 int audit_dequeue(au_queue_t *, void **);
75 void audit_queue_destroy(au_queue_t *);
76 void audit_enqueue(au_queue_t *, void *);
77 int audit_queue_size(au_queue_t *);
78 void audit_queue_init(au_queue_t *);
79 audit_rec_t *audit_release(pthread_mutex_t *, audit_rec_t *);
80 void audit_incr_ref(pthread_mutex_t *, audit_rec_t *);
82 #ifdef __cplusplus
84 #endif
86 #endif /* _QUEUE_H */