Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
P
procps
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jan Rybar
procps
Commits
201c3188
Commit
201c3188
authored
Oct 08, 2002
by
albert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
args/comm in needs
parent
b5dd2dec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
ps/display.c
ps/display.c
+16
-3
ps/output.c
ps/output.c
+8
-7
No files found.
ps/display.c
View file @
201c3188
...
...
@@ -219,11 +219,23 @@ static void fill_pcpu(proc_t *buf){
buf
->
pcpu
=
(
pcpu
>
999
)
?
999
:
pcpu
;
}
/***** figure out what we need */
static
void
compute_needs
(
void
){
if
(
bsd_c_option
){
needs_for_format
&=
~
PROC_FILLARG
;
needs_for_sort
&=
~
PROC_FILLARG
;
}
if
(
!
unix_f_option
){
needs_for_format
&=
~
PROC_FILLCOM
;
needs_for_sort
&=
~
PROC_FILLCOM
;
}
}
/***** just display */
static
void
simple_spew
(
void
){
proc_t
buf
;
PROCTAB
*
ptp
;
ptp
=
openproc
(
needs_for_format
|
needs_for_sort
|
PROC_FILLCMD
);
ptp
=
openproc
(
needs_for_format
|
needs_for_sort
);
if
(
!
ptp
)
{
fprintf
(
stderr
,
"Error: can not access /proc.
\n
"
);
exit
(
1
);
...
...
@@ -362,7 +374,7 @@ static void fancy_spew(void){
proc_t
*
retbuf
=
NULL
;
PROCTAB
*
ptp
;
int
n
=
0
;
/* number of processes & index into array */
ptp
=
openproc
(
needs_for_format
|
needs_for_sort
|
PROC_FILLCMD
);
ptp
=
openproc
(
needs_for_format
|
needs_for_sort
);
if
(
!
ptp
)
{
fprintf
(
stderr
,
"Error: can not access /proc.
\n
"
);
exit
(
1
);
...
...
@@ -420,11 +432,12 @@ int main(int argc, char *argv[]){
init_output
();
/* must be between parser and output */
check_headers
();
check_needs
();
check_needs
();
/* filthy hack -- got to unify some stuff here */
if
(
(
(
needs_for_format
|
needs_for_sort
)
&
PROC_FILLWCHAN
)
&&
!
wchan_is_number
)
if
(
open_psdb
(
namelist_file
))
wchan_is_number
=
1
;
compute_needs
();
if
(
forest_type
||
sort_list
)
fancy_spew
();
/* sort or forest */
else
simple_spew
();
/* no sort, no forest */
...
...
ps/output.c
View file @
201c3188
...
...
@@ -1131,7 +1131,8 @@ static int sr_context ( const proc_t* P, const proc_t* Q ) {
/* short names to save space */
#define MEM PROC_FILLMEM
/* read statm */
#define CMD PROC_FILLCMD
/* read cmdline */
#define ARG PROC_FILLARG
/* read cmdline (cleared if c option) */
#define COM PROC_FILLCOM
/* read cmdline (cleared if not -f option) */
#define ENV PROC_FILLENV
/* read environ */
#define USR PROC_FILLUSR
/* uid_t -> user names */
#define GRP PROC_FILLGRP
/* gid_t -> group names */
...
...
@@ -1158,7 +1159,7 @@ static const format_struct format_array[] = {
{
"addr_1"
,
"ADDR"
,
pr_nop
,
sr_nop
,
1
,
0
,
LNX
,
LEFT
},
{
"alarm"
,
"ALARM"
,
pr_alarm
,
sr_it_real_value
,
5
,
0
,
LNX
,
RIGHT
},
{
"argc"
,
"ARGC"
,
pr_nop
,
sr_nop
,
4
,
0
,
LNX
,
RIGHT
},
{
"args"
,
"COMMAND"
,
pr_args
,
sr_nop
,
16
,
0
,
U98
,
UNLIMITED
},
/*command*/
{
"args"
,
"COMMAND"
,
pr_args
,
sr_nop
,
16
,
ARG
,
U98
,
UNLIMITED
},
/*command*/
{
"atime"
,
"TIME"
,
pr_time
,
sr_nop
,
8
,
0
,
SOE
,
CUMUL
|
RIGHT
},
/*cputime*/
/* was 6 wide */
{
"blocked"
,
"BLOCKED"
,
pr_sigmask
,
sr_nop
,
9
,
0
,
BSD
,
SIGNAL
},
/*sigmask*/
{
"bnd"
,
"BND"
,
pr_nop
,
sr_nop
,
1
,
0
,
AIX
,
RIGHT
},
...
...
@@ -1169,11 +1170,11 @@ static const format_struct format_array[] = {
{
"class"
,
"CLS"
,
pr_class
,
sr_sched
,
3
,
0
,
XXX
,
LEFT
},
{
"cls"
,
"-"
,
pr_nop
,
sr_nop
,
1
,
0
,
HPU
,
RIGHT
},
{
"cmaj_flt"
,
"-"
,
pr_nop
,
sr_cmaj_flt
,
1
,
0
,
LNX
,
RIGHT
},
{
"cmd"
,
"CMD"
,
pr_args
,
sr_cmd
,
16
,
0
,
DEC
,
UNLIMITED
},
/*ucomm*/
{
"cmd"
,
"CMD"
,
pr_args
,
sr_cmd
,
16
,
ARG
,
DEC
,
UNLIMITED
},
/*ucomm*/
{
"cmin_flt"
,
"-"
,
pr_nop
,
sr_cmin_flt
,
1
,
0
,
LNX
,
RIGHT
},
{
"cnswap"
,
"-"
,
pr_nop
,
sr_cnswap
,
1
,
0
,
LNX
,
RIGHT
},
{
"comm"
,
"COMMAND"
,
pr_comm
,
sr_nop
,
16
,
0
,
U98
,
UNLIMITED
},
/*ucomm*/
{
"command"
,
"COMMAND"
,
pr_args
,
sr_nop
,
16
,
0
,
XXX
,
UNLIMITED
},
/*args*/
{
"comm"
,
"COMMAND"
,
pr_comm
,
sr_nop
,
16
,
COM
,
U98
,
UNLIMITED
},
/*ucomm*/
{
"command"
,
"COMMAND"
,
pr_args
,
sr_nop
,
16
,
ARG
,
XXX
,
UNLIMITED
},
/*args*/
{
"context"
,
"CONTEXT"
,
pr_context
,
sr_context
,
40
,
0
,
LNX
,
LEFT
},
{
"cp"
,
"CP"
,
pr_cp
,
sr_pcpu
,
3
,
0
,
DEC
,
RIGHT
},
/*cpu*/
{
"cpu"
,
"CPU"
,
pr_nop
,
sr_nop
,
3
,
0
,
BSD
,
RIGHT
},
/* FIXME ... HP-UX wants this as the CPU number for SMP? */
...
...
@@ -1339,8 +1340,8 @@ static const format_struct format_array[] = {
{
"tty4"
,
"TTY"
,
pr_tty4
,
sr_tty
,
4
,
0
,
LNX
,
LEFT
},
{
"tty8"
,
"TTY"
,
pr_tty8
,
sr_tty
,
8
,
0
,
LNX
,
LEFT
},
{
"u_procp"
,
"UPROCP"
,
pr_nop
,
sr_nop
,
6
,
0
,
DEC
,
RIGHT
},
{
"ucmd"
,
"CMD"
,
pr_comm
,
sr_cmd
,
16
,
0
,
DEC
,
UNLIMITED
},
/*ucomm*/
{
"ucomm"
,
"COMMAND"
,
pr_comm
,
sr_nop
,
16
,
0
,
XXX
,
UNLIMITED
},
/*comm*/
{
"ucmd"
,
"CMD"
,
pr_comm
,
sr_cmd
,
16
,
COM
,
DEC
,
UNLIMITED
},
/*ucomm*/
{
"ucomm"
,
"COMMAND"
,
pr_comm
,
sr_nop
,
16
,
COM
,
XXX
,
UNLIMITED
},
/*comm*/
{
"uid"
,
"UID"
,
pr_euid
,
sr_euid
,
5
,
0
,
XXX
,
RIGHT
},
{
"uid_hack"
,
"UID"
,
pr_euser
,
sr_nop
,
8
,
USR
,
XXX
,
USER
},
{
"umask"
,
"UMASK"
,
pr_nop
,
sr_nop
,
5
,
0
,
DEC
,
RIGHT
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment