From d0441219cb09bf781a0ce0eef8caacda4c5b41ce Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Wed, 22 Dec 1999 13:09:42 +0000 Subject: [PATCH] New global function to return `server->glibtop_errno'. 1999-12-22 Martin Baulig * lib/errors.c (glibtop_get_errno_l): New global function to return `server->glibtop_errno'. (glibtop_clear_errno_l): New global function to return `server->glibtop_errno' and set it back to 0. --- ChangeLog | 15 +++++++-------- include/glibtop/errors.h | 3 +++ lib/errors.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index edc4a183..a9a255cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,23 +1,22 @@ 1999-12-22 Martin Baulig + * lib/errors.c (glibtop_get_errno_l): New global function + to return `server->glibtop_errno'. + (glibtop_clear_errno_l): New global function to return + `server->glibtop_errno' and set it back to 0. + * include/glibtop/errors.h + (GLIBTOP_ERROR_SERVER_COMM_FAILURE): New error constant. + (GLIBTOP_ERROR_NO_SUCH_PROCESS): New error constant. (GLIBTOP_ERROR_NO_KERNEL_SUPPORT): New error constant. (GLIBTOP_ERROR_INCOMPATIBLE_KERNEL): New error constant. - * lib/errors.c (glibtop_get_errno_l): New global function. - * lib/lib.pl: For functions with a `retval' return type, set `server->glibtop_errno' to the error code on error or to zero on success. -1999-12-22 Martin Baulig - * glibtop.h (glibtop): Added `glibtop_errno' field. - * include/glibtop/errors.h - (GLIBTOP_ERROR_SERVER_COMM_FAILURE): New error constant. - (GLIBTOP_ERROR_NO_SUCH_PROCESS): New error constant. - 1999-12-19 Martin Baulig * include/glibtop/glib-arrays.h: New file. diff --git a/include/glibtop/errors.h b/include/glibtop/errors.h index f56d84de..7a4556d5 100644 --- a/include/glibtop/errors.h +++ b/include/glibtop/errors.h @@ -52,6 +52,9 @@ glibtop_get_error_string_l (glibtop *server, unsigned error_number); unsigned glibtop_get_errno_l (glibtop *server); +unsigned +glibtop_clear_errno_l (glibtop *server); + END_LIBGTOP_DECLS #endif diff --git a/lib/errors.c b/lib/errors.c index 36ab5a4f..2b5f518d 100644 --- a/lib/errors.c +++ b/lib/errors.c @@ -52,3 +52,13 @@ glibtop_get_errno_l (glibtop *server) { return server->glibtop_errno; } + +unsigned +glibtop_clear_errno_l (glibtop *server) +{ + unsigned old_errno; + + old_errno = server->glibtop_errno; + server->glibtop_errno = 0; + return old_errno; +}