int thread_limit; /* hard limit on the number of threads */
int prealloc_fd;
uchar clt_privileged_ports; /* bitmask to allow client privileged ports exchanges per protocol */
- /* 3-bytes hole */
+ unsigned char argc; /* cast int argc to unsigned char in order to fill better the previous
+ * 3 bytes hole, it seems unreal, that oneday we could start with more
+ * than 255 arguments
+ */
+ /* 2-bytes hole */
int cfg_curr_line; /* line number currently being parsed */
const char *cfg_curr_file; /* config file currently being parsed or NULL */
char *cfg_curr_section; /* config section name currently being parsed or NULL */
+ char **argv; /* ptr to array with args */
/* The info above is config stuff, it doesn't change during the process' life */
/* A number of the elements below are updated by all threads in real time and
#include <haproxy/time.h>
#include <haproxy/tools.h>
#include <haproxy/trace.h>
+#include <haproxy/version.h>
#include <import/ist.h>
gid_t boot_gid;
struct rlimit limit_fd; // RLIMIT_NOFILE
struct rlimit limit_ram; // RLIMIT_DATA
+ char **argv;
#if defined(USE_THREAD)
struct {
void *stack_top; // top of the stack
} thread_info[MAX_THREADS];
#endif
+ unsigned char argc;
} process;
#if defined(HA_HAVE_DUMP_LIBS)
static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *appctx, void *private)
{
const char **build_opt;
+ int i;
if (*args[2])
return cli_err(appctx, "This command takes no argument.\n");
chunk_reset(&trash);
+ chunk_appendf(&trash, "HAProxy version %s\n", haproxy_version);
chunk_appendf(&trash, "Features\n %s\n", build_features);
chunk_appendf(&trash, "Build options\n");
chunk_appendf(&trash, "Process info\n");
chunk_appendf(&trash, " pid: %d\n", post_mortem.process.pid);
+ chunk_appendf(&trash, " cmdline: ");
+ for (i = 0; i < post_mortem.process.argc; i++)
+ chunk_appendf(&trash, "%s ", post_mortem.process.argv[i]);
+ chunk_appendf(&trash, "\n");
chunk_appendf(&trash, " boot uid: %d\n", post_mortem.process.boot_uid);
+ chunk_appendf(&trash, " runtime uid: %d\n", geteuid());
chunk_appendf(&trash, " boot gid: %d\n", post_mortem.process.boot_gid);
+ chunk_appendf(&trash, " runtime gid: %d\n", getegid());
if ((ulong)post_mortem.process.limit_fd.rlim_cur != RLIM_INFINITY)
chunk_appendf(&trash, " fd limit (soft): %lu\n", (ulong)post_mortem.process.limit_fd.rlim_cur);
post_mortem.process.pid = getpid();
post_mortem.process.boot_uid = geteuid();
post_mortem.process.boot_gid = getegid();
+ post_mortem.process.argc = global.argc;
+ post_mortem.process.argv = global.argv;
getrlimit(RLIMIT_NOFILE, &post_mortem.process.limit_fd);
getrlimit(RLIMIT_DATA, &post_mortem.process.limit_ram);