From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12594 invoked by alias); 21 Oct 2011 20:58:16 -0000 Received: (qmail 12585 invoked by uid 22791); 21 Oct 2011 20:58:16 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Oct 2011 20:58:00 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9LKvvlu030435 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Oct 2011 16:57:57 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9LKvu59016336; Fri, 21 Oct 2011 16:57:56 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p9LKvtZN020030; Fri, 21 Oct 2011 16:57:55 -0400 From: Tom Tromey To: Kwok Cheung Yeung Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add extra 'info os' information types for Linux References: <4E95DC58.7030805@codesourcery.com> Date: Fri, 21 Oct 2011 23:38:00 -0000 In-Reply-To: <4E95DC58.7030805@codesourcery.com> (Kwok Cheung Yeung's message of "Wed, 12 Oct 2011 19:28:40 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00611.txt.bz2 >>>>> ">" == Kwok Cheung Yeung writes: >> This patch greatly extends the OS information types available to the >> user using the 'info os' command in Linux. Since the OS info backend >> is now unified, this information can be obtained from both local and >> remote (gdbserver) targets. I think the idea is good. >> +static int >> +compare_processes (const void *process1, const void *process2) Most of the new functions need introductory comments. >> + static struct buffer buffer; Wow, another growable buffer type. I didn't know about this one. Let's see.. VEC, dynstr, obstack, buffer... can we have a 5th? :) >> + pid_t *process_list = (pid_t *) xmalloc (list_block_size * 2 * sizeof (pid_t)); Too bad VEC isn't available here. >> + char procentry[sizeof ("/proc/4294967295")]; One occasionally hears talk of 64 bit PIDs. >> +#if 0 >> + struct stat statbuf; >> + stat (dp2->d_name, &statbuf); >> +#endif No new #if 0 code. >> +static void >> +time_from_int (char *time, int maxlen, int seconds) Why int and not just time_t? ... >> + items_read = sscanf (buf, >> + "%d %d %o %d %d %d %d %u %u %u %u %d %d %d", >> + &key, &shmid, &perms, &size, >> + &cpid, &lpid, >> + &nattch, >> + &uid, &gid, &cuid, &cgid, >> + &atime, &dtime, &ctime); [...] >> + char atime_str[32], dtime_str[32], ctime_str[32]; [...] >> + time_from_int (atime_str, sizeof (atime_str), atime); >> + time_from_int (dtime_str, sizeof (dtime_str), dtime); >> + time_from_int (ctime_str, sizeof (ctime_str), ctime); I think it is probably better to use long at least. Tom