[libgtop] Always define gligtop_machine.



commit 4e0d8192646165e8b859b7dfc3d6f53c22fb6cd4
Author: Benoit Dejean <bdejean gmail com>
Date:   Tue Jul 21 09:27:14 2015 +0200

    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.

 configure.ac       |   10 ----------
 glibtop.h          |   33 +--------------------------------
 libgtop-sysdeps.m4 |   24 ------------------------
 3 files changed, 1 insertions(+), 66 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 70efdaa..6dbbce3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,10 +275,6 @@ dnl These definitions are expanded in make.
 LIBGTOP_LIBS='-L$(libdir)'
 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
   LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
 fi
@@ -307,12 +303,6 @@ LIBGTOP_EXTRA_LIBS="$GLIB_LIBS $LIBGTOP_EXTRA_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
         CFLAGS="\
        -Winline \
diff --git a/glibtop.h b/glibtop.h
index 4ab947a..af02fe0 100644
--- a/glibtop.h
+++ b/glibtop.h
@@ -55,9 +55,7 @@ LIBGTOP_MICRO_VERSION >= (micro)))
 
 #include <glibtop_server.h>
 
-#ifdef HAVE_GLIBTOP_MACHINE_H
 #include <glibtop_machine.h>
-#endif
 
 #ifndef GLIBTOP_MOUNTENTRY_LEN
 #define GLIBTOP_MOUNTENTRY_LEN 79
@@ -69,34 +67,6 @@ LIBGTOP_MICRO_VERSION >= (micro)))
 #include <glibtop/close.h>
 
 
-#ifdef HAVE_GLIBTOP_MACHINE_H
-
-struct _glibtop
-{
-       unsigned flags;
-       unsigned method;                /* Server Method */
-       unsigned error_method;          /* Error Method */
-       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;
@@ -118,10 +88,9 @@ struct _glibtop
        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 */
 };
 
-#endif /* HAVE_GLIBTOP_MACHINE_H */
-
 extern glibtop *glibtop_global_server;
 
 extern const unsigned long glibtop_server_features;
diff --git a/libgtop-sysdeps.m4 b/libgtop-sysdeps.m4
index 8967f9a..9239251 100644
--- a/libgtop-sysdeps.m4
+++ b/libgtop-sysdeps.m4
@@ -4,9 +4,6 @@ dnl
 dnl It defines the following variables:
 dnl
 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                              if true; defines conditional 'LIBGTOP_NEED_SERVER'.
 
@@ -14,7 +11,6 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
        AC_REQUIRE([AC_CANONICAL_HOST])
 
        AC_SUBST(libgtop_sysdeps_dir)
-       AC_SUBST(libgtop_use_machine_h)
        AC_SUBST(libgtop_need_server)
 
        AC_ARG_WITH(libgtop-examples,
@@ -36,7 +32,6 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
        case "$host_os" in
        linux*)
          libgtop_sysdeps_dir=linux
-         libgtop_use_machine_h=no
          libgtop_have_sysinfo=yes
          libgtop_need_server=no
          libgtop_sysdeps_private_mountlist=yes
@@ -44,13 +39,11 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
          ;;
        netbsd*|bsdi*)
          libgtop_sysdeps_dir=bsd
-         libgtop_use_machine_h=yes
          libgtop_need_server=yes
          libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server2'
          ;;
        openbsd*)
          libgtop_sysdeps_dir=openbsd
-         libgtop_use_machine_h=yes
          libgtop_need_server=yes
          libgtop_sysdeps_private_mountlist=yes
          libgtop_sysdeps_private_fsusage=yes
@@ -58,7 +51,6 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
          ;;
        freebsd*|kfreebsd*)
          libgtop_sysdeps_dir=freebsd
-         libgtop_use_machine_h=yes
          libgtop_need_server=yes
          libgtop_sysdeps_private_mountlist=yes
          libgtop_sysdeps_private_fsusage=yes
@@ -66,27 +58,23 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
          ;;
        solaris*)
          libgtop_sysdeps_dir=solaris
-         libgtop_use_machine_h=yes
          libgtop_need_server=yes
          libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
          ;;
        aix*)
          libgtop_sysdeps_dir=aix
-         libgtop_use_machine_h=yes
          libgtop_need_server=yes
          libgtop_have_sysinfo=yes
          libgtop_postinstall='chgrp system $(bindir)/libgtop_server && chmod g+s $(bindir)/libgtop_server2'
          ;;
        darwin*)
          libgtop_sysdeps_dir=darwin
-         libgtop_use_machine_h=yes
          libgtop_need_server=yes
          libgtop_have_sysinfo=yes
          libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod g+s $(bindir)/libgtop_server2'
          ;;
        cygwin*)
          libgtop_sysdeps_dir=cygwin
-         libgtop_use_machine_h=no
          libgtop_need_server=no
          libgtop_have_sysinfo=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
              #all. It is only useful for people who want to fix it ... :-)
              libgtop_sysdeps_dir=sun4
-             libgtop_use_machine_h=yes
              libgtop_need_server=yes
              ;;
            osf*)
              libgtop_sysdeps_dir=osf1
-             libgtop_use_machine_h=yes
              libgtop_need_server=yes
              ;;
            *)
              libgtop_sysdeps_dir=stub
-             libgtop_use_machine_h=no
              libgtop_need_server=no
              ;;
            esac
          else
            libgtop_sysdeps_dir=stub
-           libgtop_use_machine_h=no
            libgtop_need_server=no
          fi
          ;;
@@ -277,9 +261,6 @@ main (void)
          ;;
        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_RESULT($libgtop_need_server)
 
@@ -287,11 +268,6 @@ main (void)
          AC_DEFINE(LIBGTOP_NEED_SERVER, 1, [Define if libgtop server is required])
        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_SYSDEPS_PRIVATE_MOUNTLIST, test x$libgtop_sysdeps_private_mountlist = xyes)
        AM_CONDITIONAL(LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE, test x$libgtop_sysdeps_private_fsusage = xyes)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]