From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: implement Solaris support for system-process-attributes and list-system-processes Date: Thu, 18 Dec 2008 22:22:14 +0200 Message-ID: References: <200812180916.mBI9GJtr012310@mothra.ics.uci.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1229631758 4284 80.91.229.12 (18 Dec 2008 20:22:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Dec 2008 20:22:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 18 21:23:43 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LDPPK-0004ko-Qn for ged-emacs-devel@m.gmane.org; Thu, 18 Dec 2008 21:23:43 +0100 Original-Received: from localhost ([127.0.0.1]:56551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDPO8-0002ne-KL for ged-emacs-devel@m.gmane.org; Thu, 18 Dec 2008 15:22:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LDPO1-0002lK-Vq for emacs-devel@gnu.org; Thu, 18 Dec 2008 15:22:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LDPO0-0002jv-Th for emacs-devel@gnu.org; Thu, 18 Dec 2008 15:22:21 -0500 Original-Received: from [199.232.76.173] (port=32875 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDPO0-0002jm-Pw for emacs-devel@gnu.org; Thu, 18 Dec 2008 15:22:20 -0500 Original-Received: from mtaout1.012.net.il ([84.95.2.1]:29423) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LDPO0-0006H4-8W for emacs-devel@gnu.org; Thu, 18 Dec 2008 15:22:20 -0500 Original-Received: from conversion-daemon.i-mtaout1.012.net.il by i-mtaout1.012.net.il (HyperSendmail v2007.08) id <0KC300J009X57700@i-mtaout1.012.net.il> for emacs-devel@gnu.org; Thu, 18 Dec 2008 22:24:39 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.127.241.241]) by i-mtaout1.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KC300H5CA139S10@i-mtaout1.012.net.il>; Thu, 18 Dec 2008 22:24:39 +0200 (IST) In-reply-to: <200812180916.mBI9GJtr012310@mothra.ics.uci.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107039 Archived-At: > Date: Thu, 18 Dec 2008 01:16:19 -0800 (PST) > From: Dan Nicolaescu > > #ifdef SOLARIS2 > #if !defined (_LP64) && defined (_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) > #define PROCFS_FILE_OFFSET_BITS_HACK 1 > #undef _FILE_OFFSET_BITS > #else > #define PROCFS_FILE_OFFSET_BITS_HACK 0 > #endif > #include > #if PROCFS_FILE_OFFSET_BITS_HACK == 1 > #define _FILE_OFFSET_BITS 64 > #endif > #endif /* SOLARIS2 */ > > procfs.h is the header file that contains the proc data structures, but > it has an #error if compiled in 32 bit mode and _FILE_OFFSET_BITS is > 64. > emacs/src/config.in will define _FILE_OFFSET_BITS to 64 when compiled on > a 32 bit solaris system. Hence the above hackery. Can this hackery be moved to a Solaris-specific header file in src/s/ ? > 2. process.c has a function `procfs_list_system_processes' that works on > Solaris (and probably on all systems that use a /proc). > The problem is that procfs_list_system_processes is inside a #ifdef HAVE_PROCFS > that contains a few other functions (time_from_jiffies, get_up_time) > that are Linux specific. > Should I move those functions inside a #ifdef LINUX ? I guess GNU_LINUX would be better, and perhaps move them to sysdep.c while at that. > 4. Flist_system_processes and Fsystem_process_attributes use the > LISTPROC and PROCATTR macros for function calls that need to be defined in src/s/*.h > These macros are different from how other platform specific functions > are implemented in emacs, and they seem to be a bit redundant: the > functions to implement these are system specific anyway.... I hoped that systems with procfs will have only minor differences, that's why I opted for these macros. In addition, having the macros provides an easy way of switching between 2 different implementations on the same platform. But these are not very important reasons, so I don't object to some different solution. > So what's the best way to integrate Solaris support? > Again the existing procfs_list_system_processes function can probably be > used by all systems using /proc, but procfs_system_process_attributes > is very likely to be OS specific. If /proc systems are different to the degree that splitting them into a common part and OS-specific parts is impractical or unjustified, I think the implementations of procfs_system_process_attributes should be moved to sysdep.c, and there we could have a separate variant for each OS.