New global function.

1999-12-22  Martin Baulig  <martin@home-of-linux.org>

	* 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.
This commit is contained in:
Martin Baulig
1999-12-22 11:50:47 +00:00
committed by Martin Baulig
parent d66768ac55
commit d86a386ad8
4 changed files with 25 additions and 0 deletions

View File

@@ -1,3 +1,11 @@
1999-12-22 Martin Baulig <martin@home-of-linux.org>
* 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 <martin@home-of-linux.org>
* glibtop.h (glibtop): Added `glibtop_errno' field.

View File

@@ -46,6 +46,9 @@ BEGIN_LIBGTOP_DECLS
char *
glibtop_get_error_string_l (glibtop *server, unsigned error_number);
unsigned
glibtop_get_errno_l (glibtop *server);
END_LIBGTOP_DECLS
#endif

View File

@@ -44,3 +44,9 @@ glibtop_get_error_string_l (glibtop *server, unsigned error_number)
return glibtop_strdup_r (server, _(glibtop_error_strings [error_number]));
}
unsigned
glibtop_get_errno_l (glibtop *server)
{
return server->glibtop_errno;
}

View File

@@ -221,6 +221,14 @@ sub output {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, buf%s);\n",
$prefix, $feature, $call_param);
}
if ($line_fields[1] eq 'retval') {
$sysdeps_code .= "\tif (retval < 0) {\n";
$sysdeps_code .= "\t\tserver->glibtop_errno = -retval;\n";
$sysdeps_code .= "\t\tgoto do_return;\n";
$sysdeps_code .= "\t} else {\n\t\tserver->glibtop_errno = 0;\n\t}\n\n";
}
$sysdeps_code .= "\tgoto check_missing;\n";
if ($orig !~ /^@/) {