[ovs-dev] [threads 07/11] Replace all uses of strerror() by ovs_strerror(), for thread safety.

Ben Pfaff blp at nicira.com
Wed Jun 19 20:17:08 UTC 2013


Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/daemon.c                 |   31 ++++++++++----------
 lib/dpif-linux.c             |    9 +++--
 lib/dpif-netdev.c            |    4 +-
 lib/dpif.c                   |   23 ++++++++-------
 lib/entropy.c                |    4 +-
 lib/fatal-signal.c           |    6 ++--
 lib/json.c                   |    5 ++-
 lib/jsonrpc.c                |    7 ++--
 lib/learning-switch.c        |    6 ++--
 lib/lockfile.c               |   11 ++++---
 lib/netdev-bsd.c             |   32 ++++++++++----------
 lib/netdev-dummy.c           |    5 ++-
 lib/netdev-linux.c           |   63 ++++++++++++++++++++++--------------------
 lib/netdev.c                 |   10 +++---
 lib/netlink-notifier.c       |    7 ++--
 lib/netlink-socket.c         |   26 ++++++++--------
 lib/ofp-errors.c             |   10 ++++--
 lib/ovs-thread.c             |    2 +-
 lib/poll-loop.c              |    4 +-
 lib/process.c                |    6 ++--
 lib/rconn.c                  |    8 +++--
 lib/reconnect.c              |    6 ++--
 lib/rtbsd.c                  |    8 ++--
 lib/sflow_agent.c            |    3 +-
 lib/signals.c                |    4 +-
 lib/socket-util.c            |   40 ++++++++++++++------------
 lib/stream-fd.c              |    4 +-
 lib/stream-ssl.c             |   19 ++++++------
 lib/stream-tcp.c             |    4 +-
 lib/stream-unix.c            |    7 ++--
 lib/timeval.c                |    6 ++--
 lib/unixctl.c                |    2 +-
 lib/util.c                   |    5 ++-
 lib/vconn-stream.c           |    6 ++--
 lib/vconn.c                  |    2 +-
 lib/vlandev.c                |    6 ++--
 lib/vlog.c                   |    4 +-
 lib/worker.c                 |    8 ++--
 ofproto/collectors.c         |    6 ++--
 ofproto/connmgr.c            |    6 ++--
 ofproto/in-band.c            |   12 ++++---
 ofproto/ofproto-dpif-sflow.c |    2 +-
 ofproto/ofproto-dpif.c       |   14 ++++----
 ofproto/ofproto.c            |   24 ++++++++--------
 ovsdb/jsonrpc-server.c       |    6 ++--
 ovsdb/ovsdb-server.c         |    7 ++--
 tests/test-netflow.c         |    2 +-
 tests/test-sflow.c           |    2 +-
 tests/test-vconn.c           |   12 ++++----
 utilities/ovs-controller.c   |    2 +-
 utilities/ovs-dpctl.c        |    8 ++--
 utilities/ovs-ofctl.c        |   10 +++---
 vswitchd/bridge.c            |   18 ++++++------
 vswitchd/ovs-vswitchd.c      |    4 +-
 vswitchd/system-stats.c      |   20 ++++++++-----
 vswitchd/xenserver.c         |    4 +-
 56 files changed, 300 insertions(+), 272 deletions(-)

diff --git a/lib/daemon.c b/lib/daemon.c
index 56b32b8..3c1e5c3 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -210,7 +210,7 @@ make_pidfile(void)
 
     file = fopen(tmpfile, "a+");
     if (!file) {
-        VLOG_FATAL("%s: create failed (%s)", tmpfile, strerror(errno));
+        VLOG_FATAL("%s: create failed (%s)", tmpfile, ovs_strerror(errno));
     }
 
     error = lock_pidfile(file, F_SETLK);
@@ -218,7 +218,8 @@ make_pidfile(void)
         /* Looks like we failed to acquire the lock.  Note that, if we failed
          * for some other reason (and '!overwrite_pidfile'), we will have
          * left 'tmpfile' as garbage in the file system. */
-        VLOG_FATAL("%s: fcntl(F_SETLK) failed (%s)", tmpfile, strerror(error));
+        VLOG_FATAL("%s: fcntl(F_SETLK) failed (%s)", tmpfile,
+                   ovs_strerror(error));
     }
 
     if (!overwrite_pidfile) {
@@ -229,16 +230,16 @@ make_pidfile(void)
     }
 
     if (fstat(fileno(file), &s) == -1) {
-        VLOG_FATAL("%s: fstat failed (%s)", tmpfile, strerror(errno));
+        VLOG_FATAL("%s: fstat failed (%s)", tmpfile, ovs_strerror(errno));
     }
 
     if (ftruncate(fileno(file), 0) == -1) {
-        VLOG_FATAL("%s: truncate failed (%s)", tmpfile, strerror(errno));
+        VLOG_FATAL("%s: truncate failed (%s)", tmpfile, ovs_strerror(errno));
     }
 
     fprintf(file, "%ld\n", pid);
     if (fflush(file) == EOF) {
-        VLOG_FATAL("%s: write failed (%s)", tmpfile, strerror(errno));
+        VLOG_FATAL("%s: write failed (%s)", tmpfile, ovs_strerror(errno));
     }
 
     error = rename(tmpfile, pidfile);
@@ -249,7 +250,7 @@ make_pidfile(void)
 
     if (error < 0) {
         VLOG_FATAL("failed to rename \"%s\" to \"%s\" (%s)",
-                   tmpfile, pidfile, strerror(errno));
+                   tmpfile, pidfile, ovs_strerror(errno));
     }
 
     /* Ensure that the pidfile will get deleted on exit. */
@@ -339,7 +340,7 @@ fork_and_wait_for_startup(int *fdp)
                                status_msg);
                 }
             } else if (retval < 0) {
-                VLOG_FATAL("waitpid failed (%s)", strerror(errno));
+                VLOG_FATAL("waitpid failed (%s)", ovs_strerror(errno));
             } else {
                 NOT_REACHED();
             }
@@ -364,7 +365,7 @@ fork_notify_startup(int fd)
 
         error = write_fully(fd, "", 1, &bytes_written);
         if (error) {
-            VLOG_FATAL("pipe write failed (%s)", strerror(error));
+            VLOG_FATAL("pipe write failed (%s)", ovs_strerror(error));
         }
 
         close(fd);
@@ -415,7 +416,7 @@ monitor_daemon(pid_t daemon_pid)
         } while (retval == -1 && errno == EINTR);
 
         if (retval == -1) {
-            VLOG_FATAL("waitpid failed (%s)", strerror(errno));
+            VLOG_FATAL("waitpid failed (%s)", ovs_strerror(errno));
         } else if (retval == daemon_pid) {
             char *s = process_status_msg(status);
             if (should_restart(status)) {
@@ -433,7 +434,7 @@ monitor_daemon(pid_t daemon_pid)
                     r.rlim_max = 0;
                     if (setrlimit(RLIMIT_CORE, &r) == -1) {
                         VLOG_WARN("failed to disable core dumps: %s",
-                                  strerror(errno));
+                                  ovs_strerror(errno));
                     }
                 }
 
@@ -641,13 +642,13 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
             return 0;
         }
         error = errno;
-        VLOG_WARN("%s: open: %s", pidfile, strerror(error));
+        VLOG_WARN("%s: open: %s", pidfile, ovs_strerror(error));
         goto error;
     }
 
     error = lock_pidfile__(file, F_GETLK, &lck);
     if (error) {
-        VLOG_WARN("%s: fcntl: %s", pidfile, strerror(error));
+        VLOG_WARN("%s: fcntl: %s", pidfile, ovs_strerror(error));
         goto error;
     }
     if (lck.l_type == F_UNLCK) {
@@ -686,7 +687,7 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
         if (unlink(pidfile)) {
             error = errno;
             VLOG_WARN("%s: failed to delete stale pidfile (%s)",
-                      pidfile, strerror(error));
+                      pidfile, ovs_strerror(error));
             goto error;
         }
         VLOG_DBG("%s: deleted stale pidfile", pidfile);
@@ -697,7 +698,7 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
     if (!fgets(line, sizeof line, file)) {
         if (ferror(file)) {
             error = errno;
-            VLOG_WARN("%s: read: %s", pidfile, strerror(error));
+            VLOG_WARN("%s: read: %s", pidfile, ovs_strerror(error));
         } else {
             error = ESRCH;
             VLOG_WARN("%s: read: unexpected end of file", pidfile);
@@ -743,6 +744,6 @@ check_already_running(void)
         VLOG_FATAL("%s: already running as pid %ld, aborting", pidfile, pid);
     } else if (pid < 0) {
         VLOG_FATAL("%s: pidfile check failed (%s), aborting",
-                   pidfile, strerror(-pid));
+                   pidfile, ovs_strerror(-pid));
     }
 }
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 1383b58..5327b0f 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -928,7 +928,8 @@ dpif_linux_flow_dump_next(const struct dpif *dpif_ OVS_UNUSED, void *state_,
             if (error == ENOENT) {
                 VLOG_DBG("dumped flow disappeared on get");
             } else if (error) {
-                VLOG_WARN("error fetching dumped flow: %s", strerror(error));
+                VLOG_WARN("error fetching dumped flow: %s",
+                          ovs_strerror(error));
             }
         }
     } while (error);
@@ -1195,7 +1196,7 @@ dpif_linux_recv_set(struct dpif *dpif_, bool enable)
             } else {
                 VLOG_WARN_RL(&error_rl,
                              "%s: failed to set upcall pid on port: %s",
-                             dpif_name(&dpif->dpif), strerror(error));
+                             dpif_name(&dpif->dpif), ovs_strerror(error));
                 nl_sock_destroy(sock);
 
                 if (error == ENODEV || error == ENOENT) {
@@ -1308,7 +1309,7 @@ dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall,
         } while (retval < 0 && errno == EINTR);
         if (retval < 0) {
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
-            VLOG_WARN_RL(&rl, "epoll_wait failed (%s)", strerror(errno));
+            VLOG_WARN_RL(&rl, "epoll_wait failed (%s)", ovs_strerror(errno));
         } else if (retval > 0) {
             dpif->n_events = retval;
         }
@@ -1479,7 +1480,7 @@ dpif_linux_is_internal_device(const char *name)
         ofpbuf_delete(buf);
     } else if (error != ENODEV && error != ENOENT) {
         VLOG_WARN_RL(&error_rl, "%s: vport query failed (%s)",
-                     name, strerror(error));
+                     name, ovs_strerror(error));
     }
 
     return reply.type == OVS_VPORT_TYPE_INTERNAL;
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 52aedb6..771f3b0 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -404,7 +404,7 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
     if (error
         && !(error == EOPNOTSUPP && dpif_netdev_class_is_dummy(dp->class))) {
         VLOG_ERR("%s: cannot receive packets on this network device (%s)",
-                 devname, strerror(errno));
+                 devname, ovs_strerror(errno));
         netdev_close(netdev);
         return error;
     }
@@ -1083,7 +1083,7 @@ dpif_netdev_run(struct dpif *dpif)
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
 
             VLOG_ERR_RL(&rl, "error receiving data from %s: %s",
-                        netdev_get_name(port->netdev), strerror(error));
+                        netdev_get_name(port->netdev), ovs_strerror(error));
         }
     }
     ofpbuf_uninit(&packet);
diff --git a/lib/dpif.c b/lib/dpif.c
index 6aa52d5..bcb4f65 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -215,7 +215,7 @@ dp_enumerate_names(const char *type, struct sset *names)
 
     if (error) {
         VLOG_WARN("failed to enumerate %s datapaths: %s", dpif_class->type,
-                   strerror(error));
+                   ovs_strerror(error));
     }
 
     return error;
@@ -310,10 +310,11 @@ dpif_create_and_open(const char *name, const char *type, struct dpif **dpifp)
         error = dpif_open(name, type, dpifp);
         if (error) {
             VLOG_WARN("datapath %s already exists but cannot be opened: %s",
-                      name, strerror(error));
+                      name, ovs_strerror(error));
         }
     } else if (error) {
-        VLOG_WARN("failed to create datapath %s: %s", name, strerror(error));
+        VLOG_WARN("failed to create datapath %s: %s",
+                  name, ovs_strerror(error));
     }
     return error;
 }
@@ -460,7 +461,7 @@ dpif_port_add(struct dpif *dpif, struct netdev *netdev, uint32_t *port_nop)
                     dpif_name(dpif), netdev_name, port_no);
     } else {
         VLOG_WARN_RL(&error_rl, "%s: failed to add %s as port: %s",
-                     dpif_name(dpif), netdev_name, strerror(error));
+                     dpif_name(dpif), netdev_name, ovs_strerror(error));
         port_no = UINT32_MAX;
     }
     if (port_nop) {
@@ -517,7 +518,7 @@ dpif_port_exists(const struct dpif *dpif, const char *devname)
     int error = dpif->dpif_class->port_query_by_name(dpif, devname, NULL);
     if (error != 0 && error != ENOENT && error != ENODEV) {
         VLOG_WARN_RL(&error_rl, "%s: failed to query port %s: %s",
-                     dpif_name(dpif), devname, strerror(error));
+                     dpif_name(dpif), devname, ovs_strerror(error));
     }
 
     return !error;
@@ -540,7 +541,7 @@ dpif_port_query_by_number(const struct dpif *dpif, uint32_t port_no,
     } else {
         memset(port, 0, sizeof *port);
         VLOG_WARN_RL(&error_rl, "%s: failed to query port %"PRIu32": %s",
-                     dpif_name(dpif), port_no, strerror(error));
+                     dpif_name(dpif), port_no, ovs_strerror(error));
     }
     return error;
 }
@@ -569,7 +570,7 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname,
         VLOG_RL(&error_rl,
                 error == ENOENT || error == ENODEV ? VLL_DBG : VLL_WARN,
                 "%s: failed to query port %s: %s",
-                dpif_name(dpif), devname, strerror(error));
+                dpif_name(dpif), devname, ovs_strerror(error));
     }
     return error;
 }
@@ -1243,7 +1244,7 @@ log_operation(const struct dpif *dpif, const char *operation, int error)
                      dpif_name(dpif), operation, ofperr_get_name(error));
     } else {
         VLOG_WARN_RL(&error_rl, "%s: %s failed (%s)",
-                     dpif_name(dpif), operation, strerror(error));
+                     dpif_name(dpif), operation, ovs_strerror(error));
     }
 }
 
@@ -1273,7 +1274,7 @@ log_flow_message(const struct dpif *dpif, int error, const char *operation,
     }
     ds_put_format(&ds, "%s ", operation);
     if (error) {
-        ds_put_format(&ds, "(%s) ", strerror(error));
+        ds_put_format(&ds, "(%s) ", ovs_strerror(error));
     }
     odp_flow_key_format(key, key_len, &ds);
     if (stats) {
@@ -1336,7 +1337,7 @@ log_execute_message(struct dpif *dpif, const struct dpif_execute *execute,
         ds_put_format(&ds, "%s: execute ", dpif_name(dpif));
         format_odp_actions(&ds, execute->actions, execute->actions_len);
         if (error) {
-            ds_put_format(&ds, " failed (%s)", strerror(error));
+            ds_put_format(&ds, " failed (%s)", ovs_strerror(error));
         }
         ds_put_format(&ds, " on packet %s", packet);
         vlog(THIS_MODULE, error ? VLL_WARN : VLL_DBG, "%s", ds_cstr(&ds));
diff --git a/lib/entropy.c b/lib/entropy.c
index c1f0886..02f56e0 100644
--- a/lib/entropy.c
+++ b/lib/entropy.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
+/* Copyright (c) 2008, 2009, 2010, 2011, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ get_entropy(void *buffer, size_t n)
 
     fd = open(urandom, O_RDONLY);
     if (fd < 0) {
-        VLOG_ERR("%s: open failed (%s)", urandom, strerror(errno));
+        VLOG_ERR("%s: open failed (%s)", urandom, ovs_strerror(errno));
         return errno ? errno : EINVAL;
     }
 
diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c
index 8c66ef5..1770457 100644
--- a/lib/fatal-signal.c
+++ b/lib/fatal-signal.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ fatal_signal_init(void)
             xsigaction(sig_nr, NULL, &old_sa);
             if (old_sa.sa_handler == SIG_DFL
                 && signal(sig_nr, fatal_signal_handler) == SIG_ERR) {
-                VLOG_FATAL("signal failed (%s)", strerror(errno));
+                VLOG_FATAL("signal failed (%s)", ovs_strerror(errno));
             }
         }
         atexit(atexit_handler);
@@ -238,7 +238,7 @@ fatal_signal_unlink_file_now(const char *file)
 {
     int error = unlink(file) ? errno : 0;
     if (error) {
-        VLOG_WARN("could not unlink \"%s\" (%s)", file, strerror(error));
+        VLOG_WARN("could not unlink \"%s\" (%s)", file, ovs_strerror(error));
     }
 
     fatal_signal_remove_file_to_unlink(file);
diff --git a/lib/json.c b/lib/json.c
index af385c6..56dc5ef 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -1026,7 +1026,8 @@ json_from_file(const char *file_name)
     stream = fopen(file_name, "r");
     if (!stream) {
         return json_string_create_nocopy(
-            xasprintf("error opening \"%s\": %s", file_name, strerror(errno)));
+            xasprintf("error opening \"%s\": %s", file_name,
+                      ovs_strerror(errno)));
     }
     json = json_from_stream(stream);
     fclose(stream);
@@ -1063,7 +1064,7 @@ json_from_stream(FILE *stream)
     if (ferror(stream)) {
         json_destroy(json);
         json = json_string_create_nocopy(
-            xasprintf("error reading JSON stream: %s", strerror(errno)));
+            xasprintf("error reading JSON stream: %s", ovs_strerror(errno)));
     }
 
     return json;
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
index 1ea5398..56b4cce 100644
--- a/lib/jsonrpc.c
+++ b/lib/jsonrpc.c
@@ -129,7 +129,7 @@ jsonrpc_run(struct jsonrpc *rpc)
         } else {
             if (retval != -EAGAIN) {
                 VLOG_WARN_RL(&rl, "%s: send error: %s",
-                             rpc->name, strerror(-retval));
+                             rpc->name, ovs_strerror(-retval));
                 jsonrpc_error(rpc, -retval);
             }
             break;
@@ -307,7 +307,7 @@ jsonrpc_recv(struct jsonrpc *rpc, struct jsonrpc_msg **msgp)
                     return EAGAIN;
                 } else {
                     VLOG_WARN_RL(&rl, "%s: receive error: %s",
-                                 rpc->name, strerror(-retval));
+                                 rpc->name, ovs_strerror(-retval));
                     jsonrpc_error(rpc, -retval);
                     return rpc->status;
                 }
@@ -1116,7 +1116,8 @@ jsonrpc_session_set_dscp(struct jsonrpc_session *s,
             error = pstream_set_dscp(s->pstream, dscp);
             if (error) {
                 VLOG_ERR("%s: failed set_dscp %s",
-                         reconnect_get_name(s->reconnect), strerror(error));
+                         reconnect_get_name(s->reconnect),
+                         ovs_strerror(error));
             }
             /*
              * XXX race window between setting dscp to listening socket
diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index ab37dcc..0a52d14 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -208,7 +208,7 @@ lswitch_handshake(struct lswitch *sw)
 
             if (error) {
                 VLOG_INFO_RL(&rl, "%s: failed to queue default flows (%s)",
-                             rconn_get_name(sw->rconn), strerror(error));
+                             rconn_get_name(sw->rconn), ovs_strerror(error));
             }
         } else {
             VLOG_INFO_RL(&rl, "%s: failed to set usable protocol",
@@ -433,7 +433,7 @@ queue_tx(struct lswitch *sw, struct ofpbuf *b)
         } else {
             VLOG_WARN_RL(&rl, "%016llx: %s: send: %s",
                          sw->datapath_id, rconn_get_name(sw->rconn),
-                         strerror(retval));
+                         ovs_strerror(retval));
         }
     }
 }
diff --git a/lib/lockfile.c b/lib/lockfile.c
index c37f332..14e553d 100644
--- a/lib/lockfile.c
+++ b/lib/lockfile.c
@@ -1,4 +1,4 @@
- /* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ /* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ lockfile_lock(const char *file, struct lockfile **lockfilep)
                       "pid %ld", lock_name, (long int) pid);
         } else {
             VLOG_WARN("%s: failed to lock file: %s",
-                      lock_name, strerror(error));
+                      lock_name, ovs_strerror(error));
         }
     }
 
@@ -225,7 +225,7 @@ lockfile_try_lock(const char *name, pid_t *pidp, struct lockfile **lockfilep)
         }
     } else if (errno != ENOENT) {
         VLOG_WARN("%s: failed to stat lock file: %s",
-                  name, strerror(errno));
+                  name, ovs_strerror(errno));
         return errno;
     }
 
@@ -233,13 +233,14 @@ lockfile_try_lock(const char *name, pid_t *pidp, struct lockfile **lockfilep)
     fd = open(name, O_RDWR | O_CREAT, 0600);
     if (fd < 0) {
         VLOG_WARN("%s: failed to open lock file: %s",
-                  name, strerror(errno));
+                  name, ovs_strerror(errno));
         return errno;
     }
 
     /* Get the inode and device number for the lock table. */
     if (fstat(fd, &s)) {
-        VLOG_ERR("%s: failed to fstat lock file: %s", name, strerror(errno));
+        VLOG_ERR("%s: failed to fstat lock file: %s",
+                 name, ovs_strerror(errno));
         close(fd);
         return errno;
     }
diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c
index 0fb0057..f2cf852 100644
--- a/lib/netdev-bsd.c
+++ b/lib/netdev-bsd.c
@@ -189,7 +189,7 @@ netdev_bsd_init(void)
     af_inet_sock = socket(AF_INET, SOCK_DGRAM, 0);
     status = af_inet_sock >= 0 ? 0 : errno;
     if (status) {
-        VLOG_ERR("failed to create inet socket: %s", strerror(status));
+        VLOG_ERR("failed to create inet socket: %s", ovs_strerror(status));
         return status;
     }
 
@@ -197,7 +197,7 @@ netdev_bsd_init(void)
     af_link_sock = socket(AF_LINK, SOCK_DGRAM, 0);
     status = af_link_sock >= 0 ? 0 : errno;
     if (status) {
-        VLOG_ERR("failed to create link socket: %s", strerror(status));
+        VLOG_ERR("failed to create link socket: %s", Ovs_strerror(status));
         close(af_inet_sock);
         af_inet_sock = -1;
     }
@@ -361,7 +361,7 @@ netdev_bsd_create_tap(const struct netdev_class *class, const char *name,
     netdev->change_seq = 1;
     if (netdev->tap_fd < 0) {
         error = errno;
-        VLOG_WARN("opening \"/dev/tap\" failed: %s", strerror(error));
+        VLOG_WARN("opening \"/dev/tap\" failed: %s", ovs_strerror(error));
         goto error_undef_notifier;
     }
 
@@ -482,7 +482,7 @@ netdev_bsd_open_pcap(const char *name, pcap_t **pcapp, int *fdp)
      * buffer becomes full or a timeout occurs. */
     if (ioctl(fd, BIOCIMMEDIATE, &one) < 0 ) {
         VLOG_ERR_RL(&rl, "ioctl(BIOCIMMEDIATE) on %s device failed: %s",
-                    name, strerror(errno));
+                    name, ovs_strerror(errno));
         error = errno;
         goto error;
     }
@@ -637,7 +637,7 @@ netdev_rx_bsd_recv_tap(struct netdev_rx_bsd *rx, void *data, size_t size)
         } else if (errno != EINTR) {
             if (errno != EAGAIN) {
                 VLOG_WARN_RL(&rl, "error receiving Ethernet packet on %s: %s",
-                             strerror(errno), netdev_rx_get_name(&rx->up));
+                             ovs_strerror(errno), netdev_rx_get_name(&rx->up));
             }
             return -errno;
         }
@@ -677,7 +677,7 @@ netdev_rx_bsd_drain(struct netdev_rx *rx_)
     strcpy(ifr.ifr_name, netdev_get_kernel_name(netdev_rx_get_netdev(rx_)));
     if (ioctl(rx->fd, BIOCFLUSH, &ifr) == -1) {
         VLOG_DBG_RL(&rl, "%s: ioctl(BIOCFLUSH) failed: %s",
-                    netdev_rx_get_name(rx_), strerror(errno));
+                    netdev_rx_get_name(rx_), ovs_strerror(errno));
         return errno;
     }
     return 0;
@@ -712,7 +712,7 @@ netdev_bsd_send(struct netdev *netdev_, const void *data, size_t size)
                 continue;
             } else if (errno != EAGAIN) {
                 VLOG_WARN_RL(&rl, "error sending Ethernet packet on %s: %s",
-                             name, strerror(errno));
+                             name, ovs_strerror(errno));
             }
             return errno;
         } else if (retval != size) {
@@ -845,7 +845,7 @@ netdev_bsd_get_carrier(const struct netdev *netdev_, bool *carrier)
 
         if (ioctl(af_inet_sock, SIOCGIFMEDIA, &ifmr) == -1) {
             VLOG_DBG_RL(&rl, "%s: ioctl(SIOCGIFMEDIA) failed: %s",
-                        netdev_get_name(netdev_), strerror(errno));
+                        netdev_get_name(netdev_), ovs_strerror(errno));
             return errno;
         }
 
@@ -913,7 +913,7 @@ netdev_bsd_get_stats(const struct netdev *netdev_, struct netdev_stats *stats)
 
     if (sysctl(mib, 5, &if_count, &len, (void *)0, 0) == -1) {
         VLOG_DBG_RL(&rl, "%s: sysctl failed: %s",
-                    netdev_get_name(netdev_), strerror(errno));
+                    netdev_get_name(netdev_), ovs_strerror(errno));
         return errno;
     }
 
@@ -924,7 +924,7 @@ netdev_bsd_get_stats(const struct netdev *netdev_, struct netdev_stats *stats)
         mib[4] = i; //row
         if (sysctl(mib, 6, &ifmd, &len, (void *)0, 0) == -1) {
             VLOG_DBG_RL(&rl, "%s: sysctl failed: %s",
-                        netdev_get_name(netdev_), strerror(errno));
+                        netdev_get_name(netdev_), ovs_strerror(errno));
             return errno;
         } else if (!strcmp(ifmd.ifmd_name, netdev_get_name(netdev_))) {
             convert_stats(stats, &ifmd.ifmd_data);
@@ -1053,7 +1053,7 @@ netdev_bsd_get_features(const struct netdev *netdev,
      * them. */
     if (ioctl(af_inet_sock, SIOCGIFMEDIA, &ifmr) == -1) {
         VLOG_DBG_RL(&rl, "%s: ioctl(SIOCGIFMEDIA) failed: %s",
-                    netdev_get_name(netdev), strerror(errno));
+                    netdev_get_name(netdev), ovs_strerror(errno));
         return errno;
     }
 
@@ -1069,7 +1069,7 @@ netdev_bsd_get_features(const struct netdev *netdev,
 
     if (ioctl(af_inet_sock, SIOCGIFMEDIA, &ifmr) == -1) {
         VLOG_DBG_RL(&rl, "%s: ioctl(SIOCGIFMEDIA) failed: %s",
-                    netdev_get_name(netdev), strerror(errno));
+                    netdev_get_name(netdev), ovs_strerror(errno));
         error = errno;
         goto cleanup;
     }
@@ -1168,7 +1168,7 @@ netdev_bsd_get_in6(const struct netdev *netdev_, struct in6_addr *in6)
 
         if (getifaddrs(&head) != 0) {
             VLOG_ERR("getifaddrs on %s device failed: %s", netdev_name,
-                    strerror(errno));
+                    ovs_strerror(errno));
             return errno;
         }
 
@@ -1593,7 +1593,7 @@ get_etheraddr(const char *netdev_name, uint8_t ea[ETH_ADDR_LEN])
 
     if (getifaddrs(&head) != 0) {
         VLOG_ERR("getifaddrs on %s device failed: %s", netdev_name,
-                strerror(errno));
+                ovs_strerror(errno));
         return errno;
     }
 
@@ -1630,7 +1630,7 @@ set_etheraddr(const char *netdev_name OVS_UNUSED, int hwaddr_family OVS_UNUSED,
     memcpy(ifr.ifr_addr.sa_data, mac, hwaddr_len);
     if (ioctl(af_inet_sock, SIOCSIFLLADDR, &ifr) < 0) {
         VLOG_ERR("ioctl(SIOCSIFLLADDR) on %s device failed: %s",
-                 netdev_name, strerror(errno));
+                 netdev_name, ovs_strerror(errno));
         return errno;
     }
     return 0;
@@ -1696,7 +1696,7 @@ netdev_bsd_do_ioctl(const char *name, struct ifreq *ifr, unsigned long cmd,
     strncpy(ifr->ifr_name, name, sizeof ifr->ifr_name);
     if (ioctl(af_inet_sock, cmd, ifr) == -1) {
         VLOG_DBG_RL(&rl, "%s: ioctl(%s) failed: %s", name, cmd_name,
-                    strerror(errno));
+                    ovs_strerror(errno));
         return errno;
     }
     return 0;
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 3e2187e..f431e51 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -129,7 +129,7 @@ netdev_dummy_run(void)
                 list_init(&s->txq);
             } else if (error != EAGAIN) {
                 VLOG_WARN("%s: accept failed (%s)",
-                          pstream_get_name(dev->pstream), strerror(error));
+                          pstream_get_name(dev->pstream), ovs_strerror(error));
                 pstream_close(dev->pstream);
                 dev->pstream = NULL;
             }
@@ -322,7 +322,8 @@ netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
 
             error = pstream_open(pstream, &netdev->pstream, DSCP_DEFAULT);
             if (error) {
-                VLOG_WARN("%s: open failed (%s)", pstream, strerror(error));
+                VLOG_WARN("%s: open failed (%s)",
+                          pstream, ovs_strerror(error));
             }
         }
     }
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 014c579..8790f14 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -475,7 +475,7 @@ netdev_linux_init(void)
         af_inet_sock = socket(AF_INET, SOCK_DGRAM, 0);
         status = af_inet_sock >= 0 ? 0 : errno;
         if (status) {
-            VLOG_ERR("failed to create inet socket: %s", strerror(status));
+            VLOG_ERR("failed to create inet socket: %s", ovs_strerror(status));
         }
 
         /* Create rtnetlink socket. */
@@ -483,7 +483,7 @@ netdev_linux_init(void)
             status = nl_sock_create(NETLINK_ROUTE, &rtnl_sock);
             if (status) {
                 VLOG_ERR_RL(&rl, "failed to create rtnetlink socket: %s",
-                            strerror(status));
+                            ovs_strerror(status));
             }
         }
     }
@@ -672,7 +672,7 @@ netdev_linux_create_tap(const struct netdev_class *class OVS_UNUSED,
     state->fd = open(tap_dev, O_RDWR);
     if (state->fd < 0) {
         error = errno;
-        VLOG_WARN("opening \"%s\" failed: %s", tap_dev, strerror(error));
+        VLOG_WARN("opening \"%s\" failed: %s", tap_dev, ovs_strerror(error));
         goto error_unref_notifier;
     }
 
@@ -681,7 +681,7 @@ netdev_linux_create_tap(const struct netdev_class *class OVS_UNUSED,
     ovs_strzcpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
     if (ioctl(state->fd, TUNSETIFF, &ifr) == -1) {
         VLOG_WARN("%s: creating tap device failed: %s", name,
-                  strerror(errno));
+                  ovs_strerror(errno));
         error = errno;
         goto error_unref_notifier;
     }
@@ -758,7 +758,7 @@ netdev_linux_rx_open(struct netdev *netdev_, struct netdev_rx **rxp)
         fd = socket(PF_PACKET, SOCK_RAW, 0);
         if (fd < 0) {
             error = errno;
-            VLOG_ERR("failed to create raw socket (%s)", strerror(error));
+            VLOG_ERR("failed to create raw socket (%s)", ovs_strerror(error));
             goto error;
         }
 
@@ -782,7 +782,7 @@ netdev_linux_rx_open(struct netdev *netdev_, struct netdev_rx **rxp)
         if (bind(fd, (struct sockaddr *) &sll, sizeof sll) < 0) {
             error = errno;
             VLOG_ERR("%s: failed to bind raw socket (%s)",
-                     netdev_get_name(netdev_), strerror(error));
+                     netdev_get_name(netdev_), ovs_strerror(error));
             goto error;
         }
 
@@ -792,7 +792,7 @@ netdev_linux_rx_open(struct netdev *netdev_, struct netdev_rx **rxp)
         if (error) {
             error = errno;
             VLOG_ERR("%s: failed attach filter (%s)",
-                     netdev_get_name(netdev_), strerror(error));
+                     netdev_get_name(netdev_), ovs_strerror(error));
             goto error;
         }
     }
@@ -842,7 +842,7 @@ netdev_rx_linux_recv(struct netdev_rx *rx_, void *data, size_t size)
     } else {
         if (errno != EAGAIN) {
             VLOG_WARN_RL(&rl, "error receiving Ethernet packet on %s: %s",
-                         strerror(errno), netdev_rx_get_name(rx_));
+                         ovs_strerror(errno), netdev_rx_get_name(rx_));
         }
         return -errno;
     }
@@ -946,7 +946,7 @@ netdev_linux_send(struct netdev *netdev_, const void *data, size_t size)
                 continue;
             } else if (errno != EAGAIN) {
                 VLOG_WARN_RL(&rl, "error sending Ethernet packet on %s: %s",
-                             netdev_get_name(netdev_), strerror(errno));
+                             netdev_get_name(netdev_), ovs_strerror(errno));
             }
             return errno;
         } else if (retval != size) {
@@ -1263,7 +1263,7 @@ check_for_working_netlink_stats(void)
         } else {
             VLOG_INFO("RTM_GETLINK failed (%s), obtaining netdev stats "
                       "via proc (you are probably running a pre-2.6.19 "
-                      "kernel)", strerror(error));
+                      "kernel)", ovs_strerror(error));
             return false;
         }
     }
@@ -1342,7 +1342,8 @@ get_stats_via_vport(const struct netdev *netdev_,
         error = get_stats_via_vport__(netdev_, stats);
         if (error && error != ENOENT) {
             VLOG_WARN_RL(&rl, "%s: obtaining netdev stats via vport failed "
-                         "(%s)", netdev_get_name(netdev_), strerror(error));
+                         "(%s)",
+                         netdev_get_name(netdev_), ovs_strerror(error));
         }
         netdev->vport_stats_error = error;
         netdev->cache_valid |= VALID_VPORT_STAT_ERROR;
@@ -1777,7 +1778,7 @@ netdev_linux_set_policing(struct netdev *netdev_,
     error = tc_add_del_ingress_qdisc(netdev_, false);
     if (error) {
         VLOG_WARN_RL(&rl, "%s: removing policing failed: %s",
-                     netdev_name, strerror(error));
+                     netdev_name, ovs_strerror(error));
         goto out;
     }
 
@@ -1785,14 +1786,14 @@ netdev_linux_set_policing(struct netdev *netdev_,
         error = tc_add_del_ingress_qdisc(netdev_, true);
         if (error) {
             VLOG_WARN_RL(&rl, "%s: adding policing qdisc failed: %s",
-                         netdev_name, strerror(error));
+                         netdev_name, ovs_strerror(error));
             goto out;
         }
 
         error = tc_add_policer(netdev_, kbits_rate, kbits_burst);
         if (error){
             VLOG_WARN_RL(&rl, "%s: adding policing action failed: %s",
-                    netdev_name, strerror(error));
+                    netdev_name, ovs_strerror(error));
             goto out;
         }
     }
@@ -2235,7 +2236,7 @@ netdev_linux_add_router(struct netdev *netdev OVS_UNUSED, struct in_addr router)
     rt.rt_flags = RTF_UP | RTF_GATEWAY;
     error = ioctl(af_inet_sock, SIOCADDRT, &rt) < 0 ? errno : 0;
     if (error) {
-        VLOG_WARN("ioctl(SIOCADDRT): %s", strerror(error));
+        VLOG_WARN("ioctl(SIOCADDRT): %s", ovs_strerror(error));
     }
     return error;
 }
@@ -2252,7 +2253,7 @@ netdev_linux_get_next_hop(const struct in_addr *host, struct in_addr *next_hop,
     *netdev_name = NULL;
     stream = fopen(fn, "r");
     if (stream == NULL) {
-        VLOG_WARN_RL(&rl, "%s: open failed: %s", fn, strerror(errno));
+        VLOG_WARN_RL(&rl, "%s: open failed: %s", fn, ovs_strerror(errno));
         return errno;
     }
 
@@ -2364,7 +2365,8 @@ netdev_linux_arp_lookup(const struct netdev *netdev,
         memcpy(mac, r.arp_ha.sa_data, ETH_ADDR_LEN);
     } else if (retval != ENXIO) {
         VLOG_WARN_RL(&rl, "%s: could not look up ARP entry for "IP_FMT": %s",
-                     netdev_get_name(netdev), IP_ARGS(ip), strerror(retval));
+                     netdev_get_name(netdev), IP_ARGS(ip),
+                     ovs_strerror(retval));
     }
     return retval;
 }
@@ -2633,7 +2635,7 @@ htb_setup_class__(struct netdev *netdev, unsigned int handle,
                      tc_get_major(handle), tc_get_minor(handle),
                      tc_get_major(parent), tc_get_minor(parent),
                      class->min_rate, class->max_rate,
-                     class->burst, class->priority, strerror(error));
+                     class->burst, class->priority, ovs_strerror(error));
     }
     return error;
 }
@@ -3293,7 +3295,7 @@ hfsc_setup_class__(struct netdev *netdev, unsigned int handle,
                      netdev_get_name(netdev),
                      tc_get_major(handle), tc_get_minor(handle),
                      tc_get_major(parent), tc_get_minor(parent),
-                     class->min_rate, class->max_rate, strerror(error));
+                     class->min_rate, class->max_rate, ovs_strerror(error));
     }
 
     return error;
@@ -3798,7 +3800,7 @@ read_psched(void)
 
     stream = fopen(fn, "r");
     if (!stream) {
-        VLOG_WARN("%s: open failed: %s", fn, strerror(errno));
+        VLOG_WARN("%s: open failed: %s", fn, ovs_strerror(errno));
         return;
     }
 
@@ -4002,7 +4004,7 @@ tc_query_class(const struct netdev *netdev,
                      netdev_get_name(netdev),
                      tc_get_major(handle), tc_get_minor(handle),
                      tc_get_major(parent), tc_get_minor(parent),
-                     strerror(error));
+                     ovs_strerror(error));
     }
     return error;
 }
@@ -4027,7 +4029,7 @@ tc_delete_class(const struct netdev *netdev, unsigned int handle)
         VLOG_WARN_RL(&rl, "delete %s class %u:%u failed (%s)",
                      netdev_get_name(netdev),
                      tc_get_major(handle), tc_get_minor(handle),
-                     strerror(error));
+                     ovs_strerror(error));
     }
     return error;
 }
@@ -4127,7 +4129,7 @@ tc_query_qdisc(const struct netdev *netdev_)
     } else {
         /* Who knows?  Maybe the device got deleted. */
         VLOG_WARN_RL(&rl, "query %s qdisc failed (%s)",
-                     netdev_get_name(netdev_), strerror(error));
+                     netdev_get_name(netdev_), ovs_strerror(error));
         ops = &tc_ops_other;
     }
 
@@ -4356,7 +4358,7 @@ get_stats_via_proc(const char *netdev_name, struct netdev_stats *stats)
 
     stream = fopen(fn, "r");
     if (!stream) {
-        VLOG_WARN_RL(&rl, "%s: open failed: %s", fn, strerror(errno));
+        VLOG_WARN_RL(&rl, "%s: open failed: %s", fn, ovs_strerror(errno));
         return errno;
     }
 
@@ -4436,7 +4438,7 @@ do_get_ifindex(const char *netdev_name)
     COVERAGE_INC(netdev_get_ifindex);
     if (ioctl(af_inet_sock, SIOCGIFINDEX, &ifr) < 0) {
         VLOG_WARN_RL(&rl, "ioctl(SIOCGIFINDEX) on %s device failed: %s",
-                     netdev_name, strerror(errno));
+                     netdev_name, ovs_strerror(errno));
         return -errno;
     }
     return ifr.ifr_ifindex;
@@ -4479,7 +4481,7 @@ get_etheraddr(const char *netdev_name, uint8_t ea[ETH_ADDR_LEN])
          * to INFO for that case. */
         VLOG(errno == ENODEV ? VLL_INFO : VLL_ERR,
              "ioctl(SIOCGIFHWADDR) on %s device failed: %s",
-             netdev_name, strerror(errno));
+             netdev_name, ovs_strerror(errno));
         return errno;
     }
     hwaddr_family = ifr.ifr_hwaddr.sa_family;
@@ -4504,7 +4506,7 @@ set_etheraddr(const char *netdev_name,
     COVERAGE_INC(netdev_set_hwaddr);
     if (ioctl(af_inet_sock, SIOCSIFHWADDR, &ifr) < 0) {
         VLOG_ERR("ioctl(SIOCSIFHWADDR) on %s device failed: %s",
-                 netdev_name, strerror(errno));
+                 netdev_name, ovs_strerror(errno));
         return errno;
     }
     return 0;
@@ -4526,7 +4528,7 @@ netdev_linux_do_ethtool(const char *name, struct ethtool_cmd *ecmd,
     } else {
         if (errno != EOPNOTSUPP) {
             VLOG_WARN_RL(&rl, "ethtool command %s on network device %s "
-                         "failed: %s", cmd_name, name, strerror(errno));
+                         "failed: %s", cmd_name, name, ovs_strerror(errno));
         } else {
             /* The device doesn't support this operation.  That's pretty
              * common, so there's no point in logging anything. */
@@ -4542,7 +4544,7 @@ netdev_linux_do_ioctl(const char *name, struct ifreq *ifr, int cmd,
     ovs_strzcpy(ifr->ifr_name, name, sizeof ifr->ifr_name);
     if (ioctl(af_inet_sock, cmd, ifr) == -1) {
         VLOG_DBG_RL(&rl, "%s: ioctl(%s) failed: %s", name, cmd_name,
-                     strerror(errno));
+                     ovs_strerror(errno));
         return errno;
     }
     return 0;
@@ -4580,7 +4582,8 @@ af_packet_sock(void)
             }
         } else {
             sock = -errno;
-            VLOG_ERR("failed to create packet socket: %s", strerror(errno));
+            VLOG_ERR("failed to create packet socket: %s",
+                     ovs_strerror(errno));
         }
     }
 
diff --git a/lib/netdev.c b/lib/netdev.c
index 653f5bc..651ea3f 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -139,7 +139,7 @@ netdev_register_provider(const struct netdev_class *new_class)
         int error = new_class->init();
         if (error) {
             VLOG_ERR("failed to initialize %s network device class: %s",
-                     new_class->type, strerror(error));
+                     new_class->type, ovs_strerror(error));
             return error;
         }
     }
@@ -523,7 +523,7 @@ netdev_get_mtu(const struct netdev *netdev, int *mtup)
         *mtup = 0;
         if (error != EOPNOTSUPP) {
             VLOG_DBG_RL(&rl, "failed to retrieve MTU for network device %s: "
-                         "%s", netdev_get_name(netdev), strerror(error));
+                         "%s", netdev_get_name(netdev), ovs_strerror(error));
         }
     }
     return error;
@@ -544,7 +544,7 @@ netdev_set_mtu(const struct netdev *netdev, int mtu)
     error = class->set_mtu ? class->set_mtu(netdev, mtu) : EOPNOTSUPP;
     if (error && error != EOPNOTSUPP) {
         VLOG_DBG_RL(&rl, "failed to set MTU for network device %s: %s",
-                     netdev_get_name(netdev), strerror(error));
+                     netdev_get_name(netdev), ovs_strerror(error));
     }
 
     return error;
@@ -822,7 +822,7 @@ do_update_flags(struct netdev *netdev, enum netdev_flags off,
     if (error) {
         VLOG_WARN_RL(&rl, "failed to %s flags for network device %s: %s",
                      off || on ? "set" : "get", netdev_get_name(netdev),
-                     strerror(error));
+                     ovs_strerror(error));
         old_flags = 0;
     } else if ((off || on) && sfp) {
         enum netdev_flags new_flags = (old_flags & ~off) | on;
@@ -953,7 +953,7 @@ netdev_get_carrier(const struct netdev *netdev)
                                                               &carrier);
     if (error) {
         VLOG_DBG("%s: failed to get network device carrier status, assuming "
-                 "down: %s", netdev_get_name(netdev), strerror(error));
+                 "down: %s", netdev_get_name(netdev), ovs_strerror(error));
         carrier = false;
     }
 
diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c
index 1e1a317..9aa185d 100644
--- a/lib/netlink-notifier.c
+++ b/lib/netlink-notifier.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -115,7 +115,8 @@ nln_notifier_create(struct nln *nln, nln_notify_func *cb, void *aux)
         }
         if (error) {
             nl_sock_destroy(sock);
-            VLOG_WARN("could not create netlink socket: %s", strerror(error));
+            VLOG_WARN("could not create netlink socket: %s",
+                      ovs_strerror(error));
             return NULL;
         }
         nln->notify_sock = sock;
@@ -184,7 +185,7 @@ nln_run(struct nln *nln)
                 VLOG_WARN_RL(&rl, "netlink receive buffer overflowed");
             } else {
                 VLOG_WARN_RL(&rl, "error reading netlink socket: %s",
-                             strerror(error));
+                             ovs_strerror(error));
             }
             nln_report(nln, NULL);
         }
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index fbb1724..dfe39ac 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -99,7 +99,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
         max_iovs = sysconf(_SC_UIO_MAXIOV);
         if (max_iovs < _XOPEN_IOV_MAX) {
             if (max_iovs == -1 && errno) {
-                VLOG_WARN("sysconf(_SC_UIO_MAXIOV): %s", strerror(errno));
+                VLOG_WARN("sysconf(_SC_UIO_MAXIOV): %s", ovs_strerror(errno));
             }
             max_iovs = _XOPEN_IOV_MAX;
         } else if (max_iovs > MAX_IOVS) {
@@ -114,7 +114,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
 
     sock->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
     if (sock->fd < 0) {
-        VLOG_ERR("fcntl: %s", strerror(errno));
+        VLOG_ERR("fcntl: %s", ovs_strerror(errno));
         goto error;
     }
     sock->protocol = protocol;
@@ -128,7 +128,7 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
          * Warn only if the failure is therefore unexpected. */
         if (errno != EPERM) {
             VLOG_WARN_RL(&rl, "setting %d-byte socket receive buffer failed "
-                         "(%s)", rcvbuf, strerror(errno));
+                         "(%s)", rcvbuf, ovs_strerror(errno));
         }
     }
 
@@ -144,14 +144,14 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
     remote.nl_family = AF_NETLINK;
     remote.nl_pid = 0;
     if (connect(sock->fd, (struct sockaddr *) &remote, sizeof remote) < 0) {
-        VLOG_ERR("connect(0): %s", strerror(errno));
+        VLOG_ERR("connect(0): %s", ovs_strerror(errno));
         goto error;
     }
 
     /* Obtain pid assigned by kernel. */
     local_size = sizeof local;
     if (getsockname(sock->fd, (struct sockaddr *) &local, &local_size) < 0) {
-        VLOG_ERR("getsockname: %s", strerror(errno));
+        VLOG_ERR("getsockname: %s", ovs_strerror(errno));
         goto error;
     }
     if (local_size < sizeof local || local.nl_family != AF_NETLINK) {
@@ -222,7 +222,7 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned int multicast_group)
     if (setsockopt(sock->fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
                    &multicast_group, sizeof multicast_group) < 0) {
         VLOG_WARN("could not join multicast group %u (%s)",
-                  multicast_group, strerror(errno));
+                  multicast_group, ovs_strerror(errno));
         return errno;
     }
     return 0;
@@ -245,7 +245,7 @@ nl_sock_leave_mcgroup(struct nl_sock *sock, unsigned int multicast_group)
     if (setsockopt(sock->fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP,
                    &multicast_group, sizeof multicast_group) < 0) {
         VLOG_WARN("could not leave multicast group %u (%s)",
-                  multicast_group, strerror(errno));
+                  multicast_group, ovs_strerror(errno));
         return errno;
     }
     return 0;
@@ -527,7 +527,7 @@ nl_sock_transact_multiple__(struct nl_sock *sock,
             }
             if (txn->error) {
                 VLOG_DBG_RL(&rl, "received NAK error=%d (%s)",
-                            error, strerror(txn->error));
+                            error, ovs_strerror(txn->error));
             }
         } else {
             txn->error = 0;
@@ -629,7 +629,7 @@ nl_sock_transact_multiple(struct nl_sock *sock,
         if (error == ENOBUFS) {
             VLOG_DBG_RL(&rl, "receive buffer overflow, resending request");
         } else if (error) {
-            VLOG_ERR_RL(&rl, "transaction error (%s)", strerror(error));
+            VLOG_ERR_RL(&rl, "transaction error (%s)", ovs_strerror(error));
             nl_sock_record_errors__(transactions, n, error);
         }
     }
@@ -815,7 +815,7 @@ nl_dump_recv(struct nl_dump *dump)
 
     if (nl_msg_nlmsgerr(&dump->buffer, &retval)) {
         VLOG_INFO_RL(&rl, "netlink dump request error (%s)",
-                     strerror(retval));
+                     ovs_strerror(retval));
         return retval && retval != EAGAIN ? retval : EPROTO;
     }
 
@@ -1187,7 +1187,7 @@ nlmsg_to_string(const struct ofpbuf *buffer, int protocol)
             if (e) {
                 ds_put_format(&ds, " error(%d", e->error);
                 if (e->error < 0) {
-                    ds_put_format(&ds, "(%s)", strerror(-e->error));
+                    ds_put_format(&ds, "(%s)", ovs_strerror(-e->error));
                 }
                 ds_put_cstr(&ds, ", in-reply-to(");
                 nlmsghdr_to_string(&e->msg, protocol, &ds);
@@ -1200,7 +1200,7 @@ nlmsg_to_string(const struct ofpbuf *buffer, int protocol)
             if (error) {
                 ds_put_format(&ds, " done(%d", *error);
                 if (*error < 0) {
-                    ds_put_format(&ds, "(%s)", strerror(-*error));
+                    ds_put_format(&ds, "(%s)", ovs_strerror(-*error));
                 }
                 ds_put_cstr(&ds, ")");
             } else {
@@ -1232,6 +1232,6 @@ log_nlmsg(const char *function, int error,
 
     ofpbuf_use_const(&buffer, message, size);
     nlmsg = nlmsg_to_string(&buffer, protocol);
-    VLOG_DBG_RL(&rl, "%s (%s): %s", function, strerror(error), nlmsg);
+    VLOG_DBG_RL(&rl, "%s (%s): %s", function, ovs_strerror(error), nlmsg);
     free(nlmsg);
 }
diff --git a/lib/ofp-errors.c b/lib/ofp-errors.c
index 74a3358..2e3312e 100644
--- a/lib/ofp-errors.c
+++ b/lib/ofp-errors.c
@@ -152,7 +152,7 @@ ofperr_encode_msg__(enum ofperr error, enum ofp_version ofp_version,
     if (!ofperr_is_valid(error)) {
         /* 'error' seems likely to be a system errno value. */
         VLOG_ERR_RL(&rl, "invalid OpenFlow error code %d (%s)",
-                    error, strerror(error));
+                    error, ovs_strerror(error));
         error = OFPERR_NXBRC_UNENCODABLE_ERROR;
     } else if (domain->errors[error - OFPERR_OFS].code < 0) {
         VLOG_ERR_RL(&rl, "cannot encode %s for %s",
@@ -304,10 +304,12 @@ ofperr_decode_msg(const struct ofp_header *oh, struct ofpbuf *payload)
 
 /* If 'error' is a valid OFPERR_* value, returns its name
  * (e.g. "OFPBRC_BAD_TYPE" for OFPBRC_BAD_TYPE).  Otherwise, assumes that
- * 'error' is a positive errno value and returns what strerror() produces for
- * 'error'.  */
+ * 'error' is a positive errno value and returns what ovs_strerror() produces
+ * for 'error'.  */
 const char *
 ofperr_to_string(enum ofperr error)
 {
-    return ofperr_is_valid(error) ? ofperr_get_name(error) : strerror(error);
+    return (ofperr_is_valid(error)
+            ? ofperr_get_name(error)
+            : ovs_strerror(error));
 }
diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index 56303f7..df4552c 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -170,7 +170,7 @@ pid_t
 
     pid = fork();
     if (pid < 0) {
-        VLOG_FATAL("fork failed (%s)", strerror(errno));
+        VLOG_FATAL("fork failed (%s)", ovs_strerror(errno));
     }
     return pid;
 }
diff --git a/lib/poll-loop.c b/lib/poll-loop.c
index 9855306..ea00d26 100644
--- a/lib/poll-loop.c
+++ b/lib/poll-loop.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -249,7 +249,7 @@ poll_block(void)
     retval = time_poll(pollfds, n_pollfds, timeout_when, &elapsed);
     if (retval < 0) {
         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-        VLOG_ERR_RL(&rl, "poll: %s", strerror(-retval));
+        VLOG_ERR_RL(&rl, "poll: %s", ovs_strerror(-retval));
     } else if (!retval) {
         log_wakeup(timeout_where, NULL, elapsed);
     }
diff --git a/lib/process.c b/lib/process.c
index 266c90b..143347c 100644
--- a/lib/process.c
+++ b/lib/process.c
@@ -193,7 +193,7 @@ process_start(char **argv, struct process **pp)
 
     pid = fork();
     if (pid < 0) {
-        VLOG_WARN("fork failed: %s", strerror(errno));
+        VLOG_WARN("fork failed: %s", ovs_strerror(errno));
         return errno;
     } else if (pid) {
         /* Running in parent process. */
@@ -210,7 +210,7 @@ process_start(char **argv, struct process **pp)
         }
         execvp(argv[0], argv);
         fprintf(stderr, "execvp(\"%s\") failed: %s\n",
-                argv[0], strerror(errno));
+                argv[0], ovs_strerror(errno));
         _exit(1);
     }
 }
@@ -316,7 +316,7 @@ process_run(void)
                     p->exited = true;
                     p->status = status;
                 } else if (retval < 0) {
-                    VLOG_WARN("waitpid: %s", strerror(errno));
+                    VLOG_WARN("waitpid: %s", ovs_strerror(errno));
                     p->exited = true;
                     p->status = -1;
                 }
diff --git a/lib/rconn.c b/lib/rconn.c
index 4922a5c..fa3d308 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -379,7 +379,8 @@ reconnect(struct rconn *rc)
         rc->backoff_deadline = time_now() + rc->backoff;
         state_transition(rc, S_CONNECTING);
     } else {
-        VLOG_WARN("%s: connection failed (%s)", rc->name, strerror(retval));
+        VLOG_WARN("%s: connection failed (%s)",
+                  rc->name, ovs_strerror(retval));
         rc->backoff_deadline = TIME_MAX; /* Prevent resetting backoff. */
         disconnect(rc, retval);
     }
@@ -417,7 +418,7 @@ run_CONNECTING(struct rconn *rc)
     } else if (retval != EAGAIN) {
         if (rconn_logging_connection_attempts__(rc)) {
             VLOG_INFO("%s: connection failed (%s)",
-                      rc->name, strerror(retval));
+                      rc->name, ovs_strerror(retval));
         }
         disconnect(rc, retval);
     } else if (timed_out(rc)) {
@@ -962,7 +963,8 @@ report_error(struct rconn *rc, int error)
         enum vlog_level level = rc->reliable ? VLL_INFO : VLL_DBG;
         VLOG(level, "%s: connection closed by peer", rc->name);
     } else {
-        VLOG_WARN("%s: connection dropped (%s)", rc->name, strerror(error));
+        VLOG_WARN("%s: connection dropped (%s)",
+                  rc->name, ovs_strerror(error));
     }
 }
 
diff --git a/lib/reconnect.c b/lib/reconnect.c
index b914ef6..fae35b1 100644
--- a/lib/reconnect.c
+++ b/lib/reconnect.c
@@ -331,7 +331,7 @@ reconnect_disconnected(struct reconnect *fsm, long long int now, int error)
         if (fsm->state & (S_ACTIVE | S_IDLE)) {
             if (error > 0) {
                 VLOG_WARN("%s: connection dropped (%s)",
-                          fsm->name, strerror(error));
+                          fsm->name, ovs_strerror(error));
             } else if (error == EOF) {
                 VLOG(fsm->info, "%s: connection closed by peer", fsm->name);
             } else {
@@ -340,7 +340,7 @@ reconnect_disconnected(struct reconnect *fsm, long long int now, int error)
         } else if (fsm->state == S_LISTENING) {
             if (error > 0) {
                 VLOG_WARN("%s: error listening for connections (%s)",
-                          fsm->name, strerror(error));
+                          fsm->name, ovs_strerror(error));
             } else {
                 VLOG(fsm->info, "%s: error listening for connections",
                      fsm->name);
@@ -349,7 +349,7 @@ reconnect_disconnected(struct reconnect *fsm, long long int now, int error)
             const char *type = fsm->passive ? "listen" : "connection";
             if (error > 0) {
                 VLOG_WARN("%s: %s attempt failed (%s)",
-                          fsm->name, type, strerror(error));
+                          fsm->name, type, ovs_strerror(error));
             } else {
                 VLOG(fsm->info, "%s: %s attempt timed out", fsm->name, type);
             }
diff --git a/lib/rtbsd.c b/lib/rtbsd.c
index c5fe03a..b706c20 100644
--- a/lib/rtbsd.c
+++ b/lib/rtbsd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Gaetano Catalli.
+ * Copyright (c) 2011, 2013 Gaetano Catalli.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,13 +55,13 @@ rtbsd_notifier_register(struct rtbsd_notifier *notifier,
         notify_sock = socket(PF_ROUTE, SOCK_RAW, 0);
         if (notify_sock < 0) {
             VLOG_WARN("could not create PF_ROUTE socket: %s",
-                      strerror(errno));
+                      ovs_strerror(errno));
             return errno;
         }
         error = set_nonblocking(notify_sock);
         if (error) {
             VLOG_WARN("error set_nonblocking PF_ROUTE socket: %s",
-                    strerror(error));
+                    ovs_strerror(error));
             return error;
         }
     } else {
@@ -120,7 +120,7 @@ rtbsd_notifier_run(void)
                 VLOG_WARN_RL(&rl, "PF_ROUTE receive buffer overflowed");
             } else {
                 VLOG_WARN_RL(&rl, "error reading PF_ROUTE socket: %s",
-                             strerror(errno));
+                             ovs_strerror(errno));
             }
             rtbsd_report_notify_error();
         }
diff --git a/lib/sflow_agent.c b/lib/sflow_agent.c
index f55e6d4..817420d 100644
--- a/lib/sflow_agent.c
+++ b/lib/sflow_agent.c
@@ -6,6 +6,7 @@
  */
 
 #include "sflow_api.h"
+#include "util.h"
 
 static void * sflAlloc(SFLAgent *agent, size_t bytes);
 static void sflFree(SFLAgent *agent, void *obj);
@@ -469,7 +470,7 @@ void sfl_agent_error(SFLAgent *agent, char *modName, char *msg)
 void sfl_agent_sysError(SFLAgent *agent, char *modName, char *msg)
 {
     char errm[MAX_ERRMSG_LEN];
-    snprintf(errm, sizeof errm, "sfl_agent_sysError: %s: %s (errno = %d - %s)\n", modName, msg, errno, strerror(errno));
+    snprintf(errm, sizeof errm, "sfl_agent_sysError: %s: %s (errno = %d - %s)\n", modName, msg, errno, ovs_strerror(errno));
     if(agent->errorFn) (*agent->errorFn)(agent->magic, agent, errm);
     else {
 	fprintf(stderr, "%s\n", errm);
diff --git a/lib/signals.c b/lib/signals.c
index 1340f54..f11ed05 100644
--- a/lib/signals.c
+++ b/lib/signals.c
@@ -130,7 +130,7 @@ xsigaction(int signum, const struct sigaction *new, struct sigaction *old)
 
         VLOG_FATAL("sigaction(%s) failed (%s)",
                    signal_name(signum, namebuf, sizeof namebuf),
-                   strerror(errno));
+                   ovs_strerror(errno));
     }
 }
 
@@ -139,6 +139,6 @@ xpthread_sigmask(int how, const sigset_t *new, sigset_t *old)
 {
     int error = pthread_sigmask(how, new, old);
     if (error) {
-        VLOG_FATAL("pthread_sigmask failed (%s)", strerror(error));
+        VLOG_FATAL("pthread_sigmask failed (%s)", ovs_strerror(error));
     }
 }
diff --git a/lib/socket-util.c b/lib/socket-util.c
index 2dff9f5..fa55480 100644
--- a/lib/socket-util.c
+++ b/lib/socket-util.c
@@ -72,11 +72,11 @@ set_nonblocking(int fd)
         if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != -1) {
             return 0;
         } else {
-            VLOG_ERR("fcntl(F_SETFL) failed: %s", strerror(errno));
+            VLOG_ERR("fcntl(F_SETFL) failed: %s", ovs_strerror(errno));
             return errno;
         }
     } else {
-        VLOG_ERR("fcntl(F_GETFL) failed: %s", strerror(errno));
+        VLOG_ERR("fcntl(F_GETFL) failed: %s", ovs_strerror(errno));
         return errno;
     }
 }
@@ -259,7 +259,7 @@ check_connection_completion(int fd)
         }
         return 0;
     } else if (retval < 0) {
-        VLOG_ERR_RL(&rl, "poll: %s", strerror(errno));
+        VLOG_ERR_RL(&rl, "poll: %s", ovs_strerror(errno));
         return errno;
     } else {
         return EAGAIN;
@@ -452,7 +452,8 @@ make_unix_socket(int style, bool nonblock,
         int dirfd;
 
         if (unlink(bind_path) && errno != ENOENT) {
-            VLOG_WARN("unlinking \"%s\": %s\n", bind_path, strerror(errno));
+            VLOG_WARN("unlinking \"%s\": %s\n",
+                      bind_path, ovs_strerror(errno));
         }
         fatal_signal_add_file_to_unlink(bind_path);
 
@@ -602,7 +603,7 @@ inet_open_active(int style, const char *target, uint16_t default_port,
     /* Create non-blocking socket. */
     fd = socket(AF_INET, style, 0);
     if (fd < 0) {
-        VLOG_ERR("%s: socket: %s", target, strerror(errno));
+        VLOG_ERR("%s: socket: %s", target, ovs_strerror(errno));
         error = errno;
         goto exit;
     }
@@ -616,7 +617,7 @@ inet_open_active(int style, const char *target, uint16_t default_port,
      * connect(), the handshake SYN frames will be sent with a TOS of 0. */
     error = set_dscp(fd, dscp);
     if (error) {
-        VLOG_ERR("%s: socket: %s", target, strerror(error));
+        VLOG_ERR("%s: socket: %s", target, ovs_strerror(error));
         goto exit;
     }
 
@@ -728,7 +729,7 @@ inet_open_passive(int style, const char *target, int default_port,
     fd = socket(AF_INET, style, 0);
     if (fd < 0) {
         error = errno;
-        VLOG_ERR("%s: socket: %s", target, strerror(error));
+        VLOG_ERR("%s: socket: %s", target, ovs_strerror(error));
         return -error;
     }
     error = set_nonblocking(fd);
@@ -738,14 +739,15 @@ inet_open_passive(int style, const char *target, int default_port,
     if (style == SOCK_STREAM
         && setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof yes) < 0) {
         error = errno;
-        VLOG_ERR("%s: setsockopt(SO_REUSEADDR): %s", target, strerror(error));
+        VLOG_ERR("%s: setsockopt(SO_REUSEADDR): %s",
+                 target, ovs_strerror(error));
         goto error;
     }
 
     /* Bind. */
     if (bind(fd, (struct sockaddr *) &sin, sizeof sin) < 0) {
         error = errno;
-        VLOG_ERR("%s: bind: %s", target, strerror(error));
+        VLOG_ERR("%s: bind: %s", target, ovs_strerror(error));
         goto error;
     }
 
@@ -754,14 +756,14 @@ inet_open_passive(int style, const char *target, int default_port,
      * connect(), the handshake SYN frames will be sent with a TOS of 0. */
     error = set_dscp(fd, dscp);
     if (error) {
-        VLOG_ERR("%s: socket: %s", target, strerror(error));
+        VLOG_ERR("%s: socket: %s", target, ovs_strerror(error));
         goto error;
     }
 
     /* Listen. */
     if (style == SOCK_STREAM && listen(fd, 10) < 0) {
         error = errno;
-        VLOG_ERR("%s: listen: %s", target, strerror(error));
+        VLOG_ERR("%s: listen: %s", target, ovs_strerror(error));
         goto error;
     }
 
@@ -770,7 +772,7 @@ inet_open_passive(int style, const char *target, int default_port,
         socklen_t sin_len = sizeof sin;
         if (getsockname(fd, (struct sockaddr *) &sin, &sin_len) < 0) {
             error = errno;
-            VLOG_ERR("%s: getsockname: %s", target, strerror(error));
+            VLOG_ERR("%s: getsockname: %s", target, ovs_strerror(error));
             goto error;
         }
         if (sin.sin_family != AF_INET || sin_len != sizeof sin) {
@@ -805,7 +807,7 @@ get_null_fd(void)
         null_fd = open("/dev/null", O_RDWR);
         if (null_fd < 0) {
             int error = errno;
-            VLOG_ERR("could not open /dev/null: %s", strerror(error));
+            VLOG_ERR("could not open /dev/null: %s", ovs_strerror(error));
             return -error;
         }
     }
@@ -873,13 +875,13 @@ fsync_parent_dir(const char *file_name)
                  * really an error. */
             } else {
                 error = errno;
-                VLOG_ERR("%s: fsync failed (%s)", dir, strerror(error));
+                VLOG_ERR("%s: fsync failed (%s)", dir, ovs_strerror(error));
             }
         }
         close(fd);
     } else {
         error = errno;
-        VLOG_ERR("%s: open failed (%s)", dir, strerror(error));
+        VLOG_ERR("%s: open failed (%s)", dir, ovs_strerror(error));
     }
     free(dir);
 
@@ -917,7 +919,7 @@ void
 xpipe(int fds[2])
 {
     if (pipe(fds)) {
-        VLOG_FATAL("failed to create pipe (%s)", strerror(errno));
+        VLOG_FATAL("failed to create pipe (%s)", ovs_strerror(errno));
     }
 }
 
@@ -933,7 +935,7 @@ void
 xsocketpair(int domain, int type, int protocol, int fds[2])
 {
     if (socketpair(domain, type, protocol, fds)) {
-        VLOG_FATAL("failed to create socketpair (%s)", strerror(errno));
+        VLOG_FATAL("failed to create socketpair (%s)", ovs_strerror(errno));
     }
 }
 
@@ -948,7 +950,7 @@ getsockopt_int(int fd, int level, int option, const char *optname, int *valuep)
     len = sizeof value;
     if (getsockopt(fd, level, option, &value, &len)) {
         error = errno;
-        VLOG_ERR_RL(&rl, "getsockopt(%s): %s", optname, strerror(error));
+        VLOG_ERR_RL(&rl, "getsockopt(%s): %s", optname, ovs_strerror(error));
     } else if (len != sizeof value) {
         error = EINVAL;
         VLOG_ERR_RL(&rl, "getsockopt(%s): value is %u bytes (expected %zu)",
@@ -1076,7 +1078,7 @@ describe_fd(int fd)
 
     ds_init(&string);
     if (fstat(fd, &s)) {
-        ds_put_format(&string, "fstat failed (%s)", strerror(errno));
+        ds_put_format(&string, "fstat failed (%s)", ovs_strerror(errno));
     } else if (S_ISSOCK(s.st_mode)) {
         describe_sockaddr(&string, fd, getsockname);
         ds_put_cstr(&string, "<->");
diff --git a/lib/stream-fd.c b/lib/stream-fd.c
index df5e8b0..d102582 100644
--- a/lib/stream-fd.c
+++ b/lib/stream-fd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -233,7 +233,7 @@ pfd_accept(struct pstream *pstream, struct stream **new_streamp)
     if (new_fd < 0) {
         retval = errno;
         if (retval != EAGAIN) {
-            VLOG_DBG_RL(&rl, "accept: %s", strerror(retval));
+            VLOG_DBG_RL(&rl, "accept: %s", ovs_strerror(retval));
         }
         return retval;
     }
diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index c373ca9..3b9270f 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -246,7 +246,7 @@ new_ssl_stream(const char *name, int fd, enum session_type type,
     /* Disable Nagle. */
     retval = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
     if (retval) {
-        VLOG_ERR("%s: setsockopt(TCP_NODELAY): %s", name, strerror(errno));
+        VLOG_ERR("%s: setsockopt(TCP_NODELAY): %s", name, ovs_strerror(errno));
         retval = errno;
         goto error;
     }
@@ -323,7 +323,7 @@ ssl_open(const char *name, char *suffix, struct stream **streamp, uint8_t dscp)
         int state = error ? STATE_TCP_CONNECTING : STATE_SSL_CONNECTING;
         return new_ssl_stream(name, fd, CLIENT, state, &sin, streamp);
     } else {
-        VLOG_ERR("%s: connect: %s", name, strerror(error));
+        VLOG_ERR("%s: connect: %s", name, ovs_strerror(error));
         return error;
     }
 }
@@ -369,7 +369,7 @@ do_ca_cert_bootstrap(struct stream *stream)
             return EPROTO;
         } else {
             VLOG_ERR("could not bootstrap CA cert: creating %s failed: %s",
-                     ca_cert.file_name, strerror(errno));
+                     ca_cert.file_name, ovs_strerror(errno));
             return errno;
         }
     }
@@ -378,7 +378,7 @@ do_ca_cert_bootstrap(struct stream *stream)
     if (!file) {
         error = errno;
         VLOG_ERR("could not bootstrap CA cert: fdopen failed: %s",
-                 strerror(error));
+                 ovs_strerror(error));
         unlink(ca_cert.file_name);
         return error;
     }
@@ -395,7 +395,7 @@ do_ca_cert_bootstrap(struct stream *stream)
     if (fclose(file)) {
         error = errno;
         VLOG_ERR("could not bootstrap CA cert: writing %s failed: %s",
-                 ca_cert.file_name, strerror(error));
+                 ca_cert.file_name, ovs_strerror(error));
         unlink(ca_cert.file_name);
         return error;
     }
@@ -564,7 +564,7 @@ interpret_ssl_error(const char *function, int ret, int error,
             if (ret < 0) {
                 int status = errno;
                 VLOG_WARN_RL(&rl, "%s: system error (%s)",
-                             function, strerror(status));
+                             function, ovs_strerror(status));
                 return status;
             } else {
                 VLOG_WARN_RL(&rl, "%s: unexpected SSL connection close",
@@ -834,7 +834,7 @@ pssl_accept(struct pstream *pstream, struct stream **new_streamp)
     if (new_fd < 0) {
         error = errno;
         if (error != EAGAIN) {
-            VLOG_DBG_RL(&rl, "accept: %s", strerror(error));
+            VLOG_DBG_RL(&rl, "accept: %s", ovs_strerror(error));
         }
         return error;
     }
@@ -1015,7 +1015,8 @@ update_ssl_config(struct ssl_config_file *config, const char *file_name)
      * here. */
     error = get_mtime(file_name, &mtime);
     if (error && error != ENOENT) {
-        VLOG_ERR_RL(&rl, "%s: stat failed (%s)", file_name, strerror(error));
+        VLOG_ERR_RL(&rl, "%s: stat failed (%s)",
+                    file_name, ovs_strerror(error));
     }
     if (config->file_name
         && !strcmp(config->file_name, file_name)
@@ -1123,7 +1124,7 @@ read_cert_file(const char *file_name, X509 ***certs, size_t *n_certs)
     file = fopen(file_name, "r");
     if (!file) {
         VLOG_ERR("failed to open %s for reading: %s",
-                 file_name, strerror(errno));
+                 file_name, ovs_strerror(errno));
         return errno;
     }
 
diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c
index 1767fe4..d507208 100644
--- a/lib/stream-tcp.c
+++ b/lib/stream-tcp.c
@@ -53,7 +53,7 @@ new_tcp_stream(const char *name, int fd, int connect_status,
 
     retval = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on);
     if (retval) {
-        VLOG_ERR("%s: setsockopt(TCP_NODELAY): %s", name, strerror(errno));
+        VLOG_ERR("%s: setsockopt(TCP_NODELAY): %s", name, ovs_strerror(errno));
         close(fd);
         return errno;
     }
@@ -79,7 +79,7 @@ tcp_open(const char *name, char *suffix, struct stream **streamp, uint8_t dscp)
     if (fd >= 0) {
         return new_tcp_stream(name, fd, error, &sin, streamp);
     } else {
-        VLOG_ERR("%s: connect: %s", name, strerror(error));
+        VLOG_ERR("%s: connect: %s", name, ovs_strerror(error));
         return error;
     }
 }
diff --git a/lib/stream-unix.c b/lib/stream-unix.c
index dbee135..e4b7e77 100644
--- a/lib/stream-unix.c
+++ b/lib/stream-unix.c
@@ -50,7 +50,8 @@ unix_open(const char *name, char *suffix, struct stream **streamp,
     fd = make_unix_socket(SOCK_STREAM, true, NULL, connect_path);
 
     if (fd < 0) {
-        VLOG_DBG("%s: connection failed (%s)", connect_path, strerror(-fd));
+        VLOG_DBG("%s: connection failed (%s)",
+                 connect_path, ovs_strerror(-fd));
         free(connect_path);
         return -fd;
     }
@@ -87,14 +88,14 @@ punix_open(const char *name OVS_UNUSED, char *suffix,
     bind_path = abs_file_name(ovs_rundir(), suffix);
     fd = make_unix_socket(SOCK_STREAM, true, bind_path, NULL);
     if (fd < 0) {
-        VLOG_ERR("%s: binding failed: %s", bind_path, strerror(errno));
+        VLOG_ERR("%s: binding failed: %s", bind_path, ovs_strerror(errno));
         free(bind_path);
         return errno;
     }
 
     if (listen(fd, 10) < 0) {
         error = errno;
-        VLOG_ERR("%s: listen: %s", name, strerror(error));
+        VLOG_ERR("%s: listen: %s", name, ovs_strerror(error));
         close(fd);
         free(bind_path);
         return error;
diff --git a/lib/timeval.c b/lib/timeval.c
index 4723c56..0ccfa42 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -179,7 +179,7 @@ set_up_timer(void)
     }
 
     if (timer_create(monotonic_clock, NULL, &timer_id)) {
-        VLOG_FATAL("timer_create failed (%s)", strerror(errno));
+        VLOG_FATAL("timer_create failed (%s)", ovs_strerror(errno));
     }
 
     itimer.it_interval.tv_sec = 0;
@@ -187,7 +187,7 @@ set_up_timer(void)
     itimer.it_value = itimer.it_interval;
 
     if (timer_settime(timer_id, 0, &itimer, NULL)) {
-        VLOG_FATAL("timer_settime failed (%s)", strerror(errno));
+        VLOG_FATAL("timer_settime failed (%s)", ovs_strerror(errno));
     }
 }
 
@@ -456,7 +456,7 @@ void
 xgettimeofday(struct timeval *tv)
 {
     if (gettimeofday(tv, NULL) == -1) {
-        VLOG_FATAL("gettimeofday failed (%s)", strerror(errno));
+        VLOG_FATAL("gettimeofday failed (%s)", ovs_strerror(errno));
     }
 }
 
diff --git a/lib/unixctl.c b/lib/unixctl.c
index 3d5eda6..253e953 100644
--- a/lib/unixctl.c
+++ b/lib/unixctl.c
@@ -358,7 +358,7 @@ unixctl_server_run(struct unixctl_server *server)
         } else {
             VLOG_WARN_RL(&rl, "%s: accept failed: %s",
                          pstream_get_name(server->listener),
-                         strerror(error));
+                         ovs_strerror(error));
         }
     }
 
diff --git a/lib/util.c b/lib/util.c
index 6ee8b5c..e521c20 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -617,7 +617,7 @@ get_cwd(void)
             int error = errno;
             free(buf);
             if (error != ERANGE) {
-                VLOG_WARN("getcwd failed (%s)", strerror(error));
+                VLOG_WARN("getcwd failed (%s)", ovs_strerror(error));
                 return NULL;
             }
             size *= 2;
@@ -755,7 +755,8 @@ follow_symlinks(const char *filename)
 
         linkname = xreadlink(fn);
         if (!linkname) {
-            VLOG_WARN("%s: readlink failed (%s)", filename, strerror(errno));
+            VLOG_WARN("%s: readlink failed (%s)",
+                      filename, ovs_strerror(errno));
             return fn;
         }
 
diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c
index 08ec7bf..92076d9 100644
--- a/lib/vconn-stream.c
+++ b/lib/vconn-stream.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -233,7 +233,7 @@ vconn_stream_run(struct vconn *vconn)
     retval = stream_send(s->stream, s->txbuf->data, s->txbuf->size);
     if (retval < 0) {
         if (retval != -EAGAIN) {
-            VLOG_ERR_RL(&rl, "send: %s", strerror(-retval));
+            VLOG_ERR_RL(&rl, "send: %s", ovs_strerror(-retval));
             vconn_stream_clear_txbuf(s);
             return;
         }
@@ -348,7 +348,7 @@ pvconn_pstream_accept(struct pvconn *pvconn, struct vconn **new_vconnp)
     if (error) {
         if (error != EAGAIN) {
             VLOG_DBG_RL(&rl, "%s: accept: %s",
-                        pstream_get_name(ps->pstream), strerror(error));
+                        pstream_get_name(ps->pstream), ovs_strerror(error));
         }
         return error;
     }
diff --git a/lib/vconn.c b/lib/vconn.c
index dc84cbb..449a36e 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -695,7 +695,7 @@ do_send(struct vconn *vconn, struct ofpbuf *msg)
         retval = (vconn->class->send)(vconn, msg);
         if (retval != EAGAIN) {
             VLOG_DBG_RL(&ofmsg_rl, "%s: sent (%s): %s",
-                        vconn->name, strerror(retval), s);
+                        vconn->name, ovs_strerror(retval), s);
         }
         free(s);
     }
diff --git a/lib/vlandev.c b/lib/vlandev.c
index 2440def..303b482 100644
--- a/lib/vlandev.c
+++ b/lib/vlandev.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Nicira, Inc.
+ * Copyright (c) 2011, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ vlandev_refresh(void)
             return 0;
         }
 
-        VLOG_WARN_RL(&rl, "%s: open failed (%s)", fn, strerror(error));
+        VLOG_WARN_RL(&rl, "%s: open failed (%s)", fn, ovs_strerror(error));
         return error;
     }
 
@@ -174,7 +174,7 @@ do_vlan_ioctl(const char *netdev_name, struct vlan_ioctl_args *via,
     error = ioctl(sock, SIOCSIFVLAN, via) < 0 ? errno : 0;
     if (error) {
         VLOG_WARN_RL(&rl, "%s: VLAN ioctl %s failed (%s)",
-                     netdev_name, cmd_name, strerror(error));
+                     netdev_name, cmd_name, ovs_strerror(error));
     }
     return error;
 }
diff --git a/lib/vlog.c b/lib/vlog.c
index 193e4f7..f87f48f 100644
--- a/lib/vlog.c
+++ b/lib/vlog.c
@@ -320,7 +320,7 @@ vlog_set_log_file(const char *file_name)
     /* Log success or failure. */
     if (log_fd < 0) {
         VLOG_WARN("failed to open %s for logging: %s",
-                  log_file_name, strerror(errno));
+                  log_file_name, ovs_strerror(errno));
         error = errno;
     } else {
         VLOG_INFO("opened log file %s", log_file_name);
@@ -489,7 +489,7 @@ vlog_unixctl_reopen(struct unixctl_conn *conn, int argc OVS_UNUSED,
     if (log_file_name) {
         int error = vlog_reopen_log_file();
         if (error) {
-            unixctl_command_reply_error(conn, strerror(errno));
+            unixctl_command_reply_error(conn, ovs_strerror(errno));
         } else {
             unixctl_command_reply(conn, NULL);
         }
diff --git a/lib/worker.c b/lib/worker.c
index 4c947a4..6904fdd 100644
--- a/lib/worker.c
+++ b/lib/worker.c
@@ -233,7 +233,7 @@ worker_send_iovec(const struct iovec iovs[], size_t n_iovs,
         } while (error == EINTR);
         if (error) {
             worker_broke();
-            VLOG_ABORT("poll failed (%s)", strerror(error));
+            VLOG_ABORT("poll failed (%s)", ovs_strerror(error));
         }
     }
 }
@@ -264,7 +264,7 @@ worker_request_iovec(const struct iovec iovs[], size_t n_iovs,
     error = worker_send_iovec(all_iovs, n_iovs + 1, fds, n_fds);
     if (error) {
         worker_broke();
-        VLOG_ABORT("send failed (%s)", strerror(error));
+        VLOG_ABORT("send failed (%s)", ovs_strerror(error));
     }
     free(all_iovs);
 
@@ -347,9 +347,9 @@ worker_reply_iovec(const struct iovec *iovs, size_t n_iovs,
     if (error == EPIPE) {
         /* Parent probably died.  Continue processing any RPCs still buffered,
          * to avoid missing log messages. */
-        VLOG_INFO("send failed (%s)", strerror(error));
+        VLOG_INFO("send failed (%s)", ovs_strerror(error));
     } else if (error) {
-        VLOG_FATAL("send failed (%s)", strerror(error));
+        VLOG_FATAL("send failed (%s)", ovs_strerror(error));
     }
 
     free(all_iovs);
diff --git a/ofproto/collectors.c b/ofproto/collectors.c
index 14572db..919fa1b 100644
--- a/ofproto/collectors.c
+++ b/ofproto/collectors.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ collectors_create(const struct sset *targets, uint16_t default_port,
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
 
             VLOG_WARN_RL(&rl, "couldn't open connection to collector %s (%s)",
-                         name, strerror(error));
+                         name, ovs_strerror(error));
             if (!retval) {
                 retval = error;
             }
@@ -113,7 +113,7 @@ collectors_send(const struct collectors *c, const void *payload, size_t n)
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
             if (send(c->fds[i], payload, n, 0) == -1) {
                 VLOG_WARN_RL(&rl, "sending to collector failed: %s",
-                             strerror(errno));
+                             ovs_strerror(errno));
             }
         }
     }
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 0951968..654454f 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -315,7 +315,7 @@ connmgr_run(struct connmgr *mgr,
             ofconn_set_rate_limit(ofconn, ofservice->rate_limit,
                                   ofservice->burst_limit);
         } else if (retval != EAGAIN) {
-            VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval));
+            VLOG_WARN_RL(&rl, "accept failed (%s)", ovs_strerror(retval));
         }
     }
 
@@ -327,7 +327,7 @@ connmgr_run(struct connmgr *mgr,
         if (!retval) {
             add_snooper(mgr, vconn);
         } else if (retval != EAGAIN) {
-            VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval));
+            VLOG_WARN_RL(&rl, "accept failed (%s)", ovs_strerror(retval));
         }
     }
 }
@@ -758,7 +758,7 @@ set_pvconns(struct pvconn ***pvconnsp, size_t *n_pvconnsp,
         if (!error) {
             pvconns[n_pvconns++] = pvconn;
         } else {
-            VLOG_ERR("failed to listen on %s: %s", name, strerror(error));
+            VLOG_ERR("failed to listen on %s: %s", name, ovs_strerror(error));
             if (!retval) {
                 retval = error;
             }
diff --git a/ofproto/in-band.c b/ofproto/in-band.c
index ba6fc54..8d52546 100644
--- a/ofproto/in-band.c
+++ b/ofproto/in-band.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -120,7 +120,8 @@ refresh_remote(struct in_band *ib, struct in_band_remote *r)
                                  &next_hop_inaddr, &next_hop_dev);
     if (retval) {
         VLOG_WARN("cannot find route for controller ("IP_FMT"): %s",
-                  IP_ARGS(r->remote_addr.sin_addr.s_addr), strerror(retval));
+                  IP_ARGS(r->remote_addr.sin_addr.s_addr),
+                  ovs_strerror(retval));
         return 1;
     }
     if (!next_hop_inaddr.s_addr) {
@@ -138,7 +139,7 @@ refresh_remote(struct in_band *ib, struct in_band_remote *r)
             VLOG_WARN_RL(&rl, "cannot open netdev %s (next hop "
                          "to controller "IP_FMT"): %s",
                          next_hop_dev, IP_ARGS(r->remote_addr.sin_addr.s_addr),
-                         strerror(retval));
+                         ovs_strerror(retval));
             free(next_hop_dev);
             return 1;
         }
@@ -150,7 +151,7 @@ refresh_remote(struct in_band *ib, struct in_band_remote *r)
                                r->remote_mac);
     if (retval) {
         VLOG_DBG_RL(&rl, "cannot look up remote MAC address ("IP_FMT"): %s",
-                    IP_ARGS(next_hop_inaddr.s_addr), strerror(retval));
+                    IP_ARGS(next_hop_inaddr.s_addr), ovs_strerror(retval));
     }
 
     /* If we don't have a MAC address, then refresh quickly, since we probably
@@ -436,7 +437,8 @@ in_band_create(struct ofproto *ofproto, const char *local_name,
     error = netdev_open(local_name, "internal", &local_netdev);
     if (error) {
         VLOG_ERR("failed to initialize in-band control: cannot open "
-                 "datapath local port %s (%s)", local_name, strerror(error));
+                 "datapath local port %s (%s)",
+                 local_name, ovs_strerror(error));
         return error;
     }
 
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 9ad0eaf..64d8943 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  * Copyright (c) 2009 InMon Corp.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 1b3b1e3..f46775f 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -930,7 +930,7 @@ open_dpif_backer(const char *type, struct dpif_backer **backerp)
     free(backer_name);
     if (error) {
         VLOG_ERR("failed to open datapath of type %s: %s", type,
-                 strerror(error));
+                 ovs_strerror(error));
         free(backer);
         return error;
     }
@@ -977,7 +977,7 @@ open_dpif_backer(const char *type, struct dpif_backer **backerp)
     error = dpif_recv_set(backer->dpif, backer->recv_set_enable);
     if (error) {
         VLOG_ERR("failed to listen on datapath of type %s: %s",
-                 type, strerror(error));
+                 type, ovs_strerror(error));
         close_dpif_backer(backer);
         return error;
     }
@@ -2468,7 +2468,7 @@ send_pdu_cb(void *port_, const void *pdu, size_t pdu_size)
     } else {
         VLOG_ERR_RL(&rl, "port %s: cannot obtain Ethernet address of iface "
                     "%s (%s)", port->bundle->name,
-                    netdev_get_name(port->up.netdev), strerror(error));
+                    netdev_get_name(port->up.netdev), ovs_strerror(error));
     }
 }
 
@@ -2507,7 +2507,7 @@ bundle_send_learning_packets(struct ofbundle *bundle)
         static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
         VLOG_WARN_RL(&rl, "bond %s: %d errors sending %d gratuitous learning "
                      "packets, last error was: %s",
-                     bundle->name, n_errors, n_packets, strerror(error));
+                     bundle->name, n_errors, n_packets, ovs_strerror(error));
     } else {
         VLOG_DBG("bond %s: sent %d gratuitous learning packets",
                  bundle->name, n_packets);
@@ -3559,8 +3559,8 @@ drop_key_clear(struct dpif_backer *backer)
         if (error && !VLOG_DROP_WARN(&rl)) {
             struct ds ds = DS_EMPTY_INITIALIZER;
             odp_flow_key_format(drop_key->key, drop_key->key_len, &ds);
-            VLOG_WARN("Failed to delete drop key (%s) (%s)", strerror(error),
-                      ds_cstr(&ds));
+            VLOG_WARN("Failed to delete drop key (%s) (%s)",
+                      ovs_strerror(error), ds_cstr(&ds));
             ds_destroy(&ds);
         }
 
@@ -5357,7 +5357,7 @@ send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet)
     if (error) {
         VLOG_WARN_RL(&rl, "%s: failed to send packet on port %s (%s)",
                      ofproto->up.name, netdev_get_name(ofport->up.netdev),
-                     strerror(error));
+                     ovs_strerror(error));
     }
 
     ofproto->stats.tx_packets++;
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index eabe850..73dc52d 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -442,7 +442,7 @@ ofproto_create(const char *datapath_name, const char *datapath_type,
     error = ofproto->ofproto_class->construct(ofproto);
     if (error) {
         VLOG_ERR("failed to open datapath %s: %s",
-                 datapath_name, strerror(error));
+                 datapath_name, ovs_strerror(error));
         ofproto_destroy__(ofproto);
         return error;
     }
@@ -811,7 +811,7 @@ ofproto_port_set_cfm(struct ofproto *ofproto, uint16_t ofp_port,
     if (error) {
         VLOG_WARN("%s: CFM configuration on port %"PRIu16" (%s) failed (%s)",
                   ofproto->name, ofp_port, netdev_get_name(ofport->netdev),
-                  strerror(error));
+                  ovs_strerror(error));
     }
 }
 
@@ -837,7 +837,7 @@ ofproto_port_set_bfd(struct ofproto *ofproto, uint16_t ofp_port,
     if (error) {
         VLOG_WARN("%s: bfd configuration on port %"PRIu16" (%s) failed (%s)",
                   ofproto->name, ofp_port, netdev_get_name(ofport->netdev),
-                  strerror(error));
+                  ovs_strerror(error));
     }
 }
 
@@ -1148,7 +1148,7 @@ ofproto_type_run(const char *datapath_type)
     error = class->type_run ? class->type_run(datapath_type) : 0;
     if (error && error != EAGAIN) {
         VLOG_ERR_RL(&rl, "%s: type_run failed (%s)",
-                    datapath_type, strerror(error));
+                    datapath_type, ovs_strerror(error));
     }
     return error;
 }
@@ -1165,7 +1165,7 @@ ofproto_type_run_fast(const char *datapath_type)
     error = class->type_run_fast ? class->type_run_fast(datapath_type) : 0;
     if (error && error != EAGAIN) {
         VLOG_ERR_RL(&rl, "%s: type_run_fast failed (%s)",
-                    datapath_type, strerror(error));
+                    datapath_type, ovs_strerror(error));
     }
     return error;
 }
@@ -1193,7 +1193,7 @@ ofproto_run(struct ofproto *p)
 
     error = p->ofproto_class->run(p);
     if (error && error != EAGAIN) {
-        VLOG_ERR_RL(&rl, "%s: run failed (%s)", p->name, strerror(error));
+        VLOG_ERR_RL(&rl, "%s: run failed (%s)", p->name, ovs_strerror(error));
     }
 
     if (p->ofproto_class->port_poll) {
@@ -1303,7 +1303,7 @@ ofproto_run_fast(struct ofproto *p)
     error = p->ofproto_class->run_fast ? p->ofproto_class->run_fast(p) : 0;
     if (error && error != EAGAIN) {
         VLOG_ERR_RL(&rl, "%s: fastpath run failed (%s)",
-                    p->name, strerror(error));
+                    p->name, ovs_strerror(error));
     }
     return error;
 }
@@ -1737,7 +1737,7 @@ ofport_open(struct ofproto *ofproto,
                      "cannot be opened (%s)",
                      ofproto->name,
                      ofproto_port->name, ofproto_port->ofp_port,
-                     ofproto_port->name, strerror(error));
+                     ofproto_port->name, ovs_strerror(error));
         return NULL;
     }
 
@@ -1821,7 +1821,7 @@ ofport_install(struct ofproto *p,
 
 error:
     VLOG_WARN_RL(&rl, "%s: could not add port %s (%s)",
-                 p->name, netdev_name, strerror(error));
+                 p->name, netdev_name, ovs_strerror(error));
     if (ofport) {
         ofport_destroy__(ofport);
     } else {
@@ -3245,7 +3245,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
     rule = ofproto->ofproto_class->rule_alloc();
     if (!rule) {
         VLOG_WARN_RL(&rl, "%s: failed to create rule (%s)",
-                     ofproto->name, strerror(error));
+                     ofproto->name, ovs_strerror(error));
         return ENOMEM;
     }
     cls_rule_init(&rule->cr, &fm->match, fm->priority);
@@ -4572,7 +4572,7 @@ pick_datapath_id(const struct ofproto *ofproto)
         }
         VLOG_WARN("%s: could not get MAC address for %s (%s)",
                   ofproto->name, netdev_get_name(port->netdev),
-                  strerror(error));
+                  ovs_strerror(error));
     }
     return ofproto->fallback_dpid;
 }
@@ -5115,7 +5115,7 @@ ofproto_port_set_realdev(struct ofproto *ofproto, uint16_t vlandev_ofp_port,
     if (error) {
         VLOG_WARN("%s: setting realdev on port %"PRIu16" (%s) failed (%s)",
                   ofproto->name, vlandev_ofp_port,
-                  netdev_get_name(ofport->netdev), strerror(error));
+                  netdev_get_name(ofport->netdev), ovs_strerror(error));
     }
     return error;
 }
diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
index 9f99d64..fed298c 100644
--- a/ovsdb/jsonrpc-server.c
+++ b/ovsdb/jsonrpc-server.c
@@ -200,7 +200,7 @@ ovsdb_jsonrpc_server_add_remote(struct ovsdb_jsonrpc_server *svr,
 
     error = jsonrpc_pstream_open(name, &listener, options->dscp);
     if (error && error != EAFNOSUPPORT) {
-        VLOG_ERR_RL(&rl, "%s: listen failed: %s", name, strerror(error));
+        VLOG_ERR_RL(&rl, "%s: listen failed: %s", name, ovs_strerror(error));
         return NULL;
     }
 
@@ -291,7 +291,7 @@ ovsdb_jsonrpc_server_run(struct ovsdb_jsonrpc_server *svr)
             } else if (error != EAGAIN) {
                 VLOG_WARN_RL(&rl, "%s: accept failed: %s",
                              pstream_get_name(remote->listener),
-                             strerror(error));
+                             ovs_strerror(error));
             }
         }
 
@@ -572,7 +572,7 @@ ovsdb_jsonrpc_session_set_all_options(
         error = pstream_set_dscp(remote->listener, options->dscp);
         if (error) {
             VLOG_ERR("%s: set_dscp failed %s",
-                     pstream_get_name(remote->listener), strerror(error));
+                     pstream_get_name(remote->listener), ovs_strerror(error));
         } else {
             remote->dscp = options->dscp;
         }
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index b31560b..a02bff0 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -1131,7 +1131,8 @@ save_config(FILE *config_file, const struct sset *remotes)
     char *s;
 
     if (ftruncate(fileno(config_file), 0) == -1) {
-        VLOG_FATAL("failed to truncate temporary file (%s)", strerror(errno));
+        VLOG_FATAL("failed to truncate temporary file (%s)",
+                   ovs_strerror(errno));
     }
 
     json = json_array_create_empty();
@@ -1144,7 +1145,7 @@ save_config(FILE *config_file, const struct sset *remotes)
     if (fseek(config_file, 0, SEEK_SET) != 0
         || fputs(s, config_file) == EOF
         || fflush(config_file) == EOF) {
-        VLOG_FATAL("failed to write temporary file (%s)", strerror(errno));
+        VLOG_FATAL("failed to write temporary file (%s)", ovs_strerror(errno));
     }
     free(s);
 }
@@ -1160,7 +1161,7 @@ load_config(FILE *config_file, struct sset *remotes)
     sset_clear(remotes);
 
     if (fseek(config_file, 0, SEEK_SET) != 0) {
-        VLOG_FATAL("seek failed in temporary file (%s)", strerror(errno));
+        VLOG_FATAL("seek failed in temporary file (%s)", ovs_strerror(errno));
     }
     json = json_from_stream(config_file);
     if (json->type == JSON_STRING) {
diff --git a/tests/test-netflow.c b/tests/test-netflow.c
index 921f0fd..413837e 100644
--- a/tests/test-netflow.c
+++ b/tests/test-netflow.c
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
 
     sock = inet_open_passive(SOCK_DGRAM, target, 0, NULL, 0);
     if (sock < 0) {
-        ovs_fatal(0, "%s: failed to open (%s)", argv[1], strerror(-sock));
+        ovs_fatal(0, "%s: failed to open (%s)", argv[1], ovs_strerror(-sock));
     }
 
     daemon_save_fd(STDOUT_FILENO);
diff --git a/tests/test-sflow.c b/tests/test-sflow.c
index edb996c..cba01b9 100644
--- a/tests/test-sflow.c
+++ b/tests/test-sflow.c
@@ -510,7 +510,7 @@ main(int argc, char *argv[])
 
     sock = inet_open_passive(SOCK_DGRAM, target, 0, NULL, 0);
     if (sock < 0) {
-        ovs_fatal(0, "%s: failed to open (%s)", argv[1], strerror(-sock));
+        ovs_fatal(0, "%s: failed to open (%s)", argv[1], ovs_strerror(-sock));
     }
 
     daemon_save_fd(STDOUT_FILENO);
diff --git a/tests/test-vconn.c b/tests/test-vconn.c
index 1e4e787..f54a0df 100644
--- a/tests/test-vconn.c
+++ b/tests/test-vconn.c
@@ -59,9 +59,9 @@ static void
 check_errno(int a, int b, const char *as, const char *file, int line)
 {
     if (a != b) {
-        char *str_b = strdup(strerror(abs(b)));
+        char *str_b = strdup(ovs_strerror(abs(b)));
         ovs_fatal(0, "%s:%d: %s is %d (%s) but should be %d (%s)",
-                  file, line, as, a, strerror(abs(a)), b, str_b);
+                  file, line, as, a, ovs_strerror(abs(a)), b, str_b);
     }
 }
 
@@ -156,14 +156,14 @@ test_refuse_connection(int argc OVS_UNUSED, char *argv[])
     if (!strcmp(type, "tcp")) {
         if (error != ECONNRESET && error != EPIPE) {
             ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
-                      error, strerror(error));
+                      error, ovs_strerror(error));
         }
     } else if (!strcmp(type, "unix")) {
         CHECK_ERRNO(error, EPIPE);
     } else if (!strcmp(type, "ssl")) {
         if (error != EPROTO && error != ECONNRESET) {
             ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
-                      error, strerror(error));
+                      error, ovs_strerror(error));
         }
     } else {
         ovs_fatal(0, "invalid connection type %s", type);
@@ -194,7 +194,7 @@ test_accept_then_close(int argc OVS_UNUSED, char *argv[])
     if (!strcmp(type, "tcp") || !strcmp(type, "unix")) {
         if (error != ECONNRESET && error != EPIPE) {
             ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
-                      error, strerror(error));
+                      error, ovs_strerror(error));
         }
     } else {
         CHECK_ERRNO(error, EPROTO);
@@ -249,7 +249,7 @@ test_read_hello(int argc OVS_UNUSED, char *argv[])
     error = vconn_connect_block(vconn);
     if (error != ECONNRESET && error != EPIPE) {
         ovs_fatal(0, "unexpected vconn_connect() return value %d (%s)",
-                  error, strerror(error));
+                  error, ovs_strerror(error));
     }
     vconn_close(vconn);
 }
diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c
index 70bc2e6..6d08af5 100644
--- a/utilities/ovs-controller.c
+++ b/utilities/ovs-controller.c
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
             }
         }
         if (retval) {
-            VLOG_ERR("%s: connect: %s", name, strerror(retval));
+            VLOG_ERR("%s: connect: %s", name, ovs_strerror(retval));
         }
     }
     if (n_switches == 0 && n_listeners == 0) {
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index 54505e8..84b19ff 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -590,13 +590,13 @@ show_dpif(struct dpif *dpif)
                     free(nodes);
                 } else {
                     printf(", could not retrieve configuration (%s)",
-                           strerror(error));
+                           ovs_strerror(error));
                 }
                 smap_destroy(&config);
 
                 netdev_close(netdev);
             } else {
-                printf(": open failed (%s)", strerror(error));
+                printf(": open failed (%s)", ovs_strerror(error));
             }
             putchar(')');
         }
@@ -608,12 +608,12 @@ show_dpif(struct dpif *dpif)
 
             error = netdev_open(dpif_port.name, dpif_port.type, &netdev);
             if (error) {
-                printf(", open failed (%s)", strerror(error));
+                printf(", open failed (%s)", ovs_strerror(error));
                 continue;
             }
             error = netdev_get_stats(netdev, &s);
             if (error) {
-                printf(", could not retrieve stats (%s)", strerror(error));
+                printf(", could not retrieve stats (%s)", ovs_strerror(error));
                 continue;
             }
 
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 48f0fbf..6ce1d4e 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -361,7 +361,7 @@ open_vconn_socket(const char *name, struct vconn **vconnp)
                        vconnp);
     if (error && error != ENOENT) {
         ovs_fatal(0, "%s: failed to open socket (%s)", name,
-                  strerror(error));
+                  ovs_strerror(error));
     }
     free(vconn_name);
 
@@ -412,7 +412,7 @@ open_vconn__(const char *name, enum open_target target,
     error = vconn_connect_block(*vconnp);
     if (error) {
         ovs_fatal(0, "%s: failed to connect to socket (%s)", name,
-                  strerror(error));
+                  ovs_strerror(error));
     }
 
     ofp_version = vconn_get_version(*vconnp);
@@ -1223,7 +1223,7 @@ ofctl_send(struct unixctl_conn *conn, int argc,
         error = vconn_send_block(vconn, msg);
         if (error) {
             ofpbuf_delete(msg);
-            ds_put_format(&reply, "%s\n", strerror(error));
+            ds_put_format(&reply, "%s\n", ovs_strerror(error));
             ok = false;
         } else {
             ds_put_cstr(&reply, "sent\n");
@@ -1260,7 +1260,7 @@ ofctl_barrier(struct unixctl_conn *conn, int argc OVS_UNUSED,
     error = vconn_send_block(aux->vconn, msg);
     if (error) {
         ofpbuf_delete(msg);
-        unixctl_command_reply_error(conn, strerror(error));
+        unixctl_command_reply_error(conn, ovs_strerror(error));
     } else {
         aux->conn = conn;
     }
@@ -1274,7 +1274,7 @@ ofctl_set_output_file(struct unixctl_conn *conn, int argc OVS_UNUSED,
 
     fd = open(argv[1], O_CREAT | O_TRUNC | O_WRONLY, 0666);
     if (fd < 0) {
-        unixctl_command_reply_error(conn, strerror(errno));
+        unixctl_command_reply_error(conn, ovs_strerror(errno));
         return;
     }
 
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 3513810..03220c0 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -690,7 +690,7 @@ bridge_update_ofprotos(void)
                 error = ofproto_port_del(br2->ofproto, ofproto_port.ofp_port);
                 if (error) {
                     VLOG_ERR("failed to delete port %s: %s", ofproto_port.name,
-                             strerror(error));
+                             ovs_strerror(error));
                 }
                 ofproto_port_destroy(&ofproto_port);
             }
@@ -699,7 +699,7 @@ bridge_update_ofprotos(void)
         error = ofproto_create(br->name, br->type, &br->ofproto);
         if (error) {
             VLOG_ERR("failed to create bridge %s: %s", br->name,
-                     strerror(error));
+                     ovs_strerror(error));
             bridge_destroy(br);
         }
     }
@@ -821,7 +821,7 @@ bridge_configure_datapath_id(struct bridge *br)
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
             VLOG_ERR_RL(&rl, "bridge %s: failed to set bridge "
                         "Ethernet address: %s",
-                        br->name, strerror(error));
+                        br->name, ovs_strerror(error));
         }
     }
     memcpy(br->ea, ea, ETH_ADDR_LEN);
@@ -1298,7 +1298,7 @@ iface_set_netdev_config(const struct ovsrec_interface *iface_cfg,
     error = netdev_set_config(netdev, &iface_cfg->options);
     if (error) {
         VLOG_WARN("could not configure network device %s (%s)",
-                  iface_cfg->name, strerror(error));
+                  iface_cfg->name, ovs_strerror(error));
     }
     return error;
 }
@@ -1439,7 +1439,7 @@ iface_do_create(const struct bridge *br,
                         iface_get_type(iface_cfg, br->cfg), &netdev);
     if (error) {
         VLOG_WARN("could not open network device %s (%s)",
-                  iface_cfg->name, strerror(error));
+                  iface_cfg->name, ovs_strerror(error));
         goto error;
     }
 
@@ -1553,7 +1553,7 @@ iface_create(struct bridge *br, struct if_cfg *if_cfg, uint16_t ofp_port)
                 netdev_close(netdev);
             } else {
                 VLOG_WARN("could not open network device %s (%s)",
-                          port->name, strerror(error));
+                          port->name, ovs_strerror(error));
             }
         } else {
             /* Already exists, nothing to do. */
@@ -2544,7 +2544,7 @@ qos_unixctl_show_cb(unsigned int queue_id,
         }
     } else {
         ds_put_format(ds, "\tFailed to get statistics for queue %u: %s",
-                      queue_id, strerror(error));
+                      queue_id, ovs_strerror(error));
     }
 }
 
@@ -2580,7 +2580,7 @@ qos_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
         error = netdev_dump_queues(iface->netdev, qos_unixctl_show_cb, &data);
 
         if (error) {
-            ds_put_format(&ds, "failed to dump queues: %s", strerror(error));
+            ds_put_format(&ds, "failed to dump queues: %s", ovs_strerror(error));
         }
         unixctl_command_reply(conn, ds_cstr(&ds));
     } else {
@@ -3512,7 +3512,7 @@ iface_set_mac(struct iface *iface)
             int error = netdev_set_etheraddr(iface->netdev, ea);
             if (error) {
                 VLOG_ERR("interface %s: setting MAC failed (%s)",
-                         iface->name, strerror(error));
+                         iface->name, ovs_strerror(error));
             }
         }
     }
diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index 80c8fed..bb087bd 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+/* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ main(int argc, char *argv[])
     if (want_mlockall) {
 #ifdef HAVE_MLOCKALL
         if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
-            VLOG_ERR("mlockall failed: %s", strerror(errno));
+            VLOG_ERR("mlockall failed: %s", ovs_strerror(errno));
         }
 #else
         VLOG_ERR("mlockall not supported on this system");
diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c
index 842bc20..f0f53c0 100644
--- a/vswitchd/system-stats.c
+++ b/vswitchd/system-stats.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2012 Nicira, Inc.
+/* Copyright (c) 2010, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -131,7 +131,8 @@ get_memory_stats(struct smap *stats)
 
         stream = fopen(file_name, "r");
         if (!stream) {
-            VLOG_WARN_ONCE("%s: open failed (%s)", file_name, strerror(errno));
+            VLOG_WARN_ONCE("%s: open failed (%s)",
+                           file_name, ovs_strerror(errno));
             return;
         }
 
@@ -183,7 +184,8 @@ get_boot_time(void)
 
         stream = fopen(stat_file, "r");
         if (!stream) {
-            VLOG_ERR_ONCE("%s: open failed (%s)", stat_file, strerror(errno));
+            VLOG_ERR_ONCE("%s: open failed (%s)",
+                          stat_file, ovs_strerror(errno));
             return boot_time;
         }
 
@@ -242,7 +244,8 @@ get_raw_process_info(pid_t pid, struct raw_process_info *raw)
     sprintf(file_name, "/proc/%lu/stat", (unsigned long int) pid);
     stream = fopen(file_name, "r");
     if (!stream) {
-        VLOG_ERR_ONCE("%s: open failed (%s)", file_name, strerror(errno));
+        VLOG_ERR_ONCE("%s: open failed (%s)",
+                      file_name, ovs_strerror(errno));
         return false;
     }
 
@@ -327,13 +330,13 @@ count_crashes(pid_t pid)
     sprintf(file_name, "/proc/%lu/cmdline", (unsigned long int) pid);
     stream = fopen(file_name, "r");
     if (!stream) {
-        VLOG_WARN_ONCE("%s: open failed (%s)", file_name, strerror(errno));
+        VLOG_WARN_ONCE("%s: open failed (%s)", file_name, ovs_strerror(errno));
         goto exit;
     }
 
     if (!fgets(line, sizeof line, stream)) {
         VLOG_WARN_ONCE("%s: read failed (%s)", file_name,
-                       feof(stream) ? "end of file" : strerror(errno));
+                       feof(stream) ? "end of file" : ovs_strerror(errno));
         goto exit_close;
     }
 
@@ -398,7 +401,8 @@ get_process_stats(struct smap *stats)
 
     dir = opendir(ovs_rundir());
     if (!dir) {
-        VLOG_ERR_ONCE("%s: open failed (%s)", ovs_rundir(), strerror(errno));
+        VLOG_ERR_ONCE("%s: open failed (%s)",
+                      ovs_rundir(), ovs_strerror(errno));
         return;
     }
 
@@ -457,7 +461,7 @@ get_filesys_stats(struct smap *stats OVS_UNUSED)
 
     stream = setmntent(file_name, "r");
     if (!stream) {
-        VLOG_ERR_ONCE("%s: open failed (%s)", file_name, strerror(errno));
+        VLOG_ERR_ONCE("%s: open failed (%s)", file_name, ovs_strerror(errno));
         return;
     }
 
diff --git a/vswitchd/xenserver.c b/vswitchd/xenserver.c
index 7427e4c..1f26e0d 100644
--- a/vswitchd/xenserver.c
+++ b/vswitchd/xenserver.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ read_host_uuid(void)
         if (errno == ENOENT) {
             VLOG_DBG("not running on a XenServer");
         } else {
-            VLOG_INFO("%s: open: %s", filename, strerror(errno));
+            VLOG_INFO("%s: open: %s", filename, ovs_strerror(errno));
         }
         return NULL;
     }
-- 
1.7.2.5




More information about the dev mailing list