[ovs-dev] [PATCH 2/2] lib: Use FreeBSD libc function for proctitle

Ed Maste emaste at adaranet.com
Thu Oct 11 20:58:17 UTC 2012


FreeBSD libc's setproctitle provides the same interface as proctitle_set so
use it directly.

Signed-off-by: Ed Maste <emaste at adaranet.com>
---
 lib/command-line.c | 3 +++
 lib/command-line.h | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/lib/command-line.c b/lib/command-line.c
index eb9f6b1..a018424 100644
--- a/lib/command-line.c
+++ b/lib/command-line.c
@@ -190,10 +190,13 @@ proctitle_init(int argc OVS_UNUSED, char **argv OVS_UNUSED)
 {
 }

+#ifndef __FreeBSD__
+/* On FreeBSD we #define this to setproctitle. */
 void
 proctitle_set(const char *format OVS_UNUSED, ...)
 {
 }
+#endif

 void
 proctitle_restore(void)
diff --git a/lib/command-line.h b/lib/command-line.h
index 803f433..2592b79 100644
--- a/lib/command-line.h
+++ b/lib/command-line.h
@@ -34,8 +34,12 @@ char *long_options_to_short_options(const struct option *options);
 void run_command(int argc, char *argv[], const struct command[]);

 void proctitle_init(int argc, char **argv);
+#ifdef __FreeBSD__
+#define proctitle_set setproctitle
+#else
 void proctitle_set(const char *, ...)
     PRINTF_FORMAT(1, 2);
+#endif
 void proctitle_restore(void);

 #endif /* command-line.h */
--
1.7.11.5



More information about the dev mailing list