Home | History | Annotate | Download | only in fstat
History log of /src/usr.bin/fstat/fstat.c
RevisionDateAuthorComments
 1.120  02-Nov-2023  martin Back out the following revisions on behalf of core:

sys/sys/lwp.h: revision 1.228
sys/sys/pipe.h: revision 1.40
sys/kern/uipc_socket.c: revision 1.306
sys/kern/kern_sleepq.c: revision 1.84
sys/rump/librump/rumpkern/locks_up.c: revision 1.13
sys/kern/sys_pipe.c: revision 1.165
usr.bin/fstat/fstat.c: revision 1.119
sys/rump/librump/rumpkern/locks.c: revision 1.87
sys/ddb/db_xxx.c: revision 1.78
sys/ddb/db_command.c: revision 1.187
sys/sys/condvar.h: revision 1.18
sys/ddb/db_interface.h: revision 1.42
sys/sys/socketvar.h: revision 1.166
sys/kern/uipc_syscalls.c: revision 1.209
sys/kern/kern_condvar.c: revision 1.60

Add cv_fdrestart() [...]
Use cv_fdrestart() to implement fo_restart.
Simplify/streamline pipes a little bit [...]

This changes have caused regressions and need to be debugged.
The cv_fdrestart() addition needs more discussion.
 1.119  13-Oct-2023  ad Simplify/streamline pipes a little bit:

- Allocate only one struct pipe not two (no need to be bidirectional here).
- Then use f_flag (FREAD/FWRITE) to figure out what to do in the fileops.
- Never wake the other side or acquire long-term (I/O) lock unless needed.
- Whenever possible, defer wakeups until after locks have been released.
- Do some things locklessly in pipe_ioctl() and pipe_poll().

Some notable results:

- -30% latency on a 486DX2/66 doing 1 byte ping-pong within a single process.
- 2.5x less lock contention during "make cleandir" of src on a 48 CPU machine.
- 1.5x bandwith with 1kB messages on the same 48 CPU machine (8kB: same b/w).
 1.118  10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.117  28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb separation

Only kvm users are affected.
 1.116  28-Oct-2022  ozaki-r Adjust userland commands for struct inpcb integration

Only kvm users are affected.
 1.115  19-Jun-2022  simonb Add basic ZFS support to fstat(1).
XXX: Use a local zfs_znode.h for a znode_t definition because the ZFS
kernel code makes it too hard to include headers from userland.
 1.114  26-Aug-2020  christos Provide a helpful error message if we don't have privs to read kernel
addresses.
 1.113  06-Sep-2019  christos Add -O to print offsets; align columns properly.
 1.112  03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.111  30-Dec-2016  christos branches: 1.111.14;
Print the interface for bpf.
 1.110  22-Dec-2015  christos branches: 1.110.2;
print the tag symbolically if we don't support it.
 1.109  08-Mar-2015  mlelstv Resolve names of datagram services correctly.
 1.108  14-Feb-2014  christos fix protocol printing order.
 1.107  17-Jan-2014  christos make fstat -f search for unix sockets.
 1.106  15-Dec-2013  mlelstv Fix output for -A -f ...
 1.105  15-Dec-2013  wiz sync usage with man page
 1.104  15-Dec-2013  mlelstv New -A option. Add an output column with the address of the
kernel object (vnode or file) that can be matched with prstat(8) output.
 1.103  19-Oct-2013  christos use correct function and symbolic constants
 1.102  19-Oct-2013  christos use new scopeid functions
 1.101  18-Oct-2013  christos avoid pointer gymnastics
 1.100  25-Nov-2012  christos - add more debugging.
- in misctrans() we need the file index not the file type.
 1.99  19-Oct-2012  christos print major device numbers symbolically from kinfo_drivers
 1.98  19-Oct-2012  christos more info for unix sockets. XXX: chroot handling
 1.97  26-Sep-2012  christos fix non-numeric address and port printing.
 1.96  24-Mar-2012  christos branches: 1.96.2;
byte swap the inet6 ports.
 1.95  09-Oct-2011  chs branches: 1.95.2; 1.95.4;
fix rdev reporting for UFS2 and ext2fs.
 1.94  23-Sep-2011  mrg apply some (uintptr_t) so that printing printers works on i386 (likely
all 32 bit.)
 1.93  22-Sep-2011  christos - factor out common code in the inet and inet6 printing.
- add appletalk (ddp) support.
 1.92  10-Sep-2011  christos - remove bogus casts
- print recycled vnode flags
 1.91  03-Sep-2011  christos - minor KNF
- for system processes (0, 1) where fd_lastfile == -1, fail early.
- instead of printing the pcb connection address, print the pathname if
possible for unix domain sockets.
 1.90  14-Apr-2011  rmind Add DTYPE_SEM.
 1.89  24-May-2009  ad More changes to improve kern_descrip.c.

- Avoid atomics in more places.
- Remove the per-descriptor mutex, and just use filedesc_t::fd_lock.
It was only being used to synchronize close, and in any case we needed
to take fd_lock to free the descriptor slot.
- Optimize certain paths for the <NDFDFILE case.
- Sprinkle more comments and assertions.
- Cache more stuff in filedesc_t.
- Fix numerous minor bugs spotted along the way.
- Restructure how the open files array is maintained, for clarity and so
that we can eliminate the membar_consumer() call in fd_getfile(). This is
mostly syntactic sugar; the main functional change is that fd_nfiles now
lives alongside the open file array.

Some measurements with libmicro:

- simple file syscalls are like close() are between 1 to 10% faster.
- some nice improvements, e.g. poll(1000) which is ~50% faster.
 1.88  12-Apr-2009  lukem Fix sign-compare issues.
 1.87  29-Dec-2008  christos branches: 1.87.2;
64 bit dev_t
 1.86  09-Sep-2008  gmcgarry Cast f_type to signed integer before comparison with negative values.
 1.85  23-Jul-2008  lukem Add back rev 1.83. (hi christos!)
 1.84  22-Jul-2008  christos a better attempt on printing dtype_misc
 1.83  21-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.82  04-Apr-2008  christos branches: 1.82.4;
handle NULL better.
 1.81  04-Apr-2008  christos elementary handling for different types of DTYPE_FOO.
XXX: DTYPE_CRYPTO is unused.
XXX: should we change fd_clone() to pass a DTYPE_FOO?
 1.80  04-Apr-2008  christos catch up with struct filedesc changes.
 1.79  23-Mar-2008  he Please repeat after me: I shall not define _KERNEL before including
<sys/types.h> in user-land programs. Doing so causes build problems
for lots of our ports due to differences in how <sys/bswap.h> ends up
defining the swap functions/macros.
 1.78  22-Mar-2008  ad Catch up with recent file descriptor changes.
 1.77  15-Dec-2007  perry convert __attribute__s to applicable cdefs.h macros
 1.76  09-Sep-2007  dyoung Bug fix: filed.fd_ofiles is always a pointer to the open files
table, so always read the table from kernel virtual memory at that
address. Do not ever try to read the table from filed0.fd_dfiles,
because it just isn't necessary, and sometimes we read a stale
table from there.
 1.75  11-May-2006  yamt branches: 1.75.12;
tweak for user.h cleanup.
while i'm here, remove unnecessary #include.
 1.74  11-May-2006  mrg maxfiles -> fstat_maxfiles. (this _KERNEL definition code needs to not
clash with kernel headers....)
 1.73  10-Feb-2006  christos PR/32788: KAMADA Ken'ichi: add support for tmpfs
 1.72  17-Jul-2005  christos WARNS=3, knf, ansi prototypes
 1.71  14-Dec-2004  atatat Cast fst.fileid to unsigned long and print it as such. Inode numbers
are never negative.
 1.70  12-Dec-2004  christos Add ptyfs.
 1.69  16-Nov-2004  itojun NI_WITHSCOPEID was not picked up by IETF standardization process.
 1.68  30-Oct-2004  dsl Add (unsigned char) cast to ctype functions
 1.67  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.66  02-Apr-2004  aymeric fix the way the ext2fs-specific size and mode variables are fetched:
they are indirectly gotten from kernel memory and as such should be read
with KVM_READ.
This fixes fstat core dumps when some process holds a reference in a Linux
ext2fs filesystem.
Thanks to Aleksy Schubert (alx.at.mimuw.dot.edu.dot.pl) for debugging this
with me.
 1.65  21-Oct-2003  fvdl branches: 1.65.2;
Don't compare integers and NULL.
 1.64  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.63  15-Jul-2003  itojun use bounded string op
 1.62  02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.61  02-Feb-2003  christos undo mallocvar.h changes!
 1.60  01-Feb-2003  tron Include "sys/mallocvar.h" with "_KERNEL" defined in time to avoid
build failure because MALLOC_DECLARE() is not defined.
 1.59  20-Jan-2003  martin Make it compile again on LP64 archs.
XXX - we *realy* need some format string macros for size_t/off_t!
 1.58  19-Jan-2003  dsl Use kvm_getprocs2 so independant of kernel version
(change aggreed by christos)
 1.57  26-Oct-2002  yamt add VT_LFS case.
 1.56  23-Oct-2002  jdolecek merge rev. 1.50.2.1 (made by lukem):
rudimentary support for for displaying DTYPE_KQUEUE fds
 1.55  12-Feb-2002  simonb Add an extra column for inode numbers, and pull back the mode field to
just 5 columns if in "numeric" mode. Other fields should dynamically
resize, but not today...
 1.54  25-Nov-2001  jdolecek for (new)pipes, print 'n' if it's in nonblocking mode, and 'a' if it's
set to async
 1.53  26-Oct-2001  lukem remove #include <ufs/ufs/quota.h> where it was just to appease
<ufs/ufs/inode.h>, since the latter now includes the former. leave the former
in source that obviously uses specific bits of it (for completeness.)
 1.52  28-Sep-2001  jdolecek remove accidentaly left debug printf

change the pipe descriptor output to include 'r' or 'w' to explicitly
indicate it's open for reading or writing, similarily to "regular" descriptors
 1.51  28-Sep-2001  jdolecek the descriptor flags may also contain other stuff besides FWRITE|FREAD,
so do '& FWRITE' instead of '== FWRITE' in the check in pipe-related code
 1.50  08-Jul-2001  jdolecek branches: 1.50.2;
fix comment
 1.49  19-Jun-2001  wiz `accessible' only has one `a'.
 1.48  17-Jun-2001  lukem convert if ... else if ... tree to a switch
 1.47  16-Jun-2001  jdolecek Add support for DTYPE_PIPE pipes (a.k.a NEW_PIPE)
 1.46  05-Jun-2001  mrg don't #define _LKM to work around header lossage; it is no longer necessary.
 1.45  04-Jan-2001  lukem use %ll_ instead of the less standard %q_
 1.44  14-Aug-2000  enami Redo previous a bit different way so that mount point of top layer is shown
instead of lowest one and ``fstat file-on-upperlayer'' works.
 1.43  14-Aug-2000  enami Print lower vnode if vnode is on a layered filesystem.
 1.42  27-May-2000  sommerfeld branches: 1.42.4;
Bring into line with recent ktrace changes
 1.41  04-Feb-2000  jdolecek add support for msdosfs
 1.40  04-Feb-2000  jdolecek move the mapping of vnode type to file type to separate function getftype()
and use it where appropriate
 1.39  04-Feb-2000  jdolecek fix typo
 1.38  17-Jan-2000  itojun IPv6 support.
NetBSD PR: 9199 (with minor changes)
 1.37  02-Aug-1999  jdolecek add support for ntfs
 1.36  08-Jul-1999  tron Define "_LKM" before including kernel includes with "_KERNEL" defined
so that "opt_ffs.h" gets skipped.
 1.35  02-May-1999  thorpej Adjust for cwdinfo changes.
 1.34  18-Feb-1999  lukem as suggested by chuck cranor, pull in some openbsd mods:
* display ip address details of tcp/udp connections
* display isofs details
* use %p instead of %lx in error messages

other mods by me:
* don't put \n at the end of err()/warn() format
* man page cleanups (use .Dq and .Pq as appropriate)
 1.33  28-Jul-1998  mycroft const propagation.
 1.32  28-Jul-1998  mycroft const propagation.
 1.31  18-Jul-1998  lukem use AF_LOCAL instead of AF_UNIX
 1.30  16-Jul-1998  ross Fix LP64 problems from (5!) July deltas.
 1.29  06-Jul-1998  fair one more thing...
 1.28  06-Jul-1998  fair convert the remainder of the fprintf() to {err,warn}{,x}()
 1.27  06-Jul-1998  fair fix build error - forgot to #include <err.h> for errx()
 1.26  06-Jul-1998  mrg - change setgid kmem programs (that lend themselves to this) so setegid(getgid())
and the top, and then set the effective gid back to kmem around the call to
kvm_openfiles(). this reduces the time group kmem is available.
- for those above that also allow this, setgid(getgid()) after the call to
kvm_openfiles() to fully revoke priviledges.
- some KNF
- use err(3) over fprintf(3) in some places
 1.25  03-Jul-1998  msaitoh check return value of kvm_read() more safe
 1.24  20-Oct-1997  thorpej Update for changes to how nfsnode attributes are stored.
 1.23  18-Oct-1997  lukem WARNSify, fix .Nm usage, deprecate register
 1.22  18-Oct-1997  lukem getopt returns -1 not EOF
 1.21  18-Oct-1997  mrg merge lite-2.
 1.20  12-Jun-1997  bouyer Make this compile again, and add support for ext2fs.
Also 2 ufs->ffs conversions in pstat.8.
 1.19  03-Mar-1997  explorer Add a double quote to make emacs's color mode happy...
 1.18  11-Feb-1997  mrg remove dangerous sprintf and strcpy calls.
 1.17  09-Jan-1997  tls RCS ID police
 1.16  05-May-1996  mhitch Change -N and -M option string to specify the options have an argument.
Fixes PR#2374.
 1.15  20-Feb-1996  fvdl Fix NFS include files; sync with Lite2
 1.14  28-Mar-1995  jtc KERNEL -> _KERNEL
 1.13  15-Feb-1995  mycroft Check for bogus file descriptor tables.
 1.12  24-Dec-1994  cgd type sanity
 1.11  13-Jun-1994  mycroft Merge local changes.
 1.10  13-Jun-1994  cgd include file fix
 1.9  09-May-1994  cgd get it to work with old private data allocation
 1.8  09-May-1994  cgd clean up import
 1.7  05-May-1994  cgd update for changed flags
 1.6  26-Oct-1993  cgd Fixed multiple off-by-one bugs which caused the open file printing to
not print the last open file. patch from David Greenman
<davidg@implode.rain.com>.
 1.5  01-Aug-1993  mycroft Add RCS identifiers.
 1.4  20-May-1993  cgd don't explicitly include select.h, but keep header cleanup
 1.3  20-May-1993  cgd fix for new select stuff
 1.2  11-Apr-1993  cgd NFS not properly defined. glass gets another point.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  01-Sep-1995  jtc imported from 44lite2
 1.1.1.2  09-May-1994  cgd new fstat
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.42.4.2  13-Feb-2002  he Pull up revision 1.55 (requested by simonb):
Add an extra column for inode numbers, and pull back the mode field
to just 5 columns if in "numeric" mode.
 1.42.4.1  02-Oct-2000  enami Pullup rev. 1.43 and 1.44. This makes fstat works with layered filesystem
and fixes PR#11113. Approved by thorpej.
 1.50.2.1  10-Jul-2001  lukem add rudimentary support for displaying DTYPE_KQUEUE fds
 1.65.2.1  02-Apr-2004  tron Pull up revision 1.66 (requested by aymeric in ticket #50):
fix the way the ext2fs-specific size and mode variables are fetched:
they are indirectly gotten from kernel memory and as such should be read
with KVM_READ.
This fixes fstat core dumps when some process holds a reference in a Linux
ext2fs filesystem.
Thanks to Aleksy Schubert (alx.at.mimuw.dot.edu.dot.pl) for debugging this
with me.
 1.75.12.2  09-Jan-2008  matt sync with HEAD
 1.75.12.1  06-Nov-2007  matt sync with HEAD
 1.82.4.2  24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.82.4.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.87.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.95.4.1  02-Apr-2012  riz Pull up following revision(s) (requested by 143 in ticket #christos):
usr.bin/fstat/fstat.c: revision 1.96
byte swap the inet6 ports.
 1.95.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.95.2.3  16-Jan-2013  yamt sync with (a bit old) head
 1.95.2.2  30-Oct-2012  yamt sync with head
 1.95.2.1  17-Apr-2012  yamt sync with head
 1.96.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.96.2.2  25-Feb-2013  tls resync with head
 1.96.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.110.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.111.14.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.111.14.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed