diff options
author | otto <> | 2016-10-31 10:06:56 +0000 |
---|---|---|
committer | otto <> | 2016-10-31 10:06:56 +0000 |
commit | 506350d1237710b9d86fdb3a794c6e6265f71221 (patch) | |
tree | 954044fa83bc67227864ff94e76f5fa8c9c8d1d9 /src | |
parent | 83ca5cd2c189e1284454732fedbd5661ba325b35 (diff) | |
download | openbsd-506350d1237710b9d86fdb3a794c6e6265f71221.tar.gz openbsd-506350d1237710b9d86fdb3a794c6e6265f71221.tar.bz2 openbsd-506350d1237710b9d86fdb3a794c6e6265f71221.zip |
remove some old option letters and also make P non-settable. It has
been the default for ages, and I see no valid reason to be able to
disable it. ok natano@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 1cb5137ca7..62e5fe2469 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.208 2016/10/28 17:03:22 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.209 2016/10/31 10:06:56 otto Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> |
4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> | 4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> |
@@ -68,10 +68,9 @@ | |||
68 | #define CHUNK_CHECK_LENGTH 32 | 68 | #define CHUNK_CHECK_LENGTH 32 |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * When the P option is active, we move allocations between half a page | 71 | * We move allocations between half a page and a whole page towards the end, |
72 | * and a whole page towards the end, subject to alignment constraints. | 72 | * subject to alignment constraints. This is the extra headroom we allow. |
73 | * This is the extra headroom we allow. Set to zero to be the most | 73 | * Set to zero to be the most strict. |
74 | * strict. | ||
75 | */ | 74 | */ |
76 | #define MALLOC_LEEWAY 0 | 75 | #define MALLOC_LEEWAY 0 |
77 | 76 | ||
@@ -177,12 +176,11 @@ struct malloc_readonly { | |||
177 | int malloc_freenow; /* Free quickly - disable chunk rnd */ | 176 | int malloc_freenow; /* Free quickly - disable chunk rnd */ |
178 | int malloc_freeunmap; /* mprotect free pages PROT_NONE? */ | 177 | int malloc_freeunmap; /* mprotect free pages PROT_NONE? */ |
179 | int malloc_junk; /* junk fill? */ | 178 | int malloc_junk; /* junk fill? */ |
180 | int malloc_move; /* move allocations to end of page? */ | ||
181 | int malloc_realloc; /* always realloc? */ | 179 | int malloc_realloc; /* always realloc? */ |
182 | int malloc_xmalloc; /* xmalloc behaviour? */ | 180 | int malloc_xmalloc; /* xmalloc behaviour? */ |
183 | int chunk_canaries; /* use canaries after chunks? */ | 181 | int chunk_canaries; /* use canaries after chunks? */ |
184 | size_t malloc_guard; /* use guard pages after allocations? */ | ||
185 | u_int malloc_cache; /* free pages we cache */ | 182 | u_int malloc_cache; /* free pages we cache */ |
183 | size_t malloc_guard; /* use guard pages after allocations? */ | ||
186 | #ifdef MALLOC_STATS | 184 | #ifdef MALLOC_STATS |
187 | int malloc_stats; /* dump statistics at end */ | 185 | int malloc_stats; /* dump statistics at end */ |
188 | #endif | 186 | #endif |
@@ -493,10 +491,6 @@ omalloc_parseopt(char opt) | |||
493 | case '<': | 491 | case '<': |
494 | mopts.malloc_cache >>= 1; | 492 | mopts.malloc_cache >>= 1; |
495 | break; | 493 | break; |
496 | case 'a': | ||
497 | case 'A': | ||
498 | /* ignored */ | ||
499 | break; | ||
500 | case 'c': | 494 | case 'c': |
501 | mopts.chunk_canaries = 0; | 495 | mopts.chunk_canaries = 0; |
502 | break; | 496 | break; |
@@ -533,15 +527,6 @@ omalloc_parseopt(char opt) | |||
533 | if (mopts.malloc_junk < 2) | 527 | if (mopts.malloc_junk < 2) |
534 | mopts.malloc_junk++; | 528 | mopts.malloc_junk++; |
535 | break; | 529 | break; |
536 | case 'n': | ||
537 | case 'N': | ||
538 | break; | ||
539 | case 'p': | ||
540 | mopts.malloc_move = 0; | ||
541 | break; | ||
542 | case 'P': | ||
543 | mopts.malloc_move = 1; | ||
544 | break; | ||
545 | case 'r': | 530 | case 'r': |
546 | mopts.malloc_realloc = 0; | 531 | mopts.malloc_realloc = 0; |
547 | break; | 532 | break; |
@@ -579,7 +564,6 @@ omalloc_init(void) | |||
579 | * Default options | 564 | * Default options |
580 | */ | 565 | */ |
581 | mopts.malloc_junk = 1; | 566 | mopts.malloc_junk = 1; |
582 | mopts.malloc_move = 1; | ||
583 | mopts.malloc_cache = MALLOC_DEFAULT_CACHE; | 567 | mopts.malloc_cache = MALLOC_DEFAULT_CACHE; |
584 | 568 | ||
585 | for (i = 0; i < 3; i++) { | 569 | for (i = 0; i < 3; i++) { |
@@ -1146,9 +1130,7 @@ omalloc(struct dir_info *pool, size_t sz, int zero_fill, void *f) | |||
1146 | STATS_ADD(pool->malloc_guarded, mopts.malloc_guard); | 1130 | STATS_ADD(pool->malloc_guarded, mopts.malloc_guard); |
1147 | } | 1131 | } |
1148 | 1132 | ||
1149 | if (mopts.malloc_move && | 1133 | if (sz - mopts.malloc_guard < MALLOC_PAGESIZE - MALLOC_LEEWAY) { |
1150 | sz - mopts.malloc_guard < MALLOC_PAGESIZE - | ||
1151 | MALLOC_LEEWAY) { | ||
1152 | /* fill whole allocation */ | 1134 | /* fill whole allocation */ |
1153 | if (mopts.malloc_junk == 2) | 1135 | if (mopts.malloc_junk == 2) |
1154 | memset(p, SOME_JUNK, psz - mopts.malloc_guard); | 1136 | memset(p, SOME_JUNK, psz - mopts.malloc_guard); |