Skip to content

Commit 538ce33

Browse files
committed
Fix fork thread handle leak on windows
1 parent a15958e commit 538ce33

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

libc/intrin/maps.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "libc/dce.h"
2525
#include "libc/intrin/describebacktrace.h"
2626
#include "libc/intrin/dll.h"
27-
#include "libc/intrin/kprintf.h"
2827
#include "libc/intrin/maps.h"
2928
#include "libc/macros.h"
3029
#include "libc/nexgen32e/rdtsc.h"
@@ -92,7 +91,7 @@ void __maps_init(void) {
9291
// https://lwn.net/Articles/725832/. if we guess too small, then
9392
// slackmap will create a bunch of zombie stacks in __print_maps
9493
// to coverup the undisclosed memory but no cost if we guess big
95-
size_t guardsize = (__maps.rand % 8 + 1) * 1000 * 1024;
94+
size_t guardsize = 1024 * 1024;
9695
guardsize += __pagesize - 1;
9796
guardsize &= -__pagesize;
9897

libc/runtime/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ textwindows static errno_t CloneWindows(int (*func)(void *), char *stk,
118118
wt->arg = arg;
119119
wt->tls = tls;
120120
wt->sp = tip & -16;
121-
if ((h = CreateThread(&kNtIsInheritable, 65536, (void *)WinThreadEntry, wt,
121+
if ((h = CreateThread(0, 65536, (void *)WinThreadEntry, wt,
122122
kNtStackSizeParamIsAReservation, &utid))) {
123123
atomic_init(ptid, utid);
124124
struct CosmoTib *tib = tls;

libc/testlib/benchmark.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void _print_benchmark_result(double total_nanos, double work_per_run,
7171
work_unit = " ";
7272
}
7373

74-
printf("%8.2f %-2s %8.2f %s/s %6.2f %s %2dx %s\n", time_value, time_unit,
74+
printf("%8.2f %-2s %8.2f %s/s %6.2f %s %3dx %s\n", time_value, time_unit,
7575
throughput, throughput_unit, work_per_run, work_unit, iterations,
7676
code);
7777
}

0 commit comments

Comments
 (0)