unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* proced: ppid of process ID 0 can be 0
@ 2008-12-20  2:52 Juanma Barranquero
  2008-12-20  3:27 ` Stefan Monnier
  2008-12-20 11:34 ` Eli Zaretskii
  0 siblings, 2 replies; 53+ messages in thread
From: Juanma Barranquero @ 2008-12-20  2:52 UTC (permalink / raw)
  To: Emacs Devel

proced.el assumes at several places (for example, at
`proced-filter-parents') that you can loop over the ppid, because
you'll eventually find a process with no parent.

That's not true with on Windows, where ppid (0) == 0. That causes a
stack failure, for example, if you hit RET (`proced-refine') over the
PPID of process 0.

I see two ways of fixing this: either removing the assumption from
proced.el, or forcing the Windows implementation of
system_process_attributes to adapt. First is more correct, second is
much easier (see tiny patch below).

Comments?

    Juanma


Index: src/w32.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32.c,v
retrieving revision 1.157
diff -u -2 -r1.157 w32.c
--- src/w32.c	19 Dec 2008 19:50:39 -0000	1.157
+++ src/w32.c	20 Dec 2008 02:34:39 -0000
@@ -3886,7 +3886,8 @@
 		}
 	      attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
-	      attrs = Fcons (Fcons (Qppid,
-				    make_fixnum_or_float (pe.th32ParentProcessID)),
-			     attrs);
+	      if (proc_id != 0)
+		attrs = Fcons (Fcons (Qppid,
+				      make_fixnum_or_float (pe.th32ParentProcessID)),
+			       attrs);
 	      attrs = Fcons (Fcons (Qpri, make_number (pe.pcPriClassBase)),
 			     attrs);




^ permalink raw reply	[flat|nested] 53+ messages in thread
* Re: proced: ppid of process ID 0 can be 0
@ 2008-12-24  7:42 grischka
  0 siblings, 0 replies; 53+ messages in thread
From: grischka @ 2008-12-24  7:42 UTC (permalink / raw)
  To: monnier; +Cc: emacs-devel

> That's not what I'm asking.  I'm asking: what can C code (or 
> Elisp code or that matter) do when the ppid is somehow not 
> found (i.e. there's no ppid available, but the process might 
> have a parent).

Well, for example:

(when 
  (although
   (maybe-not (process-tree-root-p pid))
   (somehow-not-found-p (process-parent pid))
   )
  (with the-thing
    (begin-to-believe 
       (if (y-or-n-p "Continue? ") 'funny 'strange)
       )))






^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2008-12-31  1:40 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-20  2:52 proced: ppid of process ID 0 can be 0 Juanma Barranquero
2008-12-20  3:27 ` Stefan Monnier
2008-12-20  4:31   ` Chong Yidong
2008-12-20 19:10     ` Stefan Monnier
2008-12-20 10:20   ` Juanma Barranquero
2008-12-20 11:34 ` Eli Zaretskii
2008-12-20 19:41   ` Roland Winkler
2008-12-20 21:02     ` Juanma Barranquero
2008-12-20 22:02     ` Eli Zaretskii
2008-12-20 22:41       ` Roland Winkler
2008-12-21  4:15         ` Eli Zaretskii
2008-12-21  4:48           ` Roland Winkler
2008-12-21 19:17             ` Eli Zaretskii
2008-12-21 21:26               ` Juanma Barranquero
2008-12-22  4:09                 ` Eli Zaretskii
2008-12-22 10:41                   ` Juanma Barranquero
2008-12-22 19:17                     ` Eli Zaretskii
2008-12-22 19:26                       ` Juanma Barranquero
2008-12-22  2:45               ` Stefan Monnier
2008-12-22  4:08                 ` Eli Zaretskii
2008-12-22  4:17                   ` Miles Bader
2008-12-22 19:10                     ` Eli Zaretskii
2008-12-22  8:54                   ` Harald Hanche-Olsen
2008-12-22 10:43                     ` Juanma Barranquero
2008-12-22 10:50                       ` Harald Hanche-Olsen
2008-12-22 18:03                       ` Giorgos Keramidas
2008-12-22 10:59                   ` Andreas Schwab
2008-12-22 19:22                     ` Eli Zaretskii
2008-12-22 19:37                       ` David De La Harpe Golden
2008-12-22 19:59                       ` Andreas Schwab
2008-12-22 12:23                   ` Stefan Monnier
2008-12-22 19:57                     ` Eli Zaretskii
2008-12-22 22:24                       ` Stefan Monnier
2008-12-23  4:02                         ` Eli Zaretskii
2008-12-23 12:28                           ` Roland Winkler
2008-12-23 14:44                           ` Stefan Monnier
2008-12-23 19:12                             ` Eli Zaretskii
2008-12-23 20:41                               ` Stefan Monnier
2008-12-23 22:34                                 ` Giorgos Keramidas
2008-12-24  2:34                                   ` Stefan Monnier
2008-12-24  4:14                                     ` Eli Zaretskii
2008-12-24 16:47                                       ` Stefan Monnier
2008-12-24  4:15                                 ` Eli Zaretskii
2008-12-24 16:47                                   ` Stefan Monnier
2008-12-24 18:29                                     ` Eli Zaretskii
2008-12-24 18:55                                       ` Stefan Monnier
2008-12-24 21:12                                         ` Eli Zaretskii
2008-12-30 17:11                                           ` Stefan Monnier
2008-12-30 22:02                                             ` Eli Zaretskii
2008-12-31  1:40                                               ` Stefan Monnier
2008-12-22  8:28               ` Ulrich Mueller
2008-12-21  2:18       ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2008-12-24  7:42 grischka

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).