gam_server, Solaris and high CPU load

Since upgrading to s11b83a I noticed that gam_server processes eat significant amount of CPU cycles. So I decided to make some investigations.

# uname -a
SunOS xeon 5.11 snv_83 i86pc i386 i86pc
# pkginfo -l SUNWgamin
PKGINST:  SUNWgamin
NAME:  Library providing the FAM File Alteration Monitor API
CATEGORY:  GNOME2,application,JDS4
ARCH:  i386
VERSION:  0.1.9,REV=110.0.4.2008.01.28.02.48
. . .
# fgrep SUNWgamin /var/sadm/install/contents
/usr/lib/gam_server f ...
/usr/lib/libfam.so=libfam.so.0.0.0 s ...
/usr/lib/libfam.so.0=libfam.so.0.0.0 s ...
/usr/lib/libfam.so.0.0.0 f ...
/usr/lib/libgamin-1.so=libgamin-1.so.0.1.9 s ...
/usr/lib/libgamin-1.so.0=libgamin-1.so.0.1.9 s ...
/usr/lib/libgamin-1.so.0.1.9 f ...
/usr/lib/python2.4/vendor-packages/_gamin.so f ...
/usr/lib/python2.4/vendor-packages/gamin.py f ...

No manuals, no config files.

# strings  /usr/lib/gam_server
. . .
/.gaminrc
/etc/gamin/mandatory_gaminrc
/etc/gamin/gaminrc

From Gamin project page:

Gamin is a file and directory monitoring system defined to be a subset of the FAM (File Alteration Monitor) system. This is a service provided by a library which allows to detect when a file or a directory has been modified.

This is the description of the config file: Gamin config


Now, how to fix the problem

  1. Create /etc/gamin directory:
    # mkdir /etc/gamin
  2. Create file /etc/gamin/gaminrc. It may contain the following lines (this is just an example, you can set your own polling intervals):
    fsset nfs poll 15
    fsset ufs poll 15
    fsset lofs poll 15
    fsset zfs poll 15
  3. Restart gam_server (let me know if there is a better way):
    # pkill  gam_server;  rm -rf /tmp/gam_*

Voila! That should be done in all zones.

Update 2008-07-07 @00:06:24: i did not see this behaviour in snv_92. However, do not install snv_92 because of otehr bugs. Try snv_93.

How to compile wine under Solaris. Part I

Unfortunately, wine can not be compiled under Solaris “as is”. Some tricks are needed.

    If you do not needed LDAP and 16bit support, turn them off:

  • ./configure --without-ldap --disable-win16
  • To get rid of the following error:
    In file included from object.h:30,
    from fd.c:76:
    ../include/wine/list.h:25: error: redefinition of `struct list'
    ../include/wine/list.h:97: error: conflicting types for 'list_remove'
    /usr/include/sys/list.h:48: error: previous declaration of 'list_remove' was here
    ../include/wine/list.h:97: error: conflicting types for 'list_remove'
    /usr/include/sys/list.h:48: error: previous declaration of 'list_remove' was here
    ../include/wine/list.h:104: error: conflicting types for 'list_next'
    /usr/include/sys/list.h:53: error: previous declaration of 'list_next' was here
    ../include/wine/list.h:104: error: conflicting types for 'list_next'
    /usr/include/sys/list.h:53: error: previous declaration of 'list_next' was here
    ../include/wine/list.h:112: error: conflicting types for 'list_prev'
    /usr/include/sys/list.h:54: error: previous declaration of 'list_prev' was here
    ../include/wine/list.h:112: error: conflicting types for 'list_prev'
    /usr/include/sys/list.h:54: error: previous declaration of 'list_prev' was here
    ../include/wine/list.h:120: error: conflicting types for 'list_head'
    /usr/include/sys/list.h:51: error: previous declaration of 'list_head' was here
    ../include/wine/list.h:120: error: conflicting types for 'list_head'
    /usr/include/sys/list.h:51: error: previous declaration of 'list_head' was here
    ../include/wine/list.h:126: error: conflicting types for 'list_tail'
    /usr/include/sys/list.h:52: error: previous declaration of 'list_tail' was here
    ../include/wine/list.h:126: error: conflicting types for 'list_tail'
    /usr/include/sys/list.h:52: error: previous declaration of 'list_tail' was here
    ../include/wine/list.h:153: warning: static declaration of 'list_move_tail' follows non-static declaration
    /usr/include/sys/list.h:49: warning: previous declaration of 'list_move_tail' was here
    gmake[1]: *** [fd.o] Error 1
    gmake[1]: Leaving directory `/var/tmp/wine-0.9.56/server'
    gmake: *** [server] Error 2
    

    Change server/fd.c:

    *** 71,76 ****
    --- 71,88 ----
    #include <sys/types.h>
    #include  <unistd.h>
    + /*
    +  struct list is defined at sys/list_impl.h on solaris
    +  this patches work around it.
    +  */
    + #define list		WINELIST
    + #define list_remove	WINELIST_REMOVE
    + #define list_next	WINELIST_NEXT
    + #define list_prev	WINELIST_PREV
    + #define list_head	WINELIST_HEAD
    + #define list_tail	WINELIST_TAIL
    + #define list_move_tail	WINELIST_MOVE_TAIL
    +
    #include "ntstatus.h"
    #define WIN32_NO_STATUS
    #include "object.h"
    
  • Compile with /usr/sfw/bin/gcc not /opt/csw/bin/gcc. You can successfully compile wine with CSWgcc but if you run wine or winecfg you will get the following error (at least under Solaris 11 builds83a-86):
    $ winecfg
    sock_init: ERROR in sock_check_pollhup()
    Assertion failed: next->flags & VFLAG_SYSTEM, file virtual.c, line 467
    Abort