- Timestamp:
- 09/26/08 12:51:47
(2 months ago)
- Author:
- jbrindle
- Message:
Update to send length across data channel for SHM backend. This does not use the same length passing method as the mq ba
ckend since we didn't have a buffer allocated for the message buffer.
This also changes all send and recv functions to take a size_t instead of an int for the length
and some minor makefile updates for debugging
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r36 |
r59 |
|
| 9 | 9 | # if DEBUG is set, then explicitly compile with -O0 |
|---|
| 10 | 10 | AM_CFLAGS ?= -O0 -g3 -gdwarf-2 |
|---|
| 11 | | LDFLAGS ?= -g |
|---|
| | 11 | LDFLAGS ?= -g3 |
|---|
| 12 | 12 | else |
|---|
| 13 | 13 | # if no DEBUG and no CFLAGS are already set, then compile with -O3 |
|---|
| r54 |
r59 |
|
| 122 | 122 | }; |
|---|
| 123 | 123 | |
|---|
| 124 | | void send_data(int msg_len) { |
|---|
| | 124 | void send_data(size_t msg_len) { |
|---|
| 125 | 125 | BEGIN_EXCEPTION |
|---|
| 126 | 126 | if (sipc_send_data(self->sipc, msg_len) < 0) { |
|---|
| … | … | |
| 146 | 146 | jbyteArray recv_data() { |
|---|
| 147 | 147 | char *data = NULL; |
|---|
| 148 | | int len = 0; |
|---|
| | 148 | size_t len = 0; |
|---|
| 149 | 149 | jobject jresult = NULL; |
|---|
| 150 | 150 | BEGIN_EXCEPTION |
|---|
| r24 |
r59 |
|
| 43 | 43 | int main(void) |
|---|
| 44 | 44 | { |
|---|
| 45 | | int msglen = 0; |
|---|
| | 45 | size_t msglen = 0; |
|---|
| 46 | 46 | char *data = NULL; |
|---|
| 47 | 47 | |
|---|
| r24 |
r59 |
|
| 44 | 44 | { |
|---|
| 45 | 45 | char *data = NULL; |
|---|
| 46 | | int len = 0; |
|---|
| | 46 | size_t len = 0; |
|---|
| 47 | 47 | |
|---|
| 48 | 48 | /* Initialize the IPC handle */ |
|---|
| r50 |
r59 |
|
| 71 | 71 | * This can only be called if sender was specified when sipc_init was called. |
|---|
| 72 | 72 | * returns 0 on success, <0 on failure */ |
|---|
| 73 | | int sipc_send_data(sipc_t *sipc, int msg_len); |
|---|
| | 73 | int sipc_send_data(sipc_t *sipc, size_t msg_len); |
|---|
| 74 | 74 | |
|---|
| 75 | 75 | /* Call to receive data. Data will be allocated and filled and len |
|---|
| 76 | 76 | * will be set to the length. Returns 0 on success, <0 on failure. */ |
|---|
| 77 | | int sipc_recv_data(sipc_t *sipc, char **data, int *len); |
|---|
| | 77 | int sipc_recv_data(sipc_t *sipc, char **data, size_t *len); |
|---|
| 78 | 78 | |
|---|
| 79 | 79 | /* Returns a pointer to the data contained within the IPC resource */ |
|---|
| r48 |
r59 |
|
| 20 | 20 | |
|---|
| 21 | 21 | #include <stdio.h> |
|---|
| | 22 | #include <stdlib.h> |
|---|
| 22 | 23 | #include <sys/types.h> |
|---|
| 23 | 24 | #include <sys/ipc.h> |
|---|
| … | … | |
| 28 | 29 | #include "sipc/sipc.h" |
|---|
| 29 | 30 | #include "mqueue_internal.h" |
|---|
| | 31 | #include "sipc_internal.h" |
|---|
| 30 | 32 | |
|---|
| 31 | 33 | #define hidden __attribute__ ((visibility ("hidden"))) |
|---|
| … | … | |
| 96 | 98 | |
|---|
| 97 | 99 | /* Change the capacity of the message queue to contain a user |
|---|
| 98 | | * defined number bytes */ |
|---|
| 99 | | int hidden mqueue_set_capacity(int msqid, int mqbytes) |
|---|
| | 100 | * defined number of messages (not bytes) */ |
|---|
| | 101 | int hidden mqueue_set_capacity(int msqid, int mq_messages) |
|---|
| 100 | 102 | { |
|---|
| 101 | 103 | struct msqid_ds mqbuf; |
|---|
| … | … | |
| 105 | 107 | |
|---|
| 106 | 108 | /* Change the capacity of the queue */ |
|---|
| 107 | | mqbuf.msg_qbytes = mqbytes; |
|---|
| | 109 | mqbuf.msg_qbytes = mq_messages * (sizeof(struct shm_msgbuf) - sizeof(long)); |
|---|
| 108 | 110 | if (msgctl(msqid, IPC_SET, &mqbuf) < 0) |
|---|
| 109 | 111 | return -1; |
|---|
| … | … | |
| 115 | 117 | * If block is non-zero, this call will block if no such message exists in the |
|---|
| 116 | 118 | * queue. */ |
|---|
| 117 | | int hidden mqueue_get_msg_type(int msqid, int type, int block) |
|---|
| | 119 | int hidden mqueue_get_msg_type(sipc_t *sipc, int msqid, int type, int block, size_t *payload) |
|---|
| 118 | 120 | { |
|---|
| 119 | | struct msgbuf mbuf; |
|---|
| | 121 | struct shm_msgbuf *mbuf; |
|---|
| 120 | 122 | int flags = block ? 0 : IPC_NOWAIT; |
|---|
| | 123 | int ret; |
|---|
| 121 | 124 | |
|---|
| 122 | | while (msgrcv(msqid, &mbuf, sizeof(mbuf.mtext), type, flags) < 0) { |
|---|
| | 125 | mbuf = calloc(1, sizeof(*mbuf)); |
|---|
| | 126 | if (!mbuf) { |
|---|
| | 127 | sipc_error(sipc, "Out of memory!\n"); |
|---|
| | 128 | return -1; |
|---|
| | 129 | } |
|---|
| | 130 | |
|---|
| | 131 | while (msgrcv(msqid, mbuf, sizeof(*mbuf) - sizeof(long), type, flags) < 0) { |
|---|
| 123 | 132 | if (errno == EINTR) { |
|---|
| 124 | 133 | continue; |
|---|
| … | … | |
| 129 | 138 | } |
|---|
| 130 | 139 | |
|---|
| 131 | | return mbuf.mtype; |
|---|
| | 140 | *payload = mbuf->payload; |
|---|
| | 141 | ret = mbuf->mtype; |
|---|
| | 142 | |
|---|
| | 143 | free(mbuf); |
|---|
| | 144 | |
|---|
| | 145 | return ret; |
|---|
| 132 | 146 | } |
|---|
| 133 | 147 | |
|---|
| 134 | 148 | /* This exists solely for the shared memory implementation |
|---|
| 135 | 149 | * to be able to send data-ready markers. |
|---|
| 136 | | * If block is non-zero, this call will block if the message queue is full. */ |
|---|
| 137 | | int hidden mqueue_send_msg_type(int msqid, int type, int block) |
|---|
| | 150 | * If block is non-zero, this call will block if the message queue is full. * |
|---|
| | 151 | * payload is currently used for packing the message length in the DATA_READY packet */ |
|---|
| | 152 | int hidden mqueue_send_msg_type(sipc_t *sipc, int msqid, int type, int block, size_t payload) |
|---|
| 138 | 153 | { |
|---|
| 139 | | struct msgbuf mbuf; |
|---|
| | 154 | struct shm_msgbuf *mbuf; |
|---|
| 140 | 155 | int flags = block ? 0 : IPC_NOWAIT; |
|---|
| 141 | 156 | |
|---|
| 142 | | mbuf.mtype = type; |
|---|
| 143 | | memset(mbuf.mtext, 1, sizeof(mbuf.mtext)); |
|---|
| 144 | | while (msgsnd(msqid, &mbuf, sizeof(mbuf.mtext), flags) < 0) { |
|---|
| | 157 | mbuf = calloc(1, sizeof(*mbuf)); |
|---|
| | 158 | if (!mbuf) { |
|---|
| | 159 | sipc_error(sipc, "Out of memory!\n"); |
|---|
| | 160 | return -1; |
|---|
| | 161 | } |
|---|
| | 162 | |
|---|
| | 163 | mbuf->mtype = type; |
|---|
| | 164 | mbuf->payload = payload; |
|---|
| | 165 | while (msgsnd(msqid, mbuf, sizeof(*mbuf) - sizeof(long), flags) < 0) { |
|---|
| 145 | 166 | if (errno != EINTR) { |
|---|
| 146 | 167 | return -1; |
|---|
| … | … | |
| 148 | 169 | } |
|---|
| 149 | 170 | |
|---|
| | 171 | free(mbuf); |
|---|
| | 172 | |
|---|
| 150 | 173 | return 0; |
|---|
| 151 | 174 | } |
|---|
| r41 |
r59 |
|
| 25 | 25 | void mqueue_disconnect(int msqid); |
|---|
| 26 | 26 | int mqueue_set_capacity(int msqid, int mqbytes); |
|---|
| 27 | | int mqueue_get_msg_type(int msqid, int type, int block); |
|---|
| 28 | | int mqueue_send_msg_type(int msqid, int type, int block); |
|---|
| | 27 | int mqueue_get_msg_type(sipc_t *sipc, int msqid, int type, int block, size_t *payload); |
|---|
| | 28 | int mqueue_send_msg_type(sipc_t *sipc, int msqid, int type, int block, size_t payload); |
|---|
| 29 | 29 | int mqueue_create(key_t key); |
|---|
| 30 | 30 | void mqueue_destroy_resource(key_t key); |
|---|
| r48 |
r59 |
|
| 36 | 36 | int sipc_shm_recv_done(sipc_t *sipc) |
|---|
| 37 | 37 | { |
|---|
| | 38 | size_t payload; |
|---|
| | 39 | |
|---|
| 38 | 40 | if (!sipc || sipc->ipc_type != SIPC_SYSV_SHM) { |
|---|
| 39 | 41 | errno = EINVAL; |
|---|
| … | … | |
| 41 | 43 | } |
|---|
| 42 | 44 | |
|---|
| 43 | | if (mqueue_get_msg_type(sipc->s.msqid, SIPC_DATA_READING, MQ_BLOCK) < 0) { |
|---|
| | 45 | if (mqueue_get_msg_type(sipc, sipc->s.msqid, SIPC_DATA_READING, MQ_BLOCK, &payload) < 0) { |
|---|
| 44 | 46 | return -1; |
|---|
| 45 | 47 | } |
|---|
| 46 | 48 | sipc->len = 0; |
|---|
| 47 | | if (mqueue_get_msg_type(sipc->s.msqid, SIPC_DATA_DONE, MQ_BLOCK) < 0) { |
|---|
| | 49 | if (mqueue_get_msg_type(sipc, sipc->s.msqid, SIPC_DATA_DONE, MQ_BLOCK, &payload) < 0) { |
|---|
| 48 | 50 | return -1; |
|---|
| 49 | 51 | } |
|---|
| r48 |
r59 |
|
| 148 | 148 | } |
|---|
| 149 | 149 | |
|---|
| 150 | | int sipc_send_data(sipc_t *sipc, int msg_len) |
|---|
| | 150 | int sipc_send_data(sipc_t *sipc, size_t msg_len) |
|---|
| 151 | 151 | { |
|---|
| 152 | 152 | if (!sipc) { |
|---|
| … | … | |
| 164 | 164 | } |
|---|
| 165 | 165 | if (msg_len > sipc->data_size) { |
|---|
| 166 | | sipc_error(sipc, "sipc_send_data: cannot send buffer of size %d, can only receive %zd\n", msg_len, sipc->data_size); |
|---|
| | 166 | sipc_error(sipc, "sipc_send_data: cannot send buffer of size %zu, can only receive %zd\n", msg_len, sipc->data_size); |
|---|
| 167 | 167 | errno = ENOMEM; |
|---|
| 168 | 168 | return -1; |
|---|
| … | … | |
| 172 | 172 | } |
|---|
| 173 | 173 | |
|---|
| 174 | | int sipc_recv_data(sipc_t *sipc, char **data, int *len) |
|---|
| | 174 | int sipc_recv_data(sipc_t *sipc, char **data, size_t *len) |
|---|
| 175 | 175 | { |
|---|
| 176 | 176 | if (data) |
|---|
| r48 |
r59 |
|
| 35 | 35 | #define SIPC_END_XMIT 0x0c |
|---|
| 36 | 36 | |
|---|
| | 37 | /* msgbuf wrapper used for shm control messages */ |
|---|
| | 38 | struct shm_msgbuf { |
|---|
| | 39 | long mtype; /* Control message type */ |
|---|
| | 40 | size_t payload; /* Currently used for packing len */ |
|---|
| | 41 | }; |
|---|
| | 42 | |
|---|
| 37 | 43 | /* Creation functions */ |
|---|
| 38 | 44 | int sipc_mqueue_create(sipc_t *sipc); |
|---|
| … | … | |
| 62 | 68 | int (*sipc_attach) (sipc_t *sipc); |
|---|
| 63 | 69 | char *(*sipc_get_data_ptr) (sipc_t *sipc); |
|---|
| 64 | | int (*sipc_send_data) (sipc_t *sipc, int msg_len); |
|---|
| 65 | | int (*sipc_recv_data) (sipc_t *sipc, char **data, int *len); |
|---|
| | 70 | int (*sipc_send_data) (sipc_t *sipc, size_t msg_len); |
|---|
| | 71 | int (*sipc_recv_data) (sipc_t *sipc, char **data, size_t *len); |
|---|
| 66 | 72 | void (*sipc_detach) (sipc_t *sipc); |
|---|
| 67 | 73 | void (*_sipc_error) (const char *fmt, va_list ap); |
|---|
| r48 |
r59 |
|
| 52 | 52 | /* Forward decls */ |
|---|
| 53 | 53 | static int get_max_msg(sipc_t *sipc); |
|---|
| 54 | | static int mqueue_send_msg_len(sipc_t *sipc, int msg_len); |
|---|
| | 54 | static int mqueue_send_msg_len(sipc_t *sipc, size_t msg_len); |
|---|
| 55 | 55 | static int mqueue_send_end_xmit(sipc_t *sipc); |
|---|
| 56 | 56 | static int is_msg_len(struct msgbuf *mbuf); |
|---|
| … | … | |
| 136 | 136 | /* Sends a message to the queue. |
|---|
| 137 | 137 | * Returns 0 on success, -1 on error */ |
|---|
| 138 | | int sipc_mqueue_send_data(sipc_t *sipc, int msg_len) |
|---|
| | 138 | int sipc_mqueue_send_data(sipc_t *sipc, size_t msg_len) |
|---|
| 139 | 139 | { |
|---|
| 140 | 140 | size_t max_packet_sz = SIPC_MQUEUE_MSG_SZ - sizeof(long); |
|---|
| … | … | |
| 179 | 179 | } |
|---|
| 180 | 180 | |
|---|
| 181 | | int sipc_mqueue_recv_data(sipc_t *sipc, char **data, int *len) |
|---|
| | 181 | int sipc_mqueue_recv_data(sipc_t *sipc, char **data, size_t *len) |
|---|
| 182 | 182 | { |
|---|
| 183 | 183 | int retv = -1; |
|---|
| … | … | |
| 363 | 363 | } |
|---|
| 364 | 364 | |
|---|
| 365 | | static int mqueue_send_msg_len(sipc_t *sipc, int len) |
|---|
| | 365 | static int mqueue_send_msg_len(sipc_t *sipc, size_t len) |
|---|
| 366 | 366 | { |
|---|
| 367 | 367 | struct msgbuf *mbuf; |
|---|
| … | … | |
| 380 | 380 | mbuf->mtype = SIPC_MSG_LEN; |
|---|
| 381 | 381 | |
|---|
| 382 | | sprintf(mbuf->mtext, "%d", len); |
|---|
| | 382 | sprintf(mbuf->mtext, "%zu", len); |
|---|
| 383 | 383 | |
|---|
| 384 | 384 | while (msgsnd(sipc->msqid, mbuf, strlen(mbuf->mtext) + 1, 0) < 0) { |
|---|
| r41 |
r59 |
|
| 32 | 32 | void sipc_mqueue_disconnect(sipc_t *sipc); |
|---|
| 33 | 33 | char *sipc_mqueue_get_data_ptr(sipc_t *sipc); |
|---|
| 34 | | int sipc_mqueue_send_data(sipc_t *sipc, int msg_len); |
|---|
| 35 | | int sipc_mqueue_recv_data(sipc_t *sipc, char **data, int *len); |
|---|
| | 34 | int sipc_mqueue_send_data(sipc_t *sipc, size_t msg_len); |
|---|
| | 35 | int sipc_mqueue_recv_data(sipc_t *sipc, char **data, size_t *len); |
|---|
| 36 | 36 | int sipc_mqueue_end_xmit(sipc_t *sipc); |
|---|
| 37 | 37 | void sipc_mqueue_destroy_handle(sipc_t *sipc); |
|---|
| r48 |
r59 |
|
| 158 | 158 | * before the reader is done with the data. |
|---|
| 159 | 159 | */ |
|---|
| 160 | | int sipc_shm_send_data(sipc_t *sipc, int msg_len) |
|---|
| | 160 | int sipc_shm_send_data(sipc_t *sipc, size_t msg_len) |
|---|
| 161 | 161 | { |
|---|
| 162 | 162 | int error; |
|---|
| … | … | |
| 164 | 164 | /* Send a DATA_READY marker */ |
|---|
| 165 | 165 | sipc->len = msg_len; |
|---|
| 166 | | if (mqueue_send_msg_type(sipc->s.msqid, SIPC_DATA_READY, MQ_BLOCK) < 0) { |
|---|
| | 166 | if (mqueue_send_msg_type(sipc, sipc->s.msqid, SIPC_DATA_READY, MQ_BLOCK, msg_len) < 0) { |
|---|
| 167 | 167 | error = errno; |
|---|
| 168 | 168 | sipc_error(sipc, "Could not send DATA_READY marker\n"); |
|---|
| … | … | |
| 173 | 173 | /* Send a DATA_READING marker; this should block until the |
|---|
| 174 | 174 | reader calls sipc_recv_data(). */ |
|---|
| 175 | | if (mqueue_send_msg_type(sipc->s.msqid, SIPC_DATA_READING, MQ_BLOCK) < 0) { |
|---|
| | 175 | if (mqueue_send_msg_type(sipc, sipc->s.msqid, SIPC_DATA_READING, MQ_BLOCK, 0) < 0) { |
|---|
| 176 | 176 | error = errno; |
|---|
| 177 | 177 | sipc_error(sipc, "Could not send DATA_READING marker\n"); |
|---|
| … | … | |
| 182 | 182 | /* Send a DATA_DONE marker; this should block until the reader |
|---|
| 183 | 183 | calls sipc_shm_recv_done(). */ |
|---|
| 184 | | if (mqueue_send_msg_type(sipc->s.msqid, SIPC_DATA_DONE, MQ_BLOCK) < 0) { |
|---|
| | 184 | if (mqueue_send_msg_type(sipc, sipc->s.msqid, SIPC_DATA_DONE, MQ_BLOCK, 0) < 0) { |
|---|
| 185 | 185 | error = errno; |
|---|
| 186 | 186 | sipc_error(sipc, "Could not send DATA_DONE marker\n"); |
|---|
| … | … | |
| 196 | 196 | * message queue, if the handle is set to blocking mode (default). |
|---|
| 197 | 197 | */ |
|---|
| 198 | | int sipc_shm_recv_data(sipc_t *sipc, char **data, int *len) |
|---|
| | 198 | int sipc_shm_recv_data(sipc_t *sipc, char **data, size_t *len) |
|---|
| 199 | 199 | { |
|---|
| 200 | 200 | int mtype = 0; |
|---|
| … | … | |
| 204 | 204 | |
|---|
| 205 | 205 | /* Get a message from the side channel. */ |
|---|
| 206 | | mtype = mqueue_get_msg_type(sipc->s.msqid, SIPC_ANY, block); |
|---|
| | 206 | mtype = mqueue_get_msg_type(sipc, sipc->s.msqid, SIPC_ANY, block, len); |
|---|
| 207 | 207 | if (mtype == SIPC_DATA_READY) { |
|---|
| 208 | 208 | /* It is now OK to read shared memory */ |
|---|
| 209 | 209 | *data = sipc->data; |
|---|
| 210 | | *len = sipc->data_size; |
|---|
| 211 | 210 | return 0; |
|---|
| 212 | 211 | } else { |
|---|
| r41 |
r59 |
|
| 29 | 29 | void sipc_shm_disconnect(sipc_t *sipc); |
|---|
| 30 | 30 | char *sipc_shm_get_data_ptr(sipc_t *sipc); |
|---|
| 31 | | int sipc_shm_send_data(sipc_t *sipc, int msg_len); |
|---|
| 32 | | int sipc_shm_recv_data(sipc_t *sipc, char **data, int *len); |
|---|
| | 31 | int sipc_shm_send_data(sipc_t *sipc, size_t msg_len); |
|---|
| | 32 | int sipc_shm_recv_data(sipc_t *sipc, char **data, size_t *len); |
|---|
| 33 | 33 | int sipc_shm_end_xmit(sipc_t *sipc); |
|---|
| 34 | 34 | void sipc_shm_destroy_handle(sipc_t *sipc); |
|---|
| r47 |
r59 |
|
| 3 | 3 | AM_LDFLAGS += -lsipc -lcunit -Wl,-rpath=$(TOP_BUILDDIR)/src -L$(TOP_BUILDDIR)/src |
|---|
| 4 | 4 | TOP_BUILDDIR := $(shell pwd)/.. |
|---|
| | 5 | CFLAGS += -O0 -g3 -gdwarf-2 |
|---|
| 5 | 6 | |
|---|
| 6 | 7 | all: |
|---|
| r48 |
r59 |
|
| 174 | 174 | size_t message_len = sizeof(message); |
|---|
| 175 | 175 | char *data = sipc_get_data_ptr(writer_ipc); |
|---|
| 176 | | int recv_len; |
|---|
| | 176 | size_t recv_len; |
|---|
| 177 | 177 | char *recv_data; |
|---|
| 178 | 178 | |
|---|
| … | … | |
| 269 | 269 | { |
|---|
| 270 | 270 | char *data = NULL; |
|---|
| 271 | | int len = 0; |
|---|
| | 271 | size_t len = 0; |
|---|
| 272 | 272 | |
|---|
| 273 | 273 | while (!sipc_recv_data(reader_ipc, &data, &len)) { |
|---|
| … | … | |
| 328 | 328 | { |
|---|
| 329 | 329 | char *data = NULL; |
|---|
| 330 | | int len = 0; |
|---|
| | 330 | size_t len = 0; |
|---|
| 331 | 331 | |
|---|
| 332 | 332 | size_t j = 0; |
|---|
| … | … | |
| 427 | 427 | { |
|---|
| 428 | 428 | char *data = NULL; |
|---|
| 429 | | int len = 0, retv, error; |
|---|
| | 429 | size_t len = 0; |
|---|
| | 430 | int retv, error; |
|---|
| 430 | 431 | |
|---|
| 431 | 432 | printf("This should pause for 2 seconds (default read)...\n"); |
|---|
| r45 |
r59 |
|
| 251 | 251 | char *data = NULL; |
|---|
| 252 | 252 | char recv_data[DATA_LEN]; |
|---|
| 253 | | int len = 0; |
|---|
| | 253 | size_t len = 0; |
|---|
| 254 | 254 | |
|---|
| 255 | 255 | memset(recv_data, 0, sizeof(recv_data)); |
|---|
| … | … | |
| 308 | 308 | char *data = NULL; |
|---|
| 309 | 309 | unsigned char recv_data[DATA_LEN]; |
|---|
| 310 | | int len = 0, i; |
|---|
| | 310 | size_t len = 0, i; |
|---|
| 311 | 311 | |
|---|
| 312 | 312 | memset(recv_data, 0, sizeof(recv_data)); |
|---|
| … | … | |
| 352 | 352 | sleep(2); |
|---|
| 353 | 353 | shm_data[0] = 0x42; |
|---|
| 354 | | if (sipc_send_data(writer_ipc, 1) < 0) { |
|---|
| | 354 | if (sipc_send_data(writer_ipc, DATA_LEN) < 0) { |
|---|
| 355 | 355 | sipc_error(writer_ipc, "Unable to send data\n"); |
|---|
| 356 | 356 | return; |
|---|
| … | … | |
| 358 | 358 | sleep(2); |
|---|
| 359 | 359 | shm_data[0] = 0x43; |
|---|
| 360 | | if (sipc_send_data(writer_ipc, 1) < 0) { |
|---|
| | 360 | if (sipc_send_data(writer_ipc, DATA_LEN) < 0) { |
|---|
| 361 | 361 | sipc_error(writer_ipc, "Unable to send data\n"); |
|---|
| 362 | 362 | return; |
|---|
| 363 | 363 | } |
|---|
| 364 | 364 | shm_data[0] = 0x44; |
|---|
| 365 | | if (sipc_send_data(writer_ipc, 1) < 0) { |
|---|
| | 365 | if (sipc_send_data(writer_ipc, DATA_LEN) < 0) { |
|---|
| 366 | 366 | sipc_error(writer_ipc, "Unable to send data\n"); |
|---|
| 367 | 367 | return; |
|---|
| … | … | |
| 373 | 373 | { |
|---|
| 374 | 374 | char *data = NULL; |
|---|
| 375 | | int len = 0, retv, error; |
|---|
| | 375 | size_t len = 0, retv, error; |
|---|
| 376 | 376 | |
|---|
| 377 | 377 | printf("This should pause for 2 seconds (default read)...\n"); |
|---|
Download in other formats:
* Generating other formats may take time.