summaryrefslogtreecommitdiff
path: root/lib/process.c
diff options
context:
space:
mode:
authorGurucharan Shetty <gshetty@nicira.com>2014-02-14 14:07:34 -0800
committerGurucharan Shetty <gshetty@nicira.com>2014-02-19 14:24:26 -0800
commit41064650bea07f7896cf5f5ccfebef1bdec153fa (patch)
tree770e8a6fe30ce83f38508196ccb6b55a15ae2ceb /lib/process.c
parent6ca326ed3f1def5f3dbc05f03e9808191e488a38 (diff)
downloadopenvswitch-41064650bea07f7896cf5f5ccfebef1bdec153fa.tar.gz
process: Make changes for Windows.
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@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/process.c')
-rw-r--r--lib/process.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/process.c b/lib/process.c
index 5dd34b3a7..d0e18821b 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'. */
@@ -275,6 +286,7 @@ char *
process_status_msg(int status)
{
struct ds ds = DS_EMPTY_INITIALIZER;
+#ifndef _WIN32
if (WIFEXITED(status)) {
ds_put_format(&ds, "exit status %d", WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
@@ -293,6 +305,9 @@ process_status_msg(int status)
if (WCOREDUMP(status)) {
ds_put_cstr(&ds, ", core dumped");
}
+#else
+ ds_put_cstr(&ds, "function not supported.");
+#endif
return ds_cstr(&ds);
}
@@ -300,6 +315,7 @@ process_status_msg(int status)
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,15 @@ process_run(void)
void
process_wait(struct process *p)
{
+#ifndef _WIN32
if (p->exited) {
poll_immediate_wake();
} else {
poll_fd_wait(fds[0], POLLIN);
}
+#else
+ OVS_NOT_REACHED();
+#endif
}
char *