From 1c29a88ee1ad530d02f841ee20b1091ce98ac6c0 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 21 Sep 2021 17:44:43 +0200 Subject: [PATCH] Fix SDL2 driver arguments to mmap() and sem_open() Linux & MacOS seem to tolerate the incorrect parameters but they are wrong as per the documentation. On more pedantic systems such as FreeBSD these calls fails. --- drivers/multiple/SDL/gdisp_lld_SDL.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/multiple/SDL/gdisp_lld_SDL.c b/drivers/multiple/SDL/gdisp_lld_SDL.c index e306dd7f..2802edd3 100644 --- a/drivers/multiple/SDL/gdisp_lld_SDL.c +++ b/drivers/multiple/SDL/gdisp_lld_SDL.c @@ -174,8 +174,8 @@ static struct SDL_UGFXContext *context; static sem_t *ctx_mutex; static sem_t *input_event; -#define CTX_MUTEX_NAME "ugfx_ctx_mutex" -#define INPUT_EVENT_NAME "ugfx_input_event" +#define CTX_MUTEX_NAME "/ugfx_ctx_mutex" +#define INPUT_EVENT_NAME "/ugfx_input_event" static int SDL_loop (void) { @@ -316,7 +316,7 @@ void sdl_driver_init (void) { exit (1) ; } - if ((context = (struct SDL_UGFXContext*) mmap (0,sizeof (struct SDL_UGFXContext ),PROT_WRITE|PROT_READ,(MAP_ANONYMOUS | MAP_SHARED),0,0)) ==MAP_FAILED) { + if ((context = (struct SDL_UGFXContext*) mmap (0, sizeof(struct SDL_UGFXContext), PROT_WRITE|PROT_READ, (MAP_ANONYMOUS | MAP_SHARED), -1, 0)) == MAP_FAILED) { perror("Failed to allocate shared memory"); exit(1); }