|
|
| version 1.1.2.1, 2015/01/18 11:18:14 | version 1.4, 2024/03/20 17:32:30 |
|---|---|
| Line 1 | Line 1 |
| #include <stdio.h> | #include <stdio.h> |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #include <pthread.h> | #include <pthread.h> |
| #include <sys/wait.h> | |
| #include <aitrpc.h> | #include <aitrpc.h> |
| #include "rc.h" | #include "rc.h" |
| Line 114 int big(rpc_cli_t *cli, struct tagRPCCall *rpc, array_ | Line 118 int big(rpc_cli_t *cli, struct tagRPCCall *rpc, array_ |
| int main(int argc, char **argv) | int main(int argc, char **argv) |
| { | { |
| rpc_func_t *f; | rpc_func_t *f; |
| int ret; | int ret, fds[2]; |
| srv = rpc_srv_initServerExt(2, 1024 * 10, 0); | if (argc < 2) { |
| printf("not enough parameters ... where is tcliext program?\n"); | |
| return 1; | |
| } | |
| if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) == -1) { | |
| printf("error:: errno=%d %s\n", errno, strerror(errno)); | |
| return 1; | |
| } | |
| switch (fork()) { | |
| case -1: | |
| printf("error:: errno=%d %s\n", errno, strerror(errno)); | |
| return 1; | |
| case 0: | |
| close(fds[1]); | |
| dup2(fds[0], 2); | |
| close(fds[0]); | |
| sleep(1); | |
| execl(argv[1], argv[1], NULL); | |
| return 127; | |
| default: | |
| close(fds[0]); | |
| } | |
| srv = rpc_srv_initServerExt(2, 1024 * 10, fds[1]); | |
| if (!srv) { | if (!srv) { |
| printf("error:: errno=%d %s\n", rpc_GetErrno(), rpc_GetError()); | printf("error:: errno=%d %s\n", rpc_GetErrno(), rpc_GetError()); |
| return 1; | return 1; |
| } | } |
| rpc_srv_DispatchSignal(srv, 42); | |
| rpc_srv_registerCall(srv, RC_aaa, aaa); | rpc_srv_registerCall(srv, RC_aaa, aaa); |
| rpc_srv_registerCall(srv, RC_BBB, BBB); | rpc_srv_registerCall(srv, RC_BBB, BBB); |
| rpc_srv_registerCall(srv, 3, NULL); | rpc_srv_registerCall(srv, 3, NULL); |
| Line 134 int main(int argc, char **argv) | Line 165 int main(int argc, char **argv) |
| rpc_register_srvServices(srv); | rpc_register_srvServices(srv); |
| rpc_srv_loopServer(srv); | rpc_srv_loopServer(srv); |
| rpc_srv_DispatchSignal(srv, 0); | |
| rpc_srv_endServer(&srv); | rpc_srv_endServer(&srv); |
| close(fds[1]); | |
| wait(&ret); | |
| return 0; | return 0; |
| } | } |