Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Kwok Cheung Yeung <kcy@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH]  Add extra 'info os' information types for Linux
Date: Fri, 21 Oct 2011 23:38:00 -0000	[thread overview]
Message-ID: <m3lisedpv0.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4E95DC58.7030805@codesourcery.com> (Kwok Cheung Yeung's message	of "Wed, 12 Oct 2011 19:28:40 +0100")

>>>>> ">" == Kwok Cheung Yeung <kcy@codesourcery.com> 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


  reply	other threads:[~2011-10-21 20:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12 18:29 Kwok Cheung Yeung
2011-10-21 23:38 ` Tom Tromey [this message]
2011-11-23 18:00   ` Kwok Cheung Yeung
2011-12-27  4:56     ` [PATCH] Add extra 'info os' information types for Linux (trunk and 7.4) Stan Shebs
2011-12-27  9:32       ` Eli Zaretskii
2011-12-27 21:30         ` Mark Kettenis
2011-12-27 23:23           ` Eli Zaretskii
2011-12-28 20:48             ` Mark Kettenis
2011-12-28  0:05         ` Stan Shebs
2011-12-28  3:51           ` Joel Brobecker
2011-12-28  6:02           ` Eli Zaretskii
2012-01-02 12:08           ` Pedro Alves
2012-01-02 12:35             ` Eli Zaretskii
2012-01-02 19:31               ` Pedro Alves
2012-01-03  3:05               ` Joel Brobecker
2012-01-02 18:15             ` Doug Evans
2012-01-02 19:19               ` Pedro Alves
2012-01-02 19:41                 ` Tom Tromey
2011-12-29 20:34       ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3lisedpv0.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kcy@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox