lib: drop curlx_getpid, use fake pid in SMB

It was not a function properly exposed in the curlx set. SMB cannot
possibly need to send a real pid, now sends a made up number.

The only real users of this function are test servers, so move the logic
over there.

Closes #17298
This commit is contained in:
Daniel Stenberg 2025-05-09 09:36:05 +02:00
parent 5fef848037
commit a129859367
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 12 additions and 15 deletions

View file

@ -668,7 +668,7 @@ dnsd_cleanup:
if(got_exit_signal) {
logmsg("========> %s dnsd (port: %d pid: %ld) exits with signal (%d)",
ipv_inuse, (int)port, (long)curlx_getpid(), exit_signal);
ipv_inuse, (int)port, (long)our_getpid(), exit_signal);
/*
* To properly set the return status of the process we
* must raise the same signal SIGINT or SIGTERM that we

View file

@ -1354,7 +1354,7 @@ server_cleanup:
if(got_exit_signal) {
logmsg("========> %s rtspd (port: %d pid: %ld) exits with signal (%d)",
ipv_inuse, (int)port, (long)curlx_getpid(), exit_signal);
ipv_inuse, (int)port, (long)our_getpid(), exit_signal);
/*
* To properly set the return status of the process we
* must raise the same signal SIGINT or SIGTERM that we

View file

@ -2511,7 +2511,7 @@ sws_cleanup:
if(got_exit_signal) {
logmsg("========> %s sws (%s pid: %ld) exits with signal (%d)",
socket_type, location_str, (long)curlx_getpid(), exit_signal);
socket_type, location_str, (long)our_getpid(), exit_signal);
/*
* To properly set the return status of the process we
* must raise the same signal SIGINT or SIGTERM that we

View file

@ -857,7 +857,7 @@ tftpd_cleanup:
if(got_exit_signal) {
logmsg("========> %s tftpd (port: %d pid: %ld) exits with signal (%d)",
ipv_inuse, (int)port, (long)curlx_getpid(), exit_signal);
ipv_inuse, (int)port, (long)our_getpid(), exit_signal);
/*
* To properly set the return status of the process we
* must raise the same signal SIGINT or SIGTERM that we

View file

@ -295,11 +295,15 @@ int wait_ms(timediff_t timeout_ms)
return r;
}
#ifdef _WIN32
#define t_getpid() GetCurrentProcessId()
#else
#define t_getpid() getpid()
#endif
curl_off_t our_getpid(void)
{
curl_off_t pid;
pid = (curl_off_t)curlx_getpid();
curl_off_t pid = (curl_off_t)t_getpid();
#ifdef _WIN32
/* store pid + MAX_PID to avoid conflict with Cygwin/msys PIDs, see also:
* - 2019-01-31: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;