[ovs-dev] [PATCH v2 2/2] process: Make changes for Windows.

Gurucharan Shetty shettyg at nicira.com
Wed Feb 19 22:02:33 UTC 2014


On Wed, Feb 19, 2014 at 1:08 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Fri, Feb 14, 2014 at 03:15:48PM -0800, Gurucharan Shetty wrote:
>> 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>
>
> This makes process_status_msg() return a null pointer instead of a
> string.  That could cause problems for the caller (e.g. segfault).  I
> think it would be better to return a malloc()'d string for
> consistency.  (Probably doesn't matter but just in case.)
Okay.
>
> process_wait() could be implemented as OVS_NOT_REACHED() since after
> all it shouldn't be possible to get a valid "struct process *" on
> Windows.
Okay.
>
> Acked-by: Ben Pfaff <blp at nicira.com>

Thanks. I will add the following incremental and push it in a couple of hours.
diff --git a/lib/process.c b/lib/process.c
index fe93cd0..d0e1882 100644
--- a/lib/process.c
+++ b/lib/process.c
@@ -285,8 +285,8 @@ process_status(const struct process *p)
 char *
 process_status_msg(int status)
 {
-#ifndef _WIN32
     struct ds ds = DS_EMPTY_INITIALIZER;
+#ifndef _WIN32
     if (WIFEXITED(status)) {
         ds_put_format(&ds, "exit status %d", WEXITSTATUS(status));
     } else if (WIFSIGNALED(status)) {
@@ -305,10 +305,10 @@ process_status_msg(int status)
     if (WCOREDUMP(status)) {
         ds_put_cstr(&ds, ", core dumped");
     }
-    return ds_cstr(&ds);
 #else
-    return NULL;
+    ds_put_cstr(&ds, "function not supported.");
 #endif
+    return ds_cstr(&ds);
 }

 /* Executes periodic maintenance activities required by the process module. */
@@ -353,6 +353,8 @@ process_wait(struct process *p)
     } else {
         poll_fd_wait(fds[0], POLLIN);
     }
+#else
+    OVS_NOT_REACHED();
 #endif
 }



More information about the dev mailing list