Always define gligtop_machine.
There was an ABI mismatch because HAVE_GLIBTOP_MACHINE was only defined when compiling the library itself. The library code would then use a larger struct glibtop (with a machine member) than the application code. Everyone defines a glibtop_machine but linux (though it as a glibtop_machine.h) and cygwin (code unchanged for 5 years) so this should not break anything.
This commit is contained in:
committed by
Benoît Dejean
parent
5c6879baab
commit
4e0d819264
10
configure.ac
10
configure.ac
@@ -275,10 +275,6 @@ dnl These definitions are expanded in make.
|
|||||||
LIBGTOP_LIBS='-L$(libdir)'
|
LIBGTOP_LIBS='-L$(libdir)'
|
||||||
LIBGTOP_INCS='-I$(includedir)/libgtop-2.0'
|
LIBGTOP_INCS='-I$(includedir)/libgtop-2.0'
|
||||||
|
|
||||||
if test x$libgtop_use_machine_h = xyes ; then
|
|
||||||
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_GLIBTOP_MACHINE_H"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$libgtop_have_sysinfo = xyes ; then
|
if test x$libgtop_have_sysinfo = xyes ; then
|
||||||
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
|
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
|
||||||
fi
|
fi
|
||||||
@@ -307,12 +303,6 @@ LIBGTOP_EXTRA_LIBS="$GLIB_LIBS $LIBGTOP_EXTRA_LIBS"
|
|||||||
|
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS"
|
LIBGTOP_LIBS="$LIBGTOP_LIBS"
|
||||||
|
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS"
|
|
||||||
|
|
||||||
machine_incs="-I\$(top_srcdir)/sysdeps/$sysdeps_dir"
|
|
||||||
|
|
||||||
AC_SUBST(machine_incs)
|
|
||||||
|
|
||||||
if test "$GCC" = "yes" ; then
|
if test "$GCC" = "yes" ; then
|
||||||
CFLAGS="\
|
CFLAGS="\
|
||||||
-Winline \
|
-Winline \
|
||||||
|
|||||||
63
glibtop.h
63
glibtop.h
@@ -55,9 +55,7 @@ LIBGTOP_MICRO_VERSION >= (micro)))
|
|||||||
|
|
||||||
#include <glibtop_server.h>
|
#include <glibtop_server.h>
|
||||||
|
|
||||||
#ifdef HAVE_GLIBTOP_MACHINE_H
|
|
||||||
#include <glibtop_machine.h>
|
#include <glibtop_machine.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GLIBTOP_MOUNTENTRY_LEN
|
#ifndef GLIBTOP_MOUNTENTRY_LEN
|
||||||
#define GLIBTOP_MOUNTENTRY_LEN 79
|
#define GLIBTOP_MOUNTENTRY_LEN 79
|
||||||
@@ -69,59 +67,30 @@ LIBGTOP_MICRO_VERSION >= (micro)))
|
|||||||
#include <glibtop/close.h>
|
#include <glibtop/close.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_GLIBTOP_MACHINE_H
|
|
||||||
|
|
||||||
struct _glibtop
|
struct _glibtop
|
||||||
{
|
{
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
unsigned method; /* Server Method */
|
unsigned method; /* Server Method */
|
||||||
unsigned error_method; /* Error Method */
|
unsigned error_method; /* Error Method */
|
||||||
|
int input [2]; /* Pipe client <- server */
|
||||||
|
int output [2]; /* Pipe client -> server */
|
||||||
|
int socket; /* Accepted connection of a socket */
|
||||||
|
int ncpu; /* Number of CPUs, zero if single-processor */
|
||||||
|
int real_ncpu; /* Real number of CPUs. Only ncpu are monitored */
|
||||||
|
unsigned long os_version_code; /* Version code of the operating system */
|
||||||
|
const char *name; /* Program name for error messages */
|
||||||
|
const char *server_command; /* Command used to invoke server */
|
||||||
|
const char *server_host; /* Host the server should run on */
|
||||||
|
const char *server_user; /* Name of the user on the target host */
|
||||||
|
const char *server_rsh; /* Command used to connect to the target host */
|
||||||
|
unsigned long features; /* Server is required for this features */
|
||||||
|
unsigned long server_port; /* Port on which daemon is listening */
|
||||||
|
glibtop_sysdeps sysdeps; /* Detailed feature list */
|
||||||
|
glibtop_sysdeps required; /* Required feature list */
|
||||||
|
pid_t pid; /* PID of the server */
|
||||||
glibtop_machine machine; /* Machine dependent data */
|
glibtop_machine machine; /* Machine dependent data */
|
||||||
int input [2]; /* Pipe client <- server */
|
|
||||||
int output [2]; /* Pipe client -> server */
|
|
||||||
int socket; /* Accepted connection of a socket */
|
|
||||||
int ncpu; /* Number of CPUs, zero if single-processor */
|
|
||||||
int real_ncpu; /* Real number of CPUs. Only ncpu are monitored */
|
|
||||||
unsigned long os_version_code; /* Version code of the operating system */
|
|
||||||
const char *name; /* Program name for error messages */
|
|
||||||
const char *server_command; /* Command used to invoke server */
|
|
||||||
const char *server_host; /* Host the server should run on */
|
|
||||||
const char *server_user; /* Name of the user on the target host */
|
|
||||||
const char *server_rsh; /* Command used to connect to the target host */
|
|
||||||
unsigned long features; /* Server is required for this features */
|
|
||||||
unsigned long server_port; /* Port on which daemon is listening */
|
|
||||||
glibtop_sysdeps sysdeps; /* Detailed feature list */
|
|
||||||
glibtop_sysdeps required; /* Required feature list */
|
|
||||||
pid_t pid; /* PID of the server */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* !HAVE_GLIBTOP_MACHINE_H */
|
|
||||||
|
|
||||||
struct _glibtop
|
|
||||||
{
|
|
||||||
unsigned flags;
|
|
||||||
unsigned method; /* Server Method */
|
|
||||||
unsigned error_method; /* Error Method */
|
|
||||||
int input [2]; /* Pipe client <- server */
|
|
||||||
int output [2]; /* Pipe client -> server */
|
|
||||||
int socket; /* Accepted connection of a socket */
|
|
||||||
int ncpu; /* Number of CPUs, zero if single-processor */
|
|
||||||
int real_ncpu; /* Real number of CPUs. Only ncpu are monitored */
|
|
||||||
unsigned long os_version_code; /* Version code of the operating system */
|
|
||||||
const char *name; /* Program name for error messages */
|
|
||||||
const char *server_command; /* Command used to invoke server */
|
|
||||||
const char *server_host; /* Host the server should run on */
|
|
||||||
const char *server_user; /* Name of the user on the target host */
|
|
||||||
const char *server_rsh; /* Command used to connect to the target host */
|
|
||||||
unsigned long features; /* Server is required for this features */
|
|
||||||
unsigned long server_port; /* Port on which daemon is listening */
|
|
||||||
glibtop_sysdeps sysdeps; /* Detailed feature list */
|
|
||||||
glibtop_sysdeps required; /* Required feature list */
|
|
||||||
pid_t pid; /* PID of the server */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* HAVE_GLIBTOP_MACHINE_H */
|
|
||||||
|
|
||||||
extern glibtop *glibtop_global_server;
|
extern glibtop *glibtop_global_server;
|
||||||
|
|
||||||
extern const unsigned long glibtop_server_features;
|
extern const unsigned long glibtop_server_features;
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ dnl
|
|||||||
dnl It defines the following variables:
|
dnl It defines the following variables:
|
||||||
dnl
|
dnl
|
||||||
dnl * 'libgtop_sysdeps_dir' - sysdeps dir for libgtop.
|
dnl * 'libgtop_sysdeps_dir' - sysdeps dir for libgtop.
|
||||||
dnl * 'libgtop_use_machine_h' - some of system dependend parts of libgtop provide
|
|
||||||
dnl their own header file. In this case we need to
|
|
||||||
dnl define 'HAVE_GLIBTOP_MACHINE_H'.
|
|
||||||
dnl * 'libgtop_need_server' - is the server really needed? Defines 'LIBGTOP_NEED_SERVER'
|
dnl * 'libgtop_need_server' - is the server really needed? Defines 'LIBGTOP_NEED_SERVER'
|
||||||
dnl if true; defines conditional 'LIBGTOP_NEED_SERVER'.
|
dnl if true; defines conditional 'LIBGTOP_NEED_SERVER'.
|
||||||
|
|
||||||
@@ -14,7 +11,6 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
|
|
||||||
AC_SUBST(libgtop_sysdeps_dir)
|
AC_SUBST(libgtop_sysdeps_dir)
|
||||||
AC_SUBST(libgtop_use_machine_h)
|
|
||||||
AC_SUBST(libgtop_need_server)
|
AC_SUBST(libgtop_need_server)
|
||||||
|
|
||||||
AC_ARG_WITH(libgtop-examples,
|
AC_ARG_WITH(libgtop-examples,
|
||||||
@@ -36,7 +32,6 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux*)
|
linux*)
|
||||||
libgtop_sysdeps_dir=linux
|
libgtop_sysdeps_dir=linux
|
||||||
libgtop_use_machine_h=no
|
|
||||||
libgtop_have_sysinfo=yes
|
libgtop_have_sysinfo=yes
|
||||||
libgtop_need_server=no
|
libgtop_need_server=no
|
||||||
libgtop_sysdeps_private_mountlist=yes
|
libgtop_sysdeps_private_mountlist=yes
|
||||||
@@ -44,13 +39,11 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
;;
|
;;
|
||||||
netbsd*|bsdi*)
|
netbsd*|bsdi*)
|
||||||
libgtop_sysdeps_dir=bsd
|
libgtop_sysdeps_dir=bsd
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server2'
|
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server2'
|
||||||
;;
|
;;
|
||||||
openbsd*)
|
openbsd*)
|
||||||
libgtop_sysdeps_dir=openbsd
|
libgtop_sysdeps_dir=openbsd
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_sysdeps_private_mountlist=yes
|
libgtop_sysdeps_private_mountlist=yes
|
||||||
libgtop_sysdeps_private_fsusage=yes
|
libgtop_sysdeps_private_fsusage=yes
|
||||||
@@ -58,7 +51,6 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
;;
|
;;
|
||||||
freebsd*|kfreebsd*)
|
freebsd*|kfreebsd*)
|
||||||
libgtop_sysdeps_dir=freebsd
|
libgtop_sysdeps_dir=freebsd
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_sysdeps_private_mountlist=yes
|
libgtop_sysdeps_private_mountlist=yes
|
||||||
libgtop_sysdeps_private_fsusage=yes
|
libgtop_sysdeps_private_fsusage=yes
|
||||||
@@ -66,27 +58,23 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
;;
|
;;
|
||||||
solaris*)
|
solaris*)
|
||||||
libgtop_sysdeps_dir=solaris
|
libgtop_sysdeps_dir=solaris
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
|
libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
|
||||||
;;
|
;;
|
||||||
aix*)
|
aix*)
|
||||||
libgtop_sysdeps_dir=aix
|
libgtop_sysdeps_dir=aix
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_have_sysinfo=yes
|
libgtop_have_sysinfo=yes
|
||||||
libgtop_postinstall='chgrp system $(bindir)/libgtop_server && chmod g+s $(bindir)/libgtop_server2'
|
libgtop_postinstall='chgrp system $(bindir)/libgtop_server && chmod g+s $(bindir)/libgtop_server2'
|
||||||
;;
|
;;
|
||||||
darwin*)
|
darwin*)
|
||||||
libgtop_sysdeps_dir=darwin
|
libgtop_sysdeps_dir=darwin
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
libgtop_have_sysinfo=yes
|
libgtop_have_sysinfo=yes
|
||||||
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod g+s $(bindir)/libgtop_server2'
|
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod g+s $(bindir)/libgtop_server2'
|
||||||
;;
|
;;
|
||||||
cygwin*)
|
cygwin*)
|
||||||
libgtop_sysdeps_dir=cygwin
|
libgtop_sysdeps_dir=cygwin
|
||||||
libgtop_use_machine_h=no
|
|
||||||
libgtop_need_server=no
|
libgtop_need_server=no
|
||||||
libgtop_have_sysinfo=yes
|
libgtop_have_sysinfo=yes
|
||||||
libgtop_sysdeps_private_mountlist=yes
|
libgtop_sysdeps_private_mountlist=yes
|
||||||
@@ -98,23 +86,19 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
|||||||
#Please note that this port is obsolete and not working at
|
#Please note that this port is obsolete and not working at
|
||||||
#all. It is only useful for people who want to fix it ... :-)
|
#all. It is only useful for people who want to fix it ... :-)
|
||||||
libgtop_sysdeps_dir=sun4
|
libgtop_sysdeps_dir=sun4
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
;;
|
;;
|
||||||
osf*)
|
osf*)
|
||||||
libgtop_sysdeps_dir=osf1
|
libgtop_sysdeps_dir=osf1
|
||||||
libgtop_use_machine_h=yes
|
|
||||||
libgtop_need_server=yes
|
libgtop_need_server=yes
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
libgtop_sysdeps_dir=stub
|
libgtop_sysdeps_dir=stub
|
||||||
libgtop_use_machine_h=no
|
|
||||||
libgtop_need_server=no
|
libgtop_need_server=no
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
libgtop_sysdeps_dir=stub
|
libgtop_sysdeps_dir=stub
|
||||||
libgtop_use_machine_h=no
|
|
||||||
libgtop_need_server=no
|
libgtop_need_server=no
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -277,9 +261,6 @@ main (void)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_MSG_CHECKING(for machine.h in libgtop sysdeps dir)
|
|
||||||
AC_MSG_RESULT($libgtop_use_machine_h)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether we need libgtop)
|
AC_MSG_CHECKING(whether we need libgtop)
|
||||||
AC_MSG_RESULT($libgtop_need_server)
|
AC_MSG_RESULT($libgtop_need_server)
|
||||||
|
|
||||||
@@ -287,11 +268,6 @@ main (void)
|
|||||||
AC_DEFINE(LIBGTOP_NEED_SERVER, 1, [Define if libgtop server is required])
|
AC_DEFINE(LIBGTOP_NEED_SERVER, 1, [Define if libgtop server is required])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$libgtop_use_machine_h = xyes ; then
|
|
||||||
AC_DEFINE(HAVE_GLIBTOP_MACHINE_H, 1,
|
|
||||||
[Define if machine.h in libgtop sysdeps dir])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL(LIBGTOP_NEED_SERVER, test x$libgtop_need_server = xyes)
|
AM_CONDITIONAL(LIBGTOP_NEED_SERVER, test x$libgtop_need_server = xyes)
|
||||||
AM_CONDITIONAL(LIBGTOP_SYSDEPS_PRIVATE_MOUNTLIST, test x$libgtop_sysdeps_private_mountlist = xyes)
|
AM_CONDITIONAL(LIBGTOP_SYSDEPS_PRIVATE_MOUNTLIST, test x$libgtop_sysdeps_private_mountlist = xyes)
|
||||||
AM_CONDITIONAL(LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE, test x$libgtop_sysdeps_private_fsusage = xyes)
|
AM_CONDITIONAL(LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE, test x$libgtop_sysdeps_private_fsusage = xyes)
|
||||||
|
|||||||
Reference in New Issue
Block a user