diff options
author | Spencer Oliver <ntfreak@users.sourceforge.net> | 2010-10-04 20:34:47 +0100 |
---|---|---|
committer | Spencer Oliver <ntfreak@users.sourceforge.net> | 2010-10-04 20:34:47 +0100 |
commit | 45de3b1fbe875de7ed322d76bb517bdb48e20a5a (patch) | |
tree | f8a8a0b419a8aa48ca71831b554cf8184a4ae120 /src/server | |
parent | d543aa01480f1b54041f98707102622308252e11 (diff) | |
download | riscv-openocd-45de3b1fbe875de7ed322d76bb517bdb48e20a5a.zip riscv-openocd-45de3b1fbe875de7ed322d76bb517bdb48e20a5a.tar.gz riscv-openocd-45de3b1fbe875de7ed322d76bb517bdb48e20a5a.tar.bz2 |
server: fix server pipe windows support
commit 50d5441e2a615fb2c44b41a777e4373901f7a2e6 caused
native windows build to fail.
Firstly this patch fixes the build issue, but it also disables support
for named pipes under Windows. Windows does not support posix named
pipes.
A cross-platfom access layer will need creating before support can be
enabled again.
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/server.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/server/server.c b/src/server/server.c index c7e1e40..01d91d3 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -90,6 +90,11 @@ static int add_connection(struct service *service, struct command_context *cmd_c c->fd = service->fd; c->fd_out = fileno(stdout); +#ifdef _WIN32 + /* we are using stdin/out so ignore ctrl-c under windoze */ + SetConsoleCtrlHandler(NULL, TRUE); +#endif + /* do not check for new connections again on stdin */ service->fd = -1; @@ -268,6 +273,12 @@ int add_service(char *name, const char *port, int max_connections, new_connectio } else if (c->type == CONNECTION_PIPE) { +#ifdef _WIN32 + /* we currenty do not support named pipes under win32 + * so exit openocd for now */ + LOG_ERROR("Named pipes currently not supported under this os"); + exit(1); +#else /* Pipe we're reading from */ c->fd = open(c->port, O_RDONLY | O_NONBLOCK); if (c->fd == -1) @@ -275,6 +286,7 @@ int add_service(char *name, const char *port, int max_connections, new_connectio LOG_ERROR("could not open %s", c->port); exit(1); } +#endif } /* add to the end of linked list */ @@ -526,16 +538,8 @@ int server_preinit(void) exit(-1); } - if (server_use_pipes == 0) - { - /* register ctrl-c handler */ - SetConsoleCtrlHandler(ControlHandler, TRUE); - } - else - { - /* we are using pipes so ignore ctrl-c */ - SetConsoleCtrlHandler(NULL, TRUE); - } + /* register ctrl-c handler */ + SetConsoleCtrlHandler(ControlHandler, TRUE); signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); |