diff options
Diffstat (limited to 'agni.c')
-rw-r--r-- | agni.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -24,8 +24,8 @@ #include "mq_cmd.h" #include "tbl_qcmd.h" -/* -no defence programming, no error checking, no argument checking just PoC +/* +no defence programming, no error checking, no argument checking just PoC nothing else */ @@ -78,8 +78,8 @@ typedef struct mq_ntf_io_mplx #define MQ_IN 2 -/* -supposed format agni-[id]-[in/out] +/* +supposed format agni-[id]-[in/out] in is for input of thread (send to in and thread will recieve), out if for output of thread (read from out to recieve from thread) */ @@ -94,8 +94,8 @@ typedef struct mq_ntf_mdt } mq_ntf_mdt; -/* -return -1 on error +/* +return -1 on error */ int mq_ntf_open(mq_ntf_mdt *mq, int id) { @@ -196,7 +196,7 @@ int mq_ntf_select(mq_ntf_mdt *mq, int dir) FD_SET(fd, &io_fds); tv.tv_sec = 1; tv.tv_usec = 0; - fdnum = select(1, + fdnum = select(1, &io_fds, NULL, NULL, @@ -241,7 +241,7 @@ int mq_ntf_read(mq_ntf_mdt *mq, int dir, char *buf, size_t size) printf("queue %d out full\n", mq->id); return -1; } - bytes = mq_receive(mqd, buf, + bytes = mq_receive(mqd, buf, size > attr.mq_msgsize ? attr.mq_msgsize : size, &prio); if (bytes == -1) @@ -278,7 +278,7 @@ int mq_ntf_write(mq_ntf_mdt *mq, int dir, const char *buf, size_t size) printf("queue %d out full\n", mq->id); return -1; } - bytes = mq_send(mqd, buf, + bytes = mq_send(mqd, buf, size > attr.mq_msgsize ? attr.mq_msgsize : size, prio); if (bytes == -1) @@ -451,12 +451,12 @@ int mq_ntf_getattr(mq_ntf_mdt *mq, int dir, struct mq_attr **attr) -int send_mq_cmd(mq_ntf_mdt *mq, +int send_mq_cmd(mq_ntf_mdt *mq, int io, - int cmd_id, - char *cmd, - size_t cmd_sz, - char *param, + int cmd_id, + char *cmd, + size_t cmd_sz, + char *param, size_t param_sz) { int err = 0; @@ -493,7 +493,7 @@ int send_mq_cmd(mq_ntf_mdt *mq, return 0; } -int recv_mq_cmd(mq_ntf_mdt *mq, +int recv_mq_cmd(mq_ntf_mdt *mq, int io, mq_cmd **cmd) //return back recieved command { @@ -652,7 +652,7 @@ int th_start_client(void *data) if (mq_ntf_read(mq, MQ_IN, in_buf, in_attr.mq_msgsize) == -1) { printf("Cant read input message \n"); - } else + } else { in_buf[in_attr.mq_msgsize-1] = 0x0; printf("Recieve %s\n", in_buf); @@ -873,7 +873,7 @@ int main(int argc, char **argv) clone(th_event_manager, evhnd_cfg->stack+EVENT_HND_STACK_SIZE, CLONE_VM|CLONE_FILES, (void *)evhnd_cfg); /* run until all threads are up */ - cnt_running = 1; + cnt_running = 1; while(cnt_running != 0) { //printf("Count\n"); |