From 081da63d097dd5a1de360abd6dcf5c0eb01ecdfc Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 24 Dec 2009 17:07:20 +0000 Subject: [PATCH] Add support for errno in plugins. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24109 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 2 ++ apps/plugin.h | 1 + firmware/include/errno.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/apps/plugin.c b/apps/plugin.c index 3836d76d28..bd88da6647 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -40,6 +40,7 @@ #include "version.h" #include "storage.h" #include "pcmbuf.h" +#include "errno.h" #if CONFIG_CHARGING #include "power.h" @@ -680,6 +681,7 @@ static const struct plugin_api rockbox_api = { viewportmanager_theme_enable, viewportmanager_theme_undo, #endif + &errno }; int plugin_load(const char* plugin, const void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 632533cb47..0a9b8a9a50 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -860,6 +860,7 @@ struct plugin_api { struct viewport *viewport); void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw); #endif + int* __errno; }; /* plugin header */ diff --git a/firmware/include/errno.h b/firmware/include/errno.h index 846cd0e339..3a923238fc 100644 --- a/firmware/include/errno.h +++ b/firmware/include/errno.h @@ -10,7 +10,11 @@ #ifndef _SYS_ERRNO_H_ +#ifdef PLUGIN +#define errno (*rb->__errno) +#else extern int errno; +#endif #define EPERM 1 /* Not super-user */ #define ENOENT 2 /* No such file or directory */