- **status**: unassigned --> accepted
- **assigned_to**: Anders Widell
- **Milestone**: future --> 5.0.FC
---
** [tickets:#777] base: Add more glibc wrapper functions with error handling**
**Status:** accepted
**Milestone:** 5.0.FC
**Created:** Mon Feb 10, 2014 02:20 PM UTC by Anders Widell
**Last Updated:** Mon Mar 16, 2015 06:43 AM UTC
**Owner:** Anders Widell
This is a generic ticket for adding more convenience/utility functions to BASE.
The generic strategy is to add utility functions with the same name as the
corresponding glibc function, but with an osaf_ prefix. The utility functions
will have the following added value:
* For errno == EINTR, it will try the function again in a loop (only in the
case if EINTR is a possible result of the function according the the manual
page). Also note the important exception that the close() function shall NOT
have a loop when it returns EINTR (it's a fairly common mistake to implement
such a loop for close()).
* For errors that can only happen due to a bug in the program itself (e.g.
EFAULT, EINVAL, EBADF, EMFILE etc), call osaf_abort() to generate a core dump.
* For out-of-system-resources errors (ENOMEM, ENFILE etc), typically log a
message and terminate the process. We should not generate a core-dump, since
it's (probably) not a bug in the process itself (of course it could be, if it
is the one leaking memory). Still there is not much we can do if the system has
run out of memory or file descriptors so all we can do is exit.
* For run-time erros that can happen and do not necessarily mean there is a bug
(ECONNREFUSED, ENETUNREACH, ETIMEDOUT etc), typically log the error and return
-1 to let the caller handle the error. Logging in this case should be done with
care, if it is something that can happen often. One possibility is to only log
into a ring-buffer in the process' own memory, that can be inspected in a core
dump. Or we could have some kind of suppression mechanism to avoid filling up
the log files.
By using such utility functions, the program code can be made simpler. We don't
need to have loops checking for EINTR everywhere, and in many cases these
wrapper functions can be made so that they can never fail (meaning that the
process is terminated in such a case, and the function doesn't return to the
caller).
---
Sent from sourceforge.net because [email protected] is
subscribed to https://sourceforge.net/p/opensaf/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets