netlink-private/socket.h \
netlink-private/tc.h \
netlink-private/types.h \
+ netlink-private/utils.h \
netlink-private/cache-api.h \
netlink-private/object-api.h \
netlink-private/route/link/api.h \
--- /dev/null
+/*
+ * netlink-private/utils.h Local Utility Functions
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
+ */
+
+#ifndef NETLINK_UTILS_PRIV_H_
+#define NETLINK_UTILS_PRIV_H_
+
+extern const char * nl_strerror_l(int err);
+
+#endif
*/
#include <netlink-private/netlink.h>
+#include <netlink-private/utils.h>
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <linux/socket.h>
#include <stdlib.h> /* exit() */
+#include <locale.h>
/**
* Global variable indicating the desired level of debugging output.
return 0;
}
+
+const char *nl_strerror_l(int err)
+{
+ int errno_save = errno;
+ locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
+ const char *buf;
+
+ if (loc == (locale_t)0) {
+ if (errno == ENOENT)
+ loc = newlocale(LC_MESSAGES_MASK,
+ "POSIX", (locale_t)0);
+ }
+ if (loc != (locale_t)0) {
+ buf = strerror_l(err, loc);
+ freelocale(loc);
+ } else {
+ buf = "newlocale() failed";
+ }
+
+ errno = errno_save;
+ return buf;
+}
/** @endcond */
/**