+static char *
+vsctl_parent_process_info(void)
+{
+#ifdef __linux__
+ pid_t parent_pid;
+ char *procfile;
+ struct ds s;
+ FILE *f;
+
+ parent_pid = getppid();
+ procfile = xasprintf("/proc/%d/cmdline", parent_pid);
+
+ f = fopen(procfile, "r");
+ if (!f) {
+ VLOG_WARN("%s: open failed (%s)", procfile, ovs_strerror(errno));
+ free(procfile);
+ return NULL;
+ }
+ free(procfile);
+
+ ds_init(&s);
+ for (;;) {
+ int c = getc(f);
+ if (!c || c == EOF) {
+ break;
+ }
+ ds_put_char(&s, c);
+ }
+ fclose(f);
+
+ ds_put_format(&s, " (pid %d)", parent_pid);
+
+ return ds_steal_cstr(&s);
+#else
+ return NULL;
+#endif
+}
+