[ovs-dev] [PATCH v2 2/2] process: Make changes for Windows.
Gurucharan Shetty
shettyg at nicira.com
Fri Feb 14 23:15:48 UTC 2014
As of now, we are using the process subsystem in
ovsdb-server to handle the "--run" command line
option. That particular option is not used often
and till deemed necessary, make it unsupported on
Windows platform.
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
lib/process.c | 19 +++++++++++++++++++
ovsdb/ovsdb-server.1.in | 2 ++
ovsdb/ovsdb-server.c | 2 ++
3 files changed, 23 insertions(+)
diff --git a/lib/process.c b/lib/process.c
index 5dd34b3..fe93cd0 100644
--- a/lib/process.c
+++ b/lib/process.c
@@ -68,6 +68,7 @@ static void sigchld_handler(int signr OVS_UNUSED);
void
process_init(void)
{
+#ifndef _WIN32
static bool inited;
struct sigaction sa;
@@ -86,6 +87,7 @@ process_init(void)
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_NOCLDSTOP | SA_RESTART;
xsigaction(SIGCHLD, &sa, NULL);
+#endif
}
char *
@@ -178,6 +180,7 @@ process_register(const char *name, pid_t pid)
int
process_start(char **argv, struct process **pp)
{
+#ifndef _WIN32
pid_t pid;
int error;
@@ -212,6 +215,10 @@ process_start(char **argv, struct process **pp)
argv[0], ovs_strerror(errno));
_exit(1);
}
+#else
+ *pp = NULL;
+ return ENOSYS;
+#endif
}
/* Destroys process 'p'. */
@@ -230,9 +237,13 @@ process_destroy(struct process *p)
int
process_kill(const struct process *p, int signr)
{
+#ifndef _WIN32
return (p->exited ? ESRCH
: !kill(p->pid, signr) ? 0
: errno);
+#else
+ return ENOSYS;
+#endif
}
/* Returns the pid of process 'p'. */
@@ -274,6 +285,7 @@ process_status(const struct process *p)
char *
process_status_msg(int status)
{
+#ifndef _WIN32
struct ds ds = DS_EMPTY_INITIALIZER;
if (WIFEXITED(status)) {
ds_put_format(&ds, "exit status %d", WEXITSTATUS(status));
@@ -294,12 +306,16 @@ process_status_msg(int status)
ds_put_cstr(&ds, ", core dumped");
}
return ds_cstr(&ds);
+#else
+ return NULL;
+#endif
}
/* Executes periodic maintenance activities required by the process module. */
void
process_run(void)
{
+#ifndef _WIN32
char buf[_POSIX_PIPE_BUF];
if (!list_is_empty(&all_processes) && read(fds[0], buf, sizeof buf) > 0) {
@@ -322,6 +338,7 @@ process_run(void)
}
}
}
+#endif
}
@@ -330,11 +347,13 @@ process_run(void)
void
process_wait(struct process *p)
{
+#ifndef _WIN32
if (p->exited) {
poll_immediate_wake();
} else {
poll_fd_wait(fds[0], POLLIN);
}
+#endif
}
char *
diff --git a/ovsdb/ovsdb-server.1.in b/ovsdb/ovsdb-server.1.in
index 6924d42..a4cf344 100644
--- a/ovsdb/ovsdb-server.1.in
+++ b/ovsdb/ovsdb-server.1.in
@@ -88,6 +88,8 @@ otherwise, it exits with exit code 1.
This option can be useful where a database server is needed only to
run a single command, e.g.:
.B "ovsdb\-server \-\-remote=punix:socket \-\-run='ovsdb\-client dump unix:socket Open_vSwitch'"
+.IP
+This option is not supported on Windows platform.
.SS "Daemon Options"
.ds DD \
\fBovsdb\-server\fR detaches only after it starts listening on all \
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index c24d355..bdcdad9 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -1172,7 +1172,9 @@ parse_options(int *argcp, char **argvp[],
static const struct option long_options[] = {
{"remote", required_argument, NULL, OPT_REMOTE},
{"unixctl", required_argument, NULL, OPT_UNIXCTL},
+#ifndef _WIN32
{"run", required_argument, NULL, OPT_RUN},
+#endif
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
DAEMON_LONG_OPTIONS,
--
1.7.9.5
More information about the dev
mailing list