mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
QUIC QLOG: Allow PID to be overridden
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22037)
This commit is contained in:
parent
c73821c4bb
commit
6cb0026c63
@ -34,6 +34,7 @@ typedef struct qlog_trace_info_st {
|
||||
int is_server;
|
||||
OSSL_TIME (*now_cb)(void *arg);
|
||||
void *now_cb_arg;
|
||||
uint64_t override_process_id;
|
||||
} QLOG_TRACE_INFO;
|
||||
|
||||
QLOG *ossl_qlog_new(const QLOG_TRACE_INFO *info);
|
||||
|
@ -59,10 +59,11 @@ QLOG *ossl_qlog_new(const QLOG_TRACE_INFO *info)
|
||||
if (qlog == NULL)
|
||||
return NULL;
|
||||
|
||||
qlog->info.odcid = info->odcid;
|
||||
qlog->info.is_server = info->is_server;
|
||||
qlog->info.now_cb = info->now_cb;
|
||||
qlog->info.now_cb_arg = info->now_cb_arg;
|
||||
qlog->info.odcid = info->odcid;
|
||||
qlog->info.is_server = info->is_server;
|
||||
qlog->info.now_cb = info->now_cb;
|
||||
qlog->info.now_cb_arg = info->now_cb_arg;
|
||||
qlog->info.override_process_id = info->override_process_id;
|
||||
|
||||
if (info->title != NULL
|
||||
&& (qlog->info.title = OPENSSL_strdup(info->title)) == NULL)
|
||||
@ -249,7 +250,7 @@ int ossl_qlog_enabled(QLOG *qlog, uint32_t event_type)
|
||||
if (qlog == NULL)
|
||||
return 0;
|
||||
|
||||
return bit_get(qlog->enabled, event_type);
|
||||
return bit_get(qlog->enabled, event_type) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -305,10 +306,15 @@ static void qlog_event_seq_header(QLOG *qlog)
|
||||
ossl_json_key(&qlog->json, "system_info");
|
||||
ossl_json_object_begin(&qlog->json);
|
||||
{
|
||||
if (qlog->info.override_process_id != 0) {
|
||||
ossl_json_key(&qlog->json, "process_id");
|
||||
ossl_json_u64(&qlog->json, qlog->info.override_process_id);
|
||||
} else {
|
||||
#if defined(OPENSSL_SYS_UNIX) || defined(OPENSSL_SYS_WINDOWS)
|
||||
ossl_json_key(&qlog->json, "process_id");
|
||||
ossl_json_u64(&qlog->json, (uint64_t)getpid());
|
||||
ossl_json_key(&qlog->json, "process_id");
|
||||
ossl_json_u64(&qlog->json, (uint64_t)getpid());
|
||||
#endif
|
||||
}
|
||||
} /* system_info */
|
||||
ossl_json_object_end(&qlog->json);
|
||||
} /* common_fields */
|
||||
|
@ -374,6 +374,10 @@ IF[{- !$disabled{tests} -}]
|
||||
INCLUDE[quic_multistream_test]=../include ../apps/include
|
||||
DEPEND[quic_multistream_test]=../libcrypto.a ../libssl.a libtestutil.a
|
||||
|
||||
SOURCE[quic_qlog_test]=quic_qlog_test.c
|
||||
INCLUDE[quic_qlog_test]=../include ../apps/include
|
||||
DEPEND[quic_qlog_test]=../libcrypto.a ../libssl.a libtestutil.a
|
||||
|
||||
SOURCE[asynctest]=asynctest.c
|
||||
INCLUDE[asynctest]=../include ../apps/include
|
||||
DEPEND[asynctest]=../libcrypto
|
||||
@ -1181,6 +1185,7 @@ ENDIF
|
||||
PROGRAMS{noinst}=quic_srtm_test quic_lcidm_test quic_rcidm_test
|
||||
PROGRAMS{noinst}=quic_fifd_test quic_txp_test quic_tserver_test
|
||||
PROGRAMS{noinst}=quic_client_test quic_cc_test quic_multistream_test
|
||||
PROGRAMS{noinst}=quic_qlog_test
|
||||
ENDIF
|
||||
|
||||
SOURCE[quic_ackm_test]=quic_ackm_test.c cc_dummy.c
|
||||
|
Loading…
Reference in New Issue
Block a user