freebsd: implement pa_get_binary_name
authorJoe Marcus Clarke <marcus@FreeBSD.org>
Sat, 21 Nov 2009 00:13:35 +0000 (01:13 +0100)
committerDiego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
Sat, 21 Nov 2009 00:13:35 +0000 (01:13 +0100)
Stolen from
http://www.freebsd.org/cgi/cvsweb.cgi/ports/audio/pulseaudio/files/patch-src_pulse_util.c?rev=1.1
and fixed for indentation.

src/pulse/util.c

index 9440f5d..ca766da 100644 (file)
@@ -189,7 +189,18 @@ char *pa_get_binary_name(char *s, size_t l) {
             return s;
         }
     }
+#endif
 
+#ifdef __FreeBSD__
+    {
+        char *rp;
+
+       if ((rp = pa_readlink("/proc/curproc/file"))) {
+           pa_strlcpy(s, pa_path_get_filename(rp), l);
+           pa_xfree(rp);
+           return s;
+       }
+    }
 #endif
 
 #if defined(HAVE_SYS_PRCTL_H) && defined(PR_GET_NAME)