Add missing api from Tizen 2.4 92/40692/2 accepted/tizen/3.0.2015.q2/common/20150609.181954 accepted/tizen/common/20150609.084329 accepted/tizen/mobile/20150609.085908 accepted/tizen/tv/20150609.085925 accepted/tizen/wearable/20150609.085942 submit/tizen/20150608.075047 submit/tizen_3.0.2015.q2_common/20150609.170642
authorSangyoon Jang <s89.jang@samsung.com>
Mon, 8 Jun 2015 07:30:39 +0000 (16:30 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 8 Jun 2015 07:33:25 +0000 (16:33 +0900)
added:
vconf_get_ext_errno

to get more specific error code

Change-Id: I377b02d42515ee718b20cd5511ca747439f86fd2
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
include/vconf-buxton.h
src/vconf-buxton.c

index 2ad453d..504f846 100644 (file)
  * @{
  */
 
+#include <errno.h>
 #include "vconf-buxton-keys.h"
 
 #ifdef __cplusplus
 extern          "C" {
 #endif
 
+#define VCONF_OK                 0
+#define VCONF_ERROR             -1
+#define VCONF_ERROR_FILE_NO_ENT -ENOENT
+#define VCONF_ERROR_FILE_PERM   -EPERM
+
 /**
  * @brief Enumeration for uses of vconf_get().
  * @since_tizen 2.3
@@ -1206,6 +1212,15 @@ int main()
     int             vconf_exists(const char *keyname);
 
 /**
+ * This function returns result of last api call
+ * @return The result of last api call
+ * @retval #VCONF_OK                 Successful
+ * @retval #VCONF_ERROR              General error
+ * @retval #VCONF_ERROR_FILE_NO_ENT  No such key
+ * @retval #VCONF_ERROR_FILE_PERM    Permission denied
+ */
+    int             vconf_get_ext_errno(void);
+/**
  * @}
  */
 
index ea6a232..db3731e 100644 (file)
@@ -57,9 +57,6 @@
 #include "vconf-buxton.h"
 #include "log.h"
 
-#define VCONF_OK      0
-#define VCONF_ERROR  -1
-
 /*================= SECTION definition of types =============*/
 
 /*
@@ -239,6 +236,11 @@ static int internal_list_count = 0;
 static GSource *glib_source = NULL;
 #endif
 
+/*
+ * error code for vconf_get_ext_errno()
+ */
+static int g_vconf_errno = 0;
+
 #if !defined(NO_MULTITHREADING)
 /*
  * multithreaded protection
@@ -679,7 +681,7 @@ _cb_inc_received_ (BuxtonResponse resp, keynode_t * keynode)
 
   list = keynode->list;
   list->cb_received++;
-  if (buxton_response_status (resp) != 0)
+  if ((g_vconf_errno = buxton_response_status (resp)) != 0)
     {
       ERR ("Buxton returned error %d for key %s",
           buxton_response_status (resp), keynode->keyname);
@@ -761,7 +763,7 @@ _cb_refresh_ (BuxtonResponse resp, keynode_t * keynode)
 
   list = keynode->list;
   list->cb_received++;
-  if (buxton_response_status (resp) != 0)
+  if ((g_vconf_errno = buxton_response_status (resp)) != 0)
     {
       ERR ("Error %d while getting buxton key %s",
           buxton_response_status (resp), keynode->keyname);
@@ -790,7 +792,7 @@ _cb_scan_ (BuxtonResponse resp, struct scanning_data *data)
   /*
    * check the response status 
    */
-  if (buxton_response_status (resp) != 0)
+  if ((g_vconf_errno = buxton_response_status (resp)) != 0)
     {
       ERR ("Error while getting list of names from buxton");
       data->cb_status = VCONF_ERROR;
@@ -2085,3 +2087,10 @@ vconf_get_str (const char *keyname)
 
   return single.node.value.s;
 }
+
+int
+vconf_get_ext_errno (void)
+{
+  INFO("vconf errno: %d", g_vconf_errno);
+  return g_vconf_errno;
+}