From jilles@stack.nl  Tue Nov 18 08:36:06 2003
Return-Path: <jilles@stack.nl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C8CA916A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Nov 2003 08:36:06 -0800 (PST)
Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D3C5D43FE5
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Nov 2003 08:36:05 -0800 (PST)
	(envelope-from jilles@stack.nl)
Received: from turtle.stack.nl (turtle.stack.nl [2001:610:1108:5010:2e0:81ff:fe22:51d8])
	by mailhost.stack.nl (Postfix) with ESMTP id 8FACE1F001
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Nov 2003 17:36:04 +0100 (CET)
Received: by turtle.stack.nl (Postfix, from userid 1677)
	id 7E91F1CC71; Tue, 18 Nov 2003 17:36:04 +0100 (CET)
Message-Id: <20031118163604.7E91F1CC71@turtle.stack.nl>
Date: Tue, 18 Nov 2003 17:36:04 +0100 (CET)
From: Jilles Tjoelker <jilles@stack.nl>
Reply-To: Jilles Tjoelker <jilles@stack.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] ps: show 'sid' keyword in '-j'
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59423
>Category:       bin
>Synopsis:       [PATCH] bin/ps: show 'sid' keyword in '-j'
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gad
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 18 08:40:17 PST 2003
>Closed-Date:    Sun May 23 15:35:37 PDT 2004
>Last-Modified:  Sun May 23 15:35:37 PDT 2004
>Originator:     Jilles Tjoelker
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
MCGV Stack
>Environment:
System: FreeBSD turtle.stack.nl 5.1-CURRENT FreeBSD 5.1-CURRENT #15: Thu Oct 9 11:43:55 CEST 2003 jilles@turtle.stack.nl:/usr/obj/usr/src/sys/TURTLE i386
FreeBSD 5-CURRENT
>Description:
Under FreeBSD 4.x, ps -j showed the keywords:
user,pid,ppid,pgid,sess,jobc,state,tt,time,command
Under FreeBSD 5.x, the sess keyword (session pointer) was abandoned, and (as a
more useful replacement) the sid keyword (session id, PID of session leader)
was introduced. However, the sess keyword was simply removed from ps -j instead
of being replaced by sid.
>How-To-Repeat:
without patch
$ ps -j -p $$
USER     PID  PPID  PGID JOBC STAT  TT       TIME COMMAND
jilles 52879 52843 52793    1 S+    p8    0:00.00 /usr/local/bin/bash

with patch
$ ps -j -p $$
USER     PID  PPID  PGID   SID JOBC STAT  TT       TIME COMMAND
jilles 52879 52843 52793  5900    1 S+    p8    0:00.00 /usr/local/bin/bash
>Fix:

A patch is included to add the sid keyword to the list for '-j'.

--- ps-j-sid.patch begins here ---
--- /usr/src/bin/ps/ps.c	Fri Jun 13 04:00:04 2003
+++ /usr/src/bin/ps/ps.c	Fri Oct 10 17:50:46 2003
@@ -102,7 +102,7 @@
 static uid_t	*getuids(const char *, int *);
 
 static char dfmt[] = "pid,tt,state,time,command";
-static char jfmt[] = "user,pid,ppid,pgid,jobc,state,tt,time,command";
+static char jfmt[] = "user,pid,ppid,pgid,sid,jobc,state,tt,time,command";
 static char lfmt[] = "uid,pid,ppid,cpu,pri,nice,vsz,rss,mwchan,state,tt,time,command";
 static char   o1[] = "pid";
 static char   o2[] = "tt,state,time,command";
--- /usr/src/bin/ps/ps.1.orig	Tue Sep  9 04:00:05 2003
+++ /usr/src/bin/ps/ps.1	Tue Nov 18 16:26:23 2003
@@ -109,7 +109,7 @@
 header per page of information.
 .It Fl j
 Print information associated with the following keywords:
-user, pid, ppid, pgid, jobc, state, tt, time and command.
+user, pid, ppid, pgid, sid, jobc, state, tt, time and command.
 .It Fl L
 List the set of available keywords.
 .It Fl l
--- ps-j-sid.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gad 
Responsible-Changed-By: gad 
Responsible-Changed-When: Sat May 22 16:29:27 PDT 2004 
Responsible-Changed-Why:  
I'll look into this while doing other work on `ps' 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59423 
State-Changed-From-To: open->closed 
State-Changed-By: gad 
State-Changed-When: Sun May 23 15:34:18 PDT 2004 
State-Changed-Why:  
Change has been committed to 5.x-current, and there's no reason to 
MFC it to the 4.x branch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59423 
>Unformatted:
