[PATCH v2 8/9] sampling-asan: Obey the GNU coding style
Sung-hun Kim
sfoon.kim@samsung.com
Thu Sep 25 08:56:06 GMT 2025
There is no functional change.
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
---
sampling-asan/samasan_allocate.c | 13 ++--
sampling-asan/samasan_common.h | 6 +-
sampling-asan/samasan_fault_handler.c | 10 +--
sampling-asan/samasan_init.c | 38 ++++++------
sampling-asan/samasan_report.c | 87 ++++++++++++++++-----------
sampling-asan/tst-allocate.c | 4 +-
sampling-asan/tst-block-sizes.c | 2 +-
sampling-asan/tst-chunk-pick.c | 11 ++--
sampling-asan/tst-common.c | 6 +-
sampling-asan/tst-continue-on-crash.c | 2 +-
sampling-asan/tst-init.c | 14 ++---
sampling-asan/tst-partition-sizes.c | 18 +++---
sampling-asan/tst-pause-on-fork.c | 6 +-
13 files changed, 121 insertions(+), 96 deletions(-)
diff --git a/sampling-asan/samasan_allocate.c b/sampling-asan/samasan_allocate.c
index 75857f922d..77db975e40 100644
--- a/sampling-asan/samasan_allocate.c
+++ b/sampling-asan/samasan_allocate.c
@@ -152,8 +152,8 @@ get_next_memory_pool_entry_from_pointer (void *ptr)
/* A bypassed memory_pool entry should be removed from the free list */
static inline void
-remove_memory_pool_entry_from_free_list (struct memory_pool_entry_info *entry,
- struct memory_pool_entry_info *prev)
+remove_memory_pool_entry_from_free_list
+(struct memory_pool_entry_info *entry, struct memory_pool_entry_info *prev)
{
if (entry == free_list_head && entry == free_list_tail)
free_list_head = free_list_tail = NULL;
@@ -266,7 +266,7 @@ bypass_block (struct memory_pool_entry_info *entry)
The picker can take the leftmost address (left-aligned) or the rightmost
address (right-aligned) while the memory chunk does not exceed the boundary
of the memory block. Of course, it can pick the center address of the memory
- block (center-aligned). The picking style can be configured by using a
+ block (center-aligned). The picking style can be configured by using a
environmental variable (SAMASAN_CHUNK_PICK). For details, please refer
samasan_init.c. */
static memory_chunk_pick_style_t chunk_pick_style;
@@ -280,7 +280,7 @@ static memory_chunk_pick_style_t chunk_pick_style;
(chunk_pick_style == PICK_FROM_LEFT ? pick_from_left (block, size) : \
chunk_pick_style == PICK_FROM_RIGHT ? pick_from_right (block, size) : \
pick_center (block, size))
-#define get_aligned(ptr) (void *) ((uintptr_t) ptr & ~(sizeof (size_t) - 1))
+#define get_aligned(ptr) (void *) ((uintptr_t) ptr & ~(sizeof (size_t) - 1))
static inline void *
allocate_in_memory_pool_block (void *block, size_t size)
@@ -350,7 +350,8 @@ check_guard_pattern (void *chunk, size_t size)
address < (entry->address + entry->chunk_size))
bool
-is_out_of_chunk_access (uintptr_t address, struct memory_pool_entry_info *entry)
+is_out_of_chunk_access (uintptr_t address,
+ struct memory_pool_entry_info *entry)
{
if (!is_address_in_chunk (address, entry))
return true;
@@ -556,7 +557,7 @@ memory_pool_metadata_init (void)
* memory_pool_size);
for (size_t i = 0; i < memory_pool_size; i++)
{
- memory_pool_metadata[i].is_free = true;
+ memory_pool_metadata[i].is_free = true;
if (SAMASAN_UNLIKELY (!free_list_head))
free_list_head = &memory_pool_metadata[i];
else
diff --git a/sampling-asan/samasan_common.h b/sampling-asan/samasan_common.h
index e15559c907..ae6e919c06 100644
--- a/sampling-asan/samasan_common.h
+++ b/sampling-asan/samasan_common.h
@@ -27,7 +27,7 @@
#include <atomic.h> /* for atomic operations */
#define SAMASAN_TLS_SPECIFIER __thread \
- __attribute__((tls_model("initial-exec")))
+ __attribute__ ((tls_model ("initial-exec")))
#define SAMASAN_UNLIKELY(cond) __builtin_expect (!!(cond), 0)
#define SAMASAN_LIKELY(cond) __builtin_expect (!!(cond), 1)
@@ -37,7 +37,9 @@
#define samasan_atomic_inc(var) atomic_fetch_add_release (var, 1)
#define samasan_atomic_dec(var) atomic_fetch_add_release (var, -1)
-extern SAMASAN_TLS_SPECIFIER bool is_in_samasan; /* defined in samasan_allocate.c */
+/* defined in samasan_allocate.c */
+extern SAMASAN_TLS_SPECIFIER bool is_in_samasan;
+
#define check_in_samasan() is_in_samasan = true
#define check_out_samasan() is_in_samasan = false
#define is_call_in_samasan() is_in_samasan == true
diff --git a/sampling-asan/samasan_fault_handler.c b/sampling-asan/samasan_fault_handler.c
index 4e30eae707..8154df4292 100644
--- a/sampling-asan/samasan_fault_handler.c
+++ b/sampling-asan/samasan_fault_handler.c
@@ -42,10 +42,12 @@ segfault_handler (int sig, siginfo_t *info, void *context)
fault_address = get_fault_address ();
fault_ptr = (void *) fault_address;
- if (fault_address == 0) {
- fault_ptr = info->si_addr;
- fault_address = (uintptr_t) fault_ptr;
- }
+ if (fault_address == 0)
+ {
+ fault_ptr = info->si_addr;
+ fault_address = (uintptr_t) fault_ptr;
+ }
+
entry = get_memory_pool_entry_from_pointer (fault_ptr);
error = get_current_error ();
if (error == NO_ERROR)
diff --git a/sampling-asan/samasan_init.c b/sampling-asan/samasan_init.c
index c703674544..5a09959dc5 100644
--- a/sampling-asan/samasan_init.c
+++ b/sampling-asan/samasan_init.c
@@ -103,14 +103,14 @@ samasan_set_variable_char (samasan_option_t option, const char *value)
static inline void
samasan_set_variable_range (samasan_option_t option, uint32_t max,
- uint32_t min)
+ uint32_t min)
{
samasan_configurables[option].range.max = max;
samasan_configurables[option].range.min = min;
}
#define samasan_set_variable(index, value) \
- _Generic((value), \
+ _Generic ((value), \
uint32_t: samasan_set_variable_uint, \
const char *: samasan_set_variable_char, \
char *: samasan_set_variable_char, \
@@ -157,7 +157,6 @@ import_samasan_variable (int type, const char *val)
case SAMASAN_MAX_ALLOC_SIZE:
{
uint32_t converted = (uint32_t) atoi (val);
- /* on error */
if (!converted)
return false;
if (!samasan_check_variable_range (SAMASAN_MAX_ALLOC_SIZE, converted))
@@ -168,11 +167,10 @@ import_samasan_variable (int type, const char *val)
case SAMASAN_MAX_ON_GOING_ALLOCATIONS:
{
uint32_t converted = (uint32_t) atoi (val);
- /* on error */
if (!converted)
return false;
if (!samasan_check_variable_range (SAMASAN_MAX_ON_GOING_ALLOCATIONS,
- converted))
+ converted))
return false;
samasan_set_variable (SAMASAN_MAX_ON_GOING_ALLOCATIONS, converted);
break;
@@ -204,16 +202,16 @@ import_samasan_variable (int type, const char *val)
case SAMASAN_PAUSE_ON_FORK:
{
bool var = false;
- if (!strcmp (val, "on") || !strcmp (val, "enable")
- || !strcmp (val, "yes") || !strcmp (val, "true"))
+ if (!strcmp (val, "on") || !strcmp (val, "enable")
+ || !strcmp (val, "yes") || !strcmp (val, "true"))
var = true;
- samasan_set_variable (SAMASAN_PAUSE_ON_FORK, var);
- break;
+ samasan_set_variable (SAMASAN_PAUSE_ON_FORK, var);
+ break;
}
case SAMASAN_CHUNK_PICK:
{
uint32_t pick;
- if (!strcmp (val, "left") || !strcmp (val, "LEFT"))
+ if (!strcmp (val, "left") || !strcmp (val, "LEFT"))
pick = (uint32_t) PICK_FROM_LEFT;
else if (!strcmp (val, "right") || !strcmp (val, "RIGHT"))
pick = (uint32_t) PICK_FROM_RIGHT;
@@ -221,17 +219,17 @@ import_samasan_variable (int type, const char *val)
pick = (uint32_t) PICK_CENTER;
else
return false;
- samasan_set_variable (SAMASAN_CHUNK_PICK, pick);
- break;
+ samasan_set_variable (SAMASAN_CHUNK_PICK, pick);
+ break;
}
case SAMASAN_CONTINUE_ON_CRASH:
{
bool var = false;
- if (!strcmp (val, "on") || !strcmp (val, "enable")
- || !strcmp (val, "yes") || !strcmp (val, "true"))
+ if (!strcmp (val, "on") || !strcmp (val, "enable")
+ || !strcmp (val, "yes") || !strcmp (val, "true"))
var = true;
- samasan_set_variable (SAMASAN_CONTINUE_ON_CRASH, var);
- break;
+ samasan_set_variable (SAMASAN_CONTINUE_ON_CRASH, var);
+ break;
}
default:
break;
@@ -266,10 +264,10 @@ samasan_variable_init (void)
MAX_SAMASAN_SAMPLING_RATE,
MIN_SAMASAN_SAMPLING_RATE);
import_samasan_variable_range (SAMASAN_MAX_ALLOC_SIZE,
- MAX_SAMASAN_MAX_ALLOC_SIZE,
+ MAX_SAMASAN_MAX_ALLOC_SIZE,
MIN_SAMASAN_MAX_ALLOC_SIZE);
import_samasan_variable_range (SAMASAN_MAX_ON_GOING_ALLOCATIONS,
- MAX_SAMASAN_MAX_ON_GOING_ALLOCATIONS,
+ MAX_SAMASAN_MAX_ON_GOING_ALLOCATIONS,
MIN_SAMASAN_MAX_ON_GOING_ALLOCATIONS);
import_samasan_variable_range (SAMASAN_PARTITION_SIZE,
MAX_SAMASAN_PARTITION_SIZE,
@@ -281,9 +279,9 @@ samasan_variable_init (void)
import_samasan_variable (SAMASAN_SAMPLING_RATE,
DEFAULT_SAMASAN_SAMPLING_RATE);
import_samasan_variable (SAMASAN_MAX_ALLOC_SIZE,
- DEFAULT_SAMASAN_MAX_ALLOC_SIZE);
+ DEFAULT_SAMASAN_MAX_ALLOC_SIZE);
import_samasan_variable (SAMASAN_MAX_ON_GOING_ALLOCATIONS,
- DEFAULT_SAMASAN_MAX_ON_GOING_ALLOCATIONS);
+ DEFAULT_SAMASAN_MAX_ON_GOING_ALLOCATIONS);
import_samasan_variable (SAMASAN_OUTPUT_PATH,
DEFAULT_SAMASAN_OUTPUT_PATH);
import_samasan_variable (SAMASAN_PARTITION_SIZE,
diff --git a/sampling-asan/samasan_report.c b/sampling-asan/samasan_report.c
index b1bd28f639..0adb6df4a4 100644
--- a/sampling-asan/samasan_report.c
+++ b/sampling-asan/samasan_report.c
@@ -127,29 +127,36 @@ samasan_report_write (samasan_error_t error, uintptr_t address,
process_name = strip_command_line (program_invocation_name);
report_printf (stream, "%s\n", report_head);
report_printf (stream, "A crash is occurred in %s\n", process_name);
- report_printf (stream, "A %s fault raised on 0x%" PRIxPTR "\n", error_name, address);
+ report_printf (stream,
+ "A %s fault raised on 0x%" PRIxPTR "\n", error_name, address);
report_printf (stream, "<Stack trace of the faulted instruction>\n");
print_backtrace (fault_stack_trace, stream, report_printf);
if (entry == NULL)
{
- report_printf (stream, "=============================================\n");
+ report_printf (stream,
+ "=============================================\n");
report_printf (stream, "Cannot find allocation metadata!\n");
report_printf (stream, "If an OUT_OF_MEMORY_POOL fault is raised, ");
- report_printf (stream, "it can be a problem caused by other memory bugs.\n");
+ report_printf (stream,
+ "it can be a problem caused by other memory bugs.\n");
report_printf (stream, "You can recheck the problem with ");
report_printf (stream, "the increased sampling rate by setting ");
report_printf (stream, "\"SAMASAN_SAMPLING_RATE=\".\n");
- report_printf (stream, "============================================\n");
+ report_printf (stream,
+ "============================================\n");
goto report_end;
}
if (error != INVALID_ACCESS && !entry->is_free)
{
- report_printf (stream, "=============================================\n");
- report_printf (stream, "An allocated chunk is located at 0x%" PRIxPTR " ",
- entry->address);
- report_printf (stream, "and occupies %" PRIu32 " bytes.\n", entry->chunk_size);
+ report_printf (stream,
+ "=============================================\n");
+ report_printf (stream,
+ "An allocated chunk is located at 0x%" PRIxPTR " ",
+ entry->address);
+ report_printf (stream, "and occupies %" PRIu32 " bytes.\n",
+ entry->chunk_size);
if (error == INVALID_FREE)
{
@@ -160,28 +167,35 @@ samasan_report_write (samasan_error_t error, uintptr_t address,
report_printf (stream, "You tried to free on 0x%" PRIxPTR " ", address);
report_printf (stream, "and it was %zu bytes %s the allocated chunk.\n",
- diff, direction);
+ diff, direction);
}
- report_printf (stream, "=============================================\n");
+ report_printf (stream,
+ "=============================================\n");
}
if (error == INVALID_ACCESS)
{
if (!entry->is_free)
{
- report_printf (stream, "=============================================\n");
- report_printf (stream, "The previous allocated chunk is located at 0x%" PRIxPTR " ",
- entry->address);
- report_printf (stream, "and occupies %" PRIu32 " bytes.\n", entry->chunk_size);
- report_printf (stream, "=============================================\n");
+ report_printf (stream,
+ "=============================================\n");
+ report_printf (stream,
+ "The previous allocated chunk is located at 0x%" PRIxPTR " ",
+ entry->address);
+ report_printf (stream, "and occupies %" PRIu32 " bytes.\n",
+ entry->chunk_size);
+ report_printf (stream,
+ "=============================================\n");
}
- report_printf (stream, "<Allocation trace of the previous chunk (tid: %" PRIu64 ")\n",
- entry->allocation_trace.tid);
+ report_printf (stream,
+ "<Allocation trace of the previous chunk (tid: %" PRIu64 ")\n",
+ entry->allocation_trace.tid);
print_backtrace (&entry->allocation_trace, stream, report_printf);
if (entry->is_free)
{
- report_printf (stream, "<Deallocation trace of the previous chunk (tid: %" PRIu64 ")>\n",
- entry->deallocation_trace.tid);
+ report_printf (stream,
+ "<Deallocation trace of the previous chunk (tid: %" PRIu64 ")>\n",
+ entry->deallocation_trace.tid);
print_backtrace (&entry->deallocation_trace, stream, report_printf);
}
if (entry_at_next == NULL)
@@ -190,33 +204,38 @@ samasan_report_write (samasan_error_t error, uintptr_t address,
if (!entry_at_next->is_free)
{
report_printf (stream, "=============================================\n");
- report_printf (stream, "The next allocated chunk is located at 0x%" PRIxPTR " ",
- entry_at_next->address);
+ report_printf (stream,
+ "The next allocated chunk is located at 0x%" PRIxPTR " ",
+ entry_at_next->address);
report_printf (stream, "and occupies %" PRIu32 " bytes.\n",
- entry_at_next->chunk_size);
+ entry_at_next->chunk_size);
report_printf (stream, "=============================================\n");
}
- report_printf (stream, "<Allocation trace of the next chunk (tid: %" PRIu64 ")\n",
- entry_at_next->allocation_trace.tid);
- print_backtrace (&entry_at_next->allocation_trace, stream, report_printf);
+ report_printf (stream,
+ "<Allocation trace of the next chunk (tid: %" PRIu64 ")\n",
+ entry_at_next->allocation_trace.tid);
+ print_backtrace (&entry_at_next->allocation_trace, stream,
+ report_printf);
if (entry_at_next->is_free)
{
- report_printf (stream, "<Deallocation trace of the next chunk (tid: %" PRIu64 ")>\n",
- entry_at_next->deallocation_trace.tid);
- print_backtrace (&entry_at_next->deallocation_trace, stream, report_printf);
+ report_printf (stream,
+ "<Deallocation trace of the next chunk (tid: %" PRIu64 ")>\n",
+ entry_at_next->deallocation_trace.tid);
+ print_backtrace (&entry_at_next->deallocation_trace,
+ stream, report_printf);
}
}
else
{
report_printf (stream, "<Allocation trace (tid: %" PRIu64 ")>\n",
- entry->allocation_trace.tid);
+ entry->allocation_trace.tid);
print_backtrace (&entry->allocation_trace, stream, report_printf);
if (entry->is_free)
- {
- report_printf (stream, "<Deallocation trace (tid: %" PRIu64 ")>\n",
- entry->deallocation_trace.tid);
- print_backtrace (&entry->deallocation_trace, stream, report_printf);
- }
+ {
+ report_printf (stream, "<Deallocation trace (tid: %" PRIu64 ")>\n",
+ entry->deallocation_trace.tid);
+ print_backtrace (&entry->deallocation_trace, stream, report_printf);
+ }
}
report_end:
diff --git a/sampling-asan/tst-allocate.c b/sampling-asan/tst-allocate.c
index b0598a5fc5..c5caf14710 100644
--- a/sampling-asan/tst-allocate.c
+++ b/sampling-asan/tst-allocate.c
@@ -32,7 +32,7 @@ test_allocations (void)
void *ptr;
ptr = samasan_allocate (zero_size);
- TEST_VERIFY(ptr == NULL);
+ TEST_VERIFY (ptr == NULL);
ptr = samasan_allocate (allocation_size);
TEST_VERIFY (ptr != NULL);
samasan_free (ptr);
@@ -102,7 +102,7 @@ test_allocation_use_free_repeat (void)
cptr = (char *) ptr;
for (int j = 0; j < allocation_size; j++)
cptr[j] = 'a';
- samasan_free( ptr);
+ samasan_free (ptr);
}
#undef NR_REPEAT
}
diff --git a/sampling-asan/tst-block-sizes.c b/sampling-asan/tst-block-sizes.c
index 5bf35ab7bc..18e96ce5b2 100644
--- a/sampling-asan/tst-block-sizes.c
+++ b/sampling-asan/tst-block-sizes.c
@@ -33,7 +33,7 @@ test_multiple_chunk_sizes (size_t size)
const size_t increase = 64;
size_t allocation_size = increase;
- sprintf(chunk_size, "%ld", size);
+ sprintf (chunk_size, "%ld", size);
setenv ("SAMASAN_MAX_ALLOC_SIZE", chunk_size, 1/* replace */);
samasan_init ();
TEST_VERIFY (samasan_is_enabled () == true);
diff --git a/sampling-asan/tst-chunk-pick.c b/sampling-asan/tst-chunk-pick.c
index 94793e69d9..041e2bdaad 100644
--- a/sampling-asan/tst-chunk-pick.c
+++ b/sampling-asan/tst-chunk-pick.c
@@ -28,12 +28,13 @@
static const size_t page_size = 4096;
static bool
-check_allocation_align (memory_chunk_pick_style_t style, size_t size, void *ptr)
+check_allocation_align
+(memory_chunk_pick_style_t style, size_t size, void *ptr)
{
uintptr_t address = (uintptr_t) ptr;
uintptr_t page_address = address - (address % page_size);
- if (style == PICK_FROM_LEFT)
+ if (style == PICK_FROM_LEFT)
{
/* If style == PICK_FROM_LEFT, the address should be same to
* the address of the memory block. */
@@ -74,7 +75,7 @@ test_memory_chunk_pick_style (memory_chunk_pick_style_t style)
else
setenv ("SAMASAN_CHUNK_PICK", "CENTER", 1);
- samasan_init();
+ samasan_init ();
ptr = samasan_allocate (alloc_size);
TEST_VERIFY (ptr != NULL);
@@ -94,7 +95,9 @@ do_test (void)
So, deinitialize sampling-asan before starting the test */
samasan_deinit ();
- for (memory_chunk_pick_style_t style = PICK_FROM_LEFT; style < PICK_END; style++)
+ for (memory_chunk_pick_style_t style = PICK_FROM_LEFT;
+ style < PICK_END;
+ style++)
test_memory_chunk_pick_style (style);
return 0;
diff --git a/sampling-asan/tst-common.c b/sampling-asan/tst-common.c
index 333ab9d8ab..64c5a33bdc 100644
--- a/sampling-asan/tst-common.c
+++ b/sampling-asan/tst-common.c
@@ -33,7 +33,7 @@ check_report (const char *keyword, const char *report_path)
if (report != NULL)
{
char buf[255], *substr;
- while (fscanf (report, "%s", buf) != EOF)
+ while (fscanf (report, "%s", buf) != EOF)
{
substr = strstr (buf, keyword);
if (substr != NULL && !strncmp (substr, keyword, strlen (keyword)))
@@ -67,13 +67,13 @@ clean_up_report (const char *report_path)
static void
test_bed (void (*error_func) (void), const char *keyword,
- const char *report_path)
+ const char *report_path)
{
pid_t child_pid;
clean_up_report (report_path);
- child_pid = _Fork();
+ child_pid = _Fork ();
TEST_VERIFY_EXIT (child_pid != -1);
if (child_pid == 0)
diff --git a/sampling-asan/tst-continue-on-crash.c b/sampling-asan/tst-continue-on-crash.c
index 28926d2e83..27d83e8d01 100644
--- a/sampling-asan/tst-continue-on-crash.c
+++ b/sampling-asan/tst-continue-on-crash.c
@@ -42,7 +42,7 @@ check_report (const char *keyword, const char *report_path)
if (report != NULL)
{
char buf[255], *substr;
- while (fscanf (report, "%s", buf) != EOF)
+ while (fscanf (report, "%s", buf) != EOF)
{
substr = strstr (buf, keyword);
if (substr != NULL && !strncmp (substr, keyword, strlen (keyword)))
diff --git a/sampling-asan/tst-init.c b/sampling-asan/tst-init.c
index 45cafd3d69..5cae7d6d61 100644
--- a/sampling-asan/tst-init.c
+++ b/sampling-asan/tst-init.c
@@ -28,7 +28,7 @@ static void
test_repeated_init_and_deinit (void)
{
#define REPEATS 100
- setenv("SAMASAN_ENABLE", "true", 1/* replace */);
+ setenv ("SAMASAN_ENABLE", "true", 1/* replace */);
for (int i = 0; i < REPEATS; i++)
{
@@ -44,10 +44,10 @@ static void
test_misconfigurations (void)
{
setenv ("SAMASAN_ENABLE",
- "truth" /* should be "yes" or "true" or "enable" or "on" */,
- 1 /* replace */);
+ "truth" /* should be "yes" or "true" or "enable" or "on" */,
+ 1 /* replace */);
setenv ("SAMASAN_MAX_ALLOC_SIZE", "4096" /* exceed the upper limit */,
- 1 /* replace */);
+ 1 /* replace */);
setenv ("SAMASAN_MAX_ON_GOING_ALLOCATIONS", "100", 1 /* replace */);
setenv ("SAMASAN_SAMPLING_RATE", "1.0", 1 /* replace */);
@@ -56,7 +56,7 @@ test_misconfigurations (void)
setenv ("SAMASAN_ENABLE", "true", 1 /* replace */);
setenv ("SAMASAN_MAX_ALLOC_SIZE", "409600" /* exceed the upper limit */,
- 1 /* replace */);
+ 1 /* replace */);
setenv ("SAMASAN_MAX_ON_GOING_ALLOCATIONS", "100", 1 /* replace */);
setenv ("SAMASAN_SAMPLING_RATE", "1.0", 1 /* replace */);
@@ -66,7 +66,7 @@ test_misconfigurations (void)
setenv ("SAMASAN_ENABLE", "true", 1 /* replace */);
setenv ("SAMASAN_MAX_ALLOC_SIZE", "4096", 1 /* replace */);
setenv ("SAMASAN_MAX_ON_GOING_ALLOCATIONS",
- "100000" /* exceed the upper limit */, 1 /* replace */);
+ "100000" /* exceed the upper limit */, 1 /* replace */);
setenv ("SAMASAN_SAMPLING_RATE", "1.0", 1 /* replace */);
samasan_init ();
@@ -86,7 +86,7 @@ test_multiple_inits (void)
{
setenv ("SAMASAN_ENABLE", "true", 1 /* replace */);
setenv ("SAMASAN_MAX_ALLOC_SIZE", "4096" /* exceed the upper limit */,
- 1 /* replace */);
+ 1 /* replace */);
setenv ("SAMASAN_MAX_ON_GOING_ALLOCATIONS", "100", 1 /* replace */);
setenv ("SAMASAN_SAMPLING_RATE", "1.0", 1 /* replace */);
diff --git a/sampling-asan/tst-partition-sizes.c b/sampling-asan/tst-partition-sizes.c
index 78cdaadaea..213c424b76 100644
--- a/sampling-asan/tst-partition-sizes.c
+++ b/sampling-asan/tst-partition-sizes.c
@@ -35,10 +35,10 @@ test_partition_size (size_t partition_size)
char *cptr;
sprintf (buf, "%ld", partition_size);
- setenv("SAMASAN_PARTITION_SIZE", buf, 1/* replace */);
+ setenv ("SAMASAN_PARTITION_SIZE", buf, 1/* replace */);
samasan_init ();
- TEST_VERIFY (samasan_is_enabled());
+ TEST_VERIFY (samasan_is_enabled ());
for (size_t i = 0; i < 10; i++)
{
ptr[i] = samasan_allocate (allocation_size);
@@ -48,7 +48,7 @@ test_partition_size (size_t partition_size)
}
for (size_t i = 0; i < 10; i++)
samasan_free (ptr[i]);
- samasan_deinit();
+ samasan_deinit ();
}
static void
@@ -57,10 +57,10 @@ test_wrong_partition_size (size_t partition_size)
char buf[100];
sprintf (buf, "%ld", partition_size);
- setenv("SAMASAN_PARTITION_SIZE", buf, 1/* replace */);
+ setenv ("SAMASAN_PARTITION_SIZE", buf, 1/* replace */);
samasan_init ();
- TEST_VERIFY (!samasan_is_enabled());
+ TEST_VERIFY (!samasan_is_enabled ());
}
static int
@@ -68,13 +68,13 @@ do_test (void)
{
const size_t page_size = 4096;
- setenv("SAMASAN_ENABLE", "true", 1/* replace */);
- setenv("SAMASAN_MAX_ALLOC_SIZE", "4096", 1/* replace */);
- setenv("SAMASAN_MAX_ON_GOING_ALLOCATIONS", "10", 1/* replace */);
+ setenv ("SAMASAN_ENABLE", "true", 1/* replace */);
+ setenv ("SAMASAN_MAX_ALLOC_SIZE", "4096", 1/* replace */);
+ setenv ("SAMASAN_MAX_ON_GOING_ALLOCATIONS", "10", 1/* replace */);
/* glibc already initialized sampling-asan.
So, deinitialize sampling-asan before starting the test */
- samasan_deinit();
+ samasan_deinit ();
for (size_t i = 0; i <= 10; i++)
test_partition_size (page_size * i);
diff --git a/sampling-asan/tst-pause-on-fork.c b/sampling-asan/tst-pause-on-fork.c
index 995f0914e5..174bb9e120 100644
--- a/sampling-asan/tst-pause-on-fork.c
+++ b/sampling-asan/tst-pause-on-fork.c
@@ -68,10 +68,10 @@ test_pthread_fork (bool memory_pool_resume)
else
thread_id = xpthread_create (NULL, &memory_pool_stay_pause, NULL);
- xpthread_mutex_lock (&mutex);
+ xpthread_mutex_lock (&mutex);
while (!thread_ready)
xpthread_cond_wait (&cond, &mutex);
- xpthread_mutex_unlock (&mutex);
+ xpthread_mutex_unlock (&mutex);
if (!memory_pool_resume)
alarm (1);
@@ -85,7 +85,7 @@ test_pthread_fork (bool memory_pool_resume)
The process will be terminated by the alarm call. */
waitpid (pid, NULL, 0);
xpthread_join (thread_id);
-}
+}
static void
test_bed (bool memory_pool_resume)
--
2.25.1
More information about the Libc-alpha
mailing list