Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0369-erts-Make-emulator-terminate-if-erlsrv-doe...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0369-erts-Make-emulator-terminate-if-erlsrv-does-windows.patch of Package erlang
From cecfda89c486bc76720f0998b860f0faa6553553 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Thu, 4 Feb 2021 13:18:35 +0100 Subject: [PATCH] erts: Make emulator terminate if erlsrv does (windows) by creating and assigning a job object to erlsrv which will be inherited by all child processes. --- erts/etc/win32/erlsrv/erlsrv_service.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/erts/etc/win32/erlsrv/erlsrv_service.c b/erts/etc/win32/erlsrv/erlsrv_service.c index f5d5c0b174..47b9c72690 100644 --- a/erts/etc/win32/erlsrv/erlsrv_service.c +++ b/erts/etc/win32/erlsrv/erlsrv_service.c @@ -525,6 +525,28 @@ static BOOL start_a_service(ServerInfo *srvi){ new_acl(&save_acl); + { + BOOL bIsProcessInJob; + if (!IsProcessInJob(GetCurrentProcess(), NULL, &bIsProcessInJob)) { + log_error(L"IsProcessInJob failed"); + return FALSE; + } + if (!bIsProcessInJob) { + HANDLE hJob = CreateJobObject(NULL, NULL); + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; + /* + * Causes all processes associated with the job to terminate when the + * last handle to the job is closed. + */ + jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli)); + if (AssignProcessToJobObject(hJob, GetCurrentProcess()) == FALSE) { + log_error(L"Could not AssignProcessToJobObject"); + return FALSE; + } + } + } + if(!CreateProcessW(NULL, execbuff, &attr, -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor