[PATCH 01/24] linux-user: Use assert in mmap_fork_start

Richard Henderson posted 24 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH 01/24] linux-user: Use assert in mmap_fork_start
Posted by Richard Henderson 1 year, 2 months ago
Assert is preferred over if+abort for the error message.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/mmap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 0aa8ae7356..83cbcce769 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -49,8 +49,7 @@ bool have_mmap_lock(void)
 /* Grab lock to make sure things are in a consistent state after fork().  */
 void mmap_fork_start(void)
 {
-    if (mmap_lock_count)
-        abort();
+    assert(mmap_lock_count == 0);
     pthread_mutex_lock(&mmap_mutex);
 }
 
-- 
2.34.1
Re: [PATCH 01/24] linux-user: Use assert in mmap_fork_start
Posted by Philippe Mathieu-Daudé 1 year, 2 months ago
On 30/6/23 15:21, Richard Henderson wrote:
> Assert is preferred over if+abort for the error message.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/mmap.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



Re: [PATCH 01/24] linux-user: Use assert in mmap_fork_start
Posted by Alex Bennée 1 year, 2 months ago
Richard Henderson <richard.henderson@linaro.org> writes:

> Assert is preferred over if+abort for the error message.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro