| 1 | #cxx . . $ `<file>/src/OVAL/probes/SEAP/seap-packetq.c`/include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 2 | #include <stdbool.h> |
| 3 | #include <pthread.h> |
| 4 | #include <errno.h> |
| 5 | #include "_seap-packet.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap-packet.h`/ |
| 6 | #include "_seap-packetq.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap-packetq.h`/ |
| 7 | |
| 8 | int SEAP_packetq_initcxx . . $ SEAP_packetq_init(112d135064bed797).(SEAP_packetq_tcxx . . $ SEAP_packetq_t# *queue) |
| 9 | { |
| 10 | if (queue == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 11 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EFAULTcxx . . $ `<external>/8987895939074593727/errno-base.h:18:9`!; |
| 12 | return (-1); |
| 13 | } |
| 14 | |
| 15 | queue->flagscxx . . $ $anonymous_type_88f1f3727d1a082c_0#flags. = SEAP_PACKETQ_DONTFREEcxx . . $ `src/OVAL/probes/SEAP/_seap-packetq.h:14:9`!; |
| 16 | queue->countcxx . . $ $anonymous_type_88f1f3727d1a082c_0#count. = 0; |
| 17 | queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 18 | queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 19 | |
| 20 | if (pthread_mutex_initcxx . . $ pthread_mutex_init(db9d29dab44ea1aa).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) |
| 21 | return (-1); |
| 22 | |
| 23 | return (0); |
| 24 | } |
| 25 | |
| 26 | void SEAP_packetq_freecxx . . $ SEAP_packetq_free(b0f42a28b90020d2).(SEAP_packetq_tcxx . . $ SEAP_packetq_t# *queue) |
| 27 | { |
| 28 | if (queue == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 29 | return; |
| 30 | |
| 31 | pthread_mutex_destroycxx . . $ pthread_mutex_destroy(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.); |
| 32 | } |
| 33 | |
| 34 | struct SEAP_packetq_itemcxx . . $ SEAP_packetq_item# *SEAP_packetq_item_newcxx . . $ SEAP_packetq_item_new(bcfe99a1ae2ef3c4).(void) |
| 35 | { |
| 36 | struct SEAP_packetq_itemcxx . . $ SEAP_packetq_item# *i = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct SEAP_packetq_itemcxx . . $ SEAP_packetq_item#)); |
| 37 | |
| 38 | i->nextcxx . . $ SEAP_packetq_item#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 39 | i->prevcxx . . $ SEAP_packetq_item#prev. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 40 | i->packetcxx . . $ SEAP_packetq_item#packet. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 41 | |
| 42 | return (i); |
| 43 | } |
| 44 | |
| 45 | void SEAP_packetq_item_freecxx . . $ SEAP_packetq_item_free(8f0866a475f51250).(struct SEAP_packetq_itemcxx . . $ SEAP_packetq_item# *i, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! freepacket) |
| 46 | { |
| 47 | if (freepacket) |
| 48 | SEAP_packet_freecxx . . $ SEAP_packet_free(2cb4ed29150e9a0f).(i->packetcxx . . $ SEAP_packetq_item#packet.); |
| 49 | |
| 50 | i->prevcxx . . $ SEAP_packetq_item#prev. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 51 | i->nextcxx . . $ SEAP_packetq_item#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 52 | i->packetcxx . . $ SEAP_packetq_item#packet. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 53 | |
| 54 | freecxx . . $ free(5d22bdacc48458e8).(i); |
| 55 | } |
| 56 | |
| 57 | int SEAP_packetq_getcxx . . $ SEAP_packetq_get(6a2f70d2633884bd).(SEAP_packetq_tcxx . . $ SEAP_packetq_t# *queue, SEAP_packet_tcxx . . $ SEAP_packet_t# **packet_dst) |
| 58 | { |
| 59 | int count; |
| 60 | struct SEAP_packetq_itemcxx . . $ SEAP_packetq_item# *save; |
| 61 | |
| 62 | if (queue == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || packet_dst == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 63 | return (-1); |
| 64 | if (pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.) != 0) |
| 65 | return (-1); |
| 66 | |
| 67 | if (queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 68 | if (queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 69 | return -1; |
| 70 | } |
| 71 | if (queue->countcxx . . $ $anonymous_type_88f1f3727d1a082c_0#count. != 0) { |
| 72 | return -1; |
| 73 | } |
| 74 | |
| 75 | count = -1; |
| 76 | goto __unlock_and_return; |
| 77 | } |
| 78 | |
| 79 | if (queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 80 | return -1; |
| 81 | } |
| 82 | if (queue->countcxx . . $ $anonymous_type_88f1f3727d1a082c_0#count. <= 0) { |
| 83 | return -1; |
| 84 | } |
| 85 | |
| 86 | save = queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first.->nextcxx . . $ SEAP_packetq_item#next.; |
| 87 | (*packet_dst) = queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first.->packetcxx . . $ SEAP_packetq_item#packet.; |
| 88 | SEAP_packetq_item_freecxx . . $ SEAP_packetq_item_free(8f0866a475f51250).(queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 89 | queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first. = save; |
| 90 | |
| 91 | if (queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 92 | queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first.->prevcxx . . $ SEAP_packetq_item#prev. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 93 | else |
| 94 | queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 95 | |
| 96 | count = --queue->countcxx . . $ $anonymous_type_88f1f3727d1a082c_0#count.; |
| 97 | |
| 98 | __unlock_and_return: |
| 99 | if (pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.) != 0) |
| 100 | return (-1); /* abort()? */ |
| 101 | |
| 102 | return (count); |
| 103 | } |
| 104 | |
| 105 | int SEAP_packetq_putcxx . . $ SEAP_packetq_put(14d08a8da169d57d).(SEAP_packetq_tcxx . . $ SEAP_packetq_t# *queue, SEAP_packet_tcxx . . $ SEAP_packet_t# *packet) |
| 106 | { |
| 107 | int count; |
| 108 | |
| 109 | if (queue == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 110 | return (-1); |
| 111 | if (pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.) != 0) |
| 112 | return (-1); |
| 113 | |
| 114 | if (queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 115 | queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first. = SEAP_packetq_item_newcxx . . $ SEAP_packetq_item_new(bcfe99a1ae2ef3c4).(); |
| 116 | queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first.->packetcxx . . $ SEAP_packetq_item#packet. = packet; |
| 117 | queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last. = queue->firstcxx . . $ $anonymous_type_88f1f3727d1a082c_0#first.; |
| 118 | } else { |
| 119 | if (queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 120 | pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.); |
| 121 | return -1; |
| 122 | } |
| 123 | if (queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last.->nextcxx . . $ SEAP_packetq_item#next. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 124 | pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.); |
| 125 | return -1; |
| 126 | } |
| 127 | |
| 128 | queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last.->nextcxx . . $ SEAP_packetq_item#next. = SEAP_packetq_item_newcxx . . $ SEAP_packetq_item_new(bcfe99a1ae2ef3c4).(); |
| 129 | queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last.->nextcxx . . $ SEAP_packetq_item#next.->packetcxx . . $ SEAP_packetq_item#packet. = packet; |
| 130 | queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last.->nextcxx . . $ SEAP_packetq_item#next.->prevcxx . . $ SEAP_packetq_item#prev. = queue->lastcxx . . $ $anonymous_type_88f1f3727d1a082c_0#last.; |
| 131 | } |
| 132 | |
| 133 | count = ++queue->countcxx . . $ $anonymous_type_88f1f3727d1a082c_0#count.; |
| 134 | |
| 135 | if (pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.) != 0) |
| 136 | return (-1); /* abort()? */ |
| 137 | |
| 138 | return (count); |
| 139 | } |
| 140 | |
| 141 | int SEAP_packetq_countcxx . . $ SEAP_packetq_count(112d135064bed797).(SEAP_packetq_tcxx . . $ SEAP_packetq_t# *queue) |
| 142 | { |
| 143 | int count; |
| 144 | |
| 145 | if (queue == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 146 | return (-1); |
| 147 | if (pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.) != 0) |
| 148 | return (-1); |
| 149 | |
| 150 | count = queue->countcxx . . $ $anonymous_type_88f1f3727d1a082c_0#count.; |
| 151 | |
| 152 | if (pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&queue->lockcxx . . $ $anonymous_type_88f1f3727d1a082c_0#lock.) != 0) |
| 153 | return (-1); /* abort()? */ |
| 154 | |
| 155 | return (count); |
| 156 | } |