All functions in the `glibtop_call_vector' now take an additional
2000-01-02 Martin Baulig <martin@home-of-linux.org> * include/glibtop/call-vector.pl: All functions in the `glibtop_call_vector' now take an additional `glibtop_backend *' argument.
This commit is contained in:
committed by
Martin Baulig
parent
68a40b5cba
commit
57d102425f
@@ -23,17 +23,19 @@
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glibtop/read.h>
|
||||
#include <glibtop/write.h>
|
||||
#include <glibtop/read_data.h>
|
||||
|
||||
#include <glibtop/command.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/backend.h>
|
||||
|
||||
#include <glibtop-backend-private.h>
|
||||
|
||||
void *
|
||||
glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
||||
const void *send_buf, size_t recv_size, void *recv_buf,
|
||||
int *retval_ptr)
|
||||
glibtop_call_i (glibtop *server, glibtop_backend *backend, unsigned command,
|
||||
size_t send_size, const void *send_buf, size_t recv_size,
|
||||
void *recv_buf, int *retval_ptr)
|
||||
{
|
||||
glibtop_command cmnd;
|
||||
glibtop_response response;
|
||||
@@ -56,16 +58,16 @@ glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
||||
cmnd.data_size = send_size;
|
||||
}
|
||||
|
||||
glibtop_write_l (server, sizeof (glibtop_command), &cmnd);
|
||||
glibtop_write_i (server, backend, sizeof (glibtop_command), &cmnd);
|
||||
|
||||
glibtop_read_l (server, sizeof (glibtop_response), &response);
|
||||
glibtop_read_i (server, backend, sizeof (glibtop_response), &response);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "RESPONSE: %lu - %d\n",
|
||||
response.offset, response.data_size);
|
||||
#endif
|
||||
|
||||
glibtop_read_l (server, sizeof (int), &retval);
|
||||
glibtop_read_i (server, backend, sizeof (int), &retval);
|
||||
if (retval_ptr)
|
||||
*retval_ptr = retval;
|
||||
|
||||
@@ -76,7 +78,7 @@ glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
||||
if (response.data_size) {
|
||||
void *ptr = glibtop_malloc_r (server, response.data_size);
|
||||
|
||||
glibtop_read_l (server, response.data_size, ptr);
|
||||
glibtop_read_i (server, backend, response.data_size, ptr);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@@ -34,6 +34,11 @@ struct _glibtop_backend_private
|
||||
pid_t pid; /* PID of the server */
|
||||
};
|
||||
|
||||
void *
|
||||
glibtop_call_i (glibtop *server, glibtop_backend *backend, unsigned command,
|
||||
size_t send_size, const void *send_buf, size_t recv_size,
|
||||
void *recv_buf, int *retval_ptr);
|
||||
|
||||
void
|
||||
glibtop_read_i (glibtop *server, glibtop_backend *backend,
|
||||
size_t size, void *buf);
|
||||
|
@@ -34,6 +34,8 @@ print '';
|
||||
print '#include <glibtop/command.h>';
|
||||
print '#include <glibtop/backend.h>';
|
||||
print '';
|
||||
print '#include <glibtop-backend-private.h>';
|
||||
print '';
|
||||
|
||||
$feature_count = 0;
|
||||
|
||||
@@ -174,7 +176,7 @@ sub output {
|
||||
$send_buf_code .= ";\n";
|
||||
|
||||
$call_code = '';
|
||||
$call_code .= sprintf ("\t%sglibtop_call_l (server, GLIBTOP_CMND_%s,\n",
|
||||
$call_code .= sprintf ("\t%sglibtop_call_i (server, backend, GLIBTOP_CMND_%s,\n",
|
||||
$call_prefix, &toupper($feature));
|
||||
$call_code .= sprintf ("\t\t\t%s%s, %s,\n", $call_prefix_space,
|
||||
"_LIBGTOP_SEND_len", "_LIBGTOP_SEND_ptr");
|
||||
@@ -210,16 +212,16 @@ sub output {
|
||||
|
||||
$func_decl = 'static '.$retval."\n";
|
||||
if ($line_fields[3] eq '') {
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server%s)\n",
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, glibtop_backend *backend%s)\n",
|
||||
$feature, $param_decl);
|
||||
} elsif ($line_fields[3] eq 'array') {
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, glibtop_array *array%s)\n",
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, glibtop_backend *backend, glibtop_array *array%s)\n",
|
||||
$feature, $param_decl);
|
||||
} elsif ($line_fields[3] =~ /^array/) {
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, glibtop_array *array, %s *buf%s)\n",
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, glibtop_backend *backend, glibtop_array *array, %s *buf%s)\n",
|
||||
$feature, 'glibtop_'.$feature, $param_decl);
|
||||
} else {
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, %s *buf%s)\n",
|
||||
$func_decl .= sprintf ("_glibtop_get_%s_c (glibtop *server, glibtop_backend *backend, %s *buf%s)\n",
|
||||
$feature, 'glibtop_'.$feature, $param_decl);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user