{
struct poll_instance *poll_instance;
SaErrorT error;
+ int res = 0;
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
goto error_exit;
}
saHandleInstancePut (&poll_instance_database, handle);
- return (0);
-
error_exit:
- return (-1);
+ return (res);
}
int poll_dispatch_add (
int found = 0;
int install_pos;
SaErrorT error;
+ int res = 0;
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
goto error_exit;
}
(poll_instance->poll_entry_count + 1) *
sizeof (struct poll_entry));
if (poll_entries == 0) {
- errno = ENOMEM;
- goto error_exit;
+ res = -ENOMEM;
+ goto error_put;
}
poll_instance->poll_entries = poll_entries;
(poll_instance->poll_entry_count + 1) *
sizeof (struct pollfd));
if (ufds == 0) {
- errno = ENOMEM;
- goto error_exit;
+ res = -ENOMEM;
+ goto error_put;
}
poll_instance->ufds = ufds;
poll_instance->poll_entries[install_pos].dispatch_fn = dispatch_fn;
poll_instance->poll_entries[install_pos].data = data;
+error_put:
saHandleInstancePut (&poll_instance_database, handle);
- return (0);
-
error_exit:
- return (-1);
+ return (res);
}
int poll_dispatch_modify (
struct poll_instance *poll_instance;
int i;
SaErrorT error;
+ int res = 0;
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
goto error_exit;
}
poll_instance->poll_entries[i].ufd.events = events;
poll_instance->poll_entries[i].dispatch_fn = dispatch_fn;
poll_instance->poll_entries[i].prio = prio;
- return (0);
+
+ goto error_put;
}
}
- errno = EBADF;
+ res = -EBADF;
+error_put:
saHandleInstancePut (&poll_instance_database, handle);
error_exit:
- return (-1);
+ return (res);
}
int poll_dispatch_delete (
int i;
SaErrorT error;
int found = 0;
+ int res = 0;
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
goto error_exit;
}
}
}
+ res = -EBADF;
if (found) {
poll_instance->ufds[i].fd = -1;
poll_instance->ufds[i].revents = 0;
+ res = 0;
}
+
saHandleInstancePut (&poll_instance_database, handle);
- return (0);
error_exit:
- errno = EBADF;
- return (-1);
+ return (res);
}
int poll_timer_add (
poll_timer_handle *timer_handle_out)
{
struct poll_instance *poll_instance;
- int res = -1;
+ int res = 0;
SaErrorT error;
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
+
goto error_exit;
}
timerlist_add_future (&poll_instance->timerlist,
timer_fn, data, msec_in_future, timer_handle_out);
- if (timer_handle_out != 0) {
- res = 0;
+ if (timer_handle_out == 0) {
+ res = -ENOENT;
}
saHandleInstancePut (&poll_instance_database, handle);
{
struct poll_instance *poll_instance;
SaErrorT error;
+ int res = 0;
if (timer_handle == 0) {
return (0);
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
goto error_exit;
}
saHandleInstancePut (&poll_instance_database, handle);
- return (0);
-
error_exit:
- return (-1);
+ return (res);
}
int poll_timer_delete_data (
poll_timer_handle timer_handle) {
struct poll_instance *poll_instance;
SaErrorT error;
+ int res = 0;
if (timer_handle == 0) {
return (0);
error = saHandleInstanceGet (&poll_instance_database, handle,
(void *)&poll_instance);
if (error != SA_OK) {
+ res = -ENOENT;
goto error_exit;
}
saHandleInstancePut (&poll_instance_database, handle);
- return (0);
-
error_exit:
- return (-1);
-
+ return (res);
}