shell_global_reexec_self: add support for OpenBSD
https://bugzilla.gnome.org/show_bug.cgi?id=709571
This commit is contained in:
parent
c4a6837d56
commit
15ff426be8
@ -33,6 +33,11 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "shell-enum-types.h"
|
#include "shell-enum-types.h"
|
||||||
#include "shell-global-private.h"
|
#include "shell-global-private.h"
|
||||||
#include "shell-perf-log.h"
|
#include "shell-perf-log.h"
|
||||||
@ -1110,12 +1115,22 @@ shell_global_reexec_self (ShellGlobal *global)
|
|||||||
char *buf_end;
|
char *buf_end;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
/* Linux specific (I think, anyways). */
|
#if defined __linux__
|
||||||
if (!g_file_get_contents ("/proc/self/cmdline", &buf, &len, &error))
|
if (!g_file_get_contents ("/proc/self/cmdline", &buf, &len, &error))
|
||||||
{
|
{
|
||||||
g_warning ("failed to get /proc/self/cmdline: %s", error->message);
|
g_warning ("failed to get /proc/self/cmdline: %s", error->message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#elif defined __OpenBSD__
|
||||||
|
int pid = getpid();
|
||||||
|
int mib[] = { CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_ARGV };
|
||||||
|
if (sysctl(mib, G_N_ELEMENTS (mib), &buf, &len, NULL, 0) == -1) {
|
||||||
|
g_warning ("failed to get command line args: %d", errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
buf_end = buf+len;
|
buf_end = buf+len;
|
||||||
arr = g_ptr_array_new ();
|
arr = g_ptr_array_new ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user