mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MINOR: sample: add pid sample
Implement the pid sample fetch.
This commit is contained in:
parent
e42241ed2b
commit
ac87815be9
@ -19600,6 +19600,10 @@ prio_offset : integer
|
||||
"http-request set-priority-offset" or "tcp-request content
|
||||
set-priority-offset".
|
||||
|
||||
pid : integer
|
||||
Return the PID of the current process. In most cases this is the PID of the
|
||||
worker process.
|
||||
|
||||
proc : integer
|
||||
Always returns value 1 (historically it would return the calling process
|
||||
number).
|
||||
|
11
src/sample.c
11
src/sample.c
@ -4213,6 +4213,16 @@ smp_fetch_nbproc(const struct arg *args, struct sample *smp, const char *kw, voi
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* returns the PID of the current process */
|
||||
static int
|
||||
smp_fetch_pid(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
smp->data.type = SMP_T_SINT;
|
||||
smp->data.u.sint = pid;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* returns the number of the current process (between 1 and nbproc */
|
||||
static int
|
||||
smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
@ -4497,6 +4507,7 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
|
||||
{ "date_us", smp_fetch_date_us, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||
{ "hostname", smp_fetch_hostname, 0, NULL, SMP_T_STR, SMP_USE_CONST },
|
||||
{ "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||
{ "pid", smp_fetch_pid, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||
{ "proc", smp_fetch_proc, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||
{ "quic_enabled", smp_fetch_quic_enabled, 0, NULL, SMP_T_BOOL, SMP_USE_CONST },
|
||||
{ "thread", smp_fetch_thread, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||
|
Loading…
Reference in New Issue
Block a user