[distcc] Small improvement to distccmon

Ernst Bachmann e.bachmann at xebec.de
Sun Jan 4 16:14:27 GMT 2004


Hi,

I'm using gentoo linux with distcc, which works great, but one little thing 
was annoying me:

I couldn't use the distccmon-tools as user to watch over the compilation.

Gentoo portage runs the compile as user "portage", gid "portage" (when the  
userpriv feature is enabled), and sets the permissions on the .distcc dir 
accordingly. My own user account is in group portage, and can read the distcc 
state/lock files quite fine, but still the compiles aren't displayed.

The reason is the orphan-check which checks for the existance of the process 
using kill. As the processes belong to the portage user, kill returns -1 with 
errno set to EPERM, meaning "The process is there, but not yours".

This tiny patch fixes it and allows one to watch another users distributed 
compile, as long as he may access his .distcc dir.

Greetings,
	Ernst

------------------------- cut here ---------------------

*** mon.c.orig  2004-01-04 16:48:11.466479096 +0100
--- mon.c       2004-01-04 16:53:07.863220236 +0100
***************
*** 165,177 ****
  /**
   * Check that the process named by the file still exists; if not,
   * return EXIT_GONE.
   **/
  static int dcc_mon_check_orphans(struct dcc_history *monl)
  {
!     return kill(monl->cpid, 0) ? EXIT_GONE : 0;
  }

--- 165,177 ----
  /**
   * Check that the process named by the file still exists; if not,
   * return EXIT_GONE.
   **/
  static int dcc_mon_check_orphans(struct dcc_history *monl)
  {
!     return (kill(monl->cpid, 0) && errno != EPERM) ? EXIT_GONE : 0;
  }





More information about the distcc mailing list