Project

General

Profile

Feature #12153

netstat can use /proc/<PID>/fdinfo and avoid grabbing processes

Added by Andy Fiddaman 7 months ago. Updated 7 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Once we have /proc/<PID>/fdinfo, the code for netstat -u can be simplified using the associated new libproc interfaces, and also made to work properly in any zone brand which uses a /native namespace (for example, lx on SmartOS and OmniOS)


Related issues

Blocked by illumos gate - Feature #12046: Provide /proc/<PID>/fdinfo/Closed

Actions

History

#1

Updated by Andy Fiddaman 7 months ago

#2

Updated by Andy Fiddaman 7 months ago

Ran tests to compare the output of various invocations of netstat from before and after this change and observed no difference (save things like counters incrementing between runs)

#3

Updated by Andy Fiddaman 7 months ago

There's also a speed difference, with the new version being faster (this on a relatively loaded web server)

# ptime netstat~ -anu >/dev/null

real        1.320607853
user        0.152432182
sys         0.821588392

# ptime netstat -anu >/dev/null

real        0.063456723
user        0.009650681
sys         0.052829888

#4

Updated by Electric Monk 7 months ago

  • % Done changed from 0 to 100

git commit 1dd4766bd0d7ab56961ce97c9c39de612ae2e7d1

commit  1dd4766bd0d7ab56961ce97c9c39de612ae2e7d1
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2020-01-24T08:04:42.000Z

    12153 netstat can use /proc/<PID>/fdinfo and avoid grabbing processes
    Reviewed by: John Levon <john.levon@joyent.com>
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF