Commit Graph

160 Commits

Author SHA1 Message Date
Ed Schouten
bc093719ca Integrate the new MPSAFE TTY layer to the FreeBSD operating system.
The last half year I've been working on a replacement TTY layer for the
FreeBSD kernel. The new TTY layer was designed to improve the following:

- Improved driver model:

  The old TTY layer has a driver model that is not abstract enough to
  make it friendly to use. A good example is the output path, where the
  device drivers directly access the output buffers. This means that an
  in-kernel PPP implementation must always convert network buffers into
  TTY buffers.

  If a PPP implementation would be built on top of the new TTY layer
  (still needs a hooks layer, though), it would allow the PPP
  implementation to directly hand the data to the TTY driver.

- Improved hotplugging:

  With the old TTY layer, it isn't entirely safe to destroy TTY's from
  the system. This implementation has a two-step destructing design,
  where the driver first abandons the TTY. After all threads have left
  the TTY, the TTY layer calls a routine in the driver, which can be
  used to free resources (unit numbers, etc).

  The pts(4) driver also implements this feature, which means
  posix_openpt() will now return PTY's that are created on the fly.

- Improved performance:

  One of the major improvements is the per-TTY mutex, which is expected
  to improve scalability when compared to the old Giant locking.
  Another change is the unbuffered copying to userspace, which is both
  used on TTY device nodes and PTY masters.

Upgrading should be quite straightforward. Unlike previous versions,
existing kernel configuration files do not need to be changed, except
when they reference device drivers that are listed in UPDATING.

Obtained from:		//depot/projects/mpsafetty/...
Approved by:		philip (ex-mentor)
Discussed:		on the lists, at BSDCan, at the DevSummit
Sponsored by:		Snow B.V., the Netherlands
dcons(4) fixed by:	kan
2008-08-20 08:31:58 +00:00
Konstantin Belousov
05427aafc6 Struct cdev is always the member of the struct cdev_priv. When devfs
needed to promote cdev to cdev_priv, the si_priv pointer was followed.

Use member2struct() to calculate address of the wrapping cdev_priv.
Rename si_priv to __si_reserved.

Tested by:	pho
Reviewed by:	ed
MFC after:	2 weeks
2008-06-16 17:34:59 +00:00
Ed Schouten
436f2e5275 Fix build of fstat after minor() changes.
Even though I ran a `make universe' to see whether the changes to the
device minor number macro's broke the build, I was not expecting `make
universe' to silently continue if build errors occured, thus causing me
to overlook the build error.

Approved by:	philip (mentor)
Pointyhat to:	me
2008-06-12 10:15:14 +00:00
Pawel Jakub Dawidek
037dab5792 Use _WANT_FILE to make struct file visible from userland. This is
similar to _WANT_UCRED and _WANT_PRISON and seems to be much nicer than
defining _KERNEL.
It is also needed for my sys/refcount.h change going in soon.
2008-05-26 15:12:47 +00:00
John Baldwin
0f0e3d5f39 Use a sledgehammer cast (that was in the original patch to boot) to
quiet a warning on 64-bit platforms now that 'size' is an int and not a
size_t.
2008-05-07 21:00:50 +00:00
John Baldwin
5e72af30cb Fix reading the address of a znode_phys from a znode on 64-bit platforms
where sizeof(pointer) != sizeof(int).

MFC after:	1 week
PR:		amd64/123456
Submitted by:	KOIE Hidetaka | hide koie.org
2008-05-07 18:27:38 +00:00
John Baldwin
9227912617 The debug.sizeof.znode sysctl returns an int, not a size_t. This can cause
a hang on 64-bit platforms.

MFC after:	1 week
PR:		amd64/123456
Submitted by:	KOIE Hidetaka | hide koie.org
2008-05-07 17:55:28 +00:00
John Baldwin
02e50214ff Only output details about the current working directory of a process if
the vnode pointer is not NULL.  This avoids spurious warnings in fstat -v
output for kernel processes.

MFC after:	1 week
PR:		amd64/123456
Submitted by:	KOIE Hidetaka | hide koie.org
2008-05-07 17:49:31 +00:00
Pawel Jakub Dawidek
6e679990b9 Fix some section references. 2008-04-29 08:16:05 +00:00
Ruslan Ermilov
562f2f71eb Don't depend on the modification time of the "zfs" subdir. 2008-04-29 06:54:12 +00:00
Ruslan Ermilov
24c9b0c84e - Fix makefile so it doesn't break the build in some corner cases. [1]
- Remove an extra copy of zfs.c.

Reported by:	yar [1]
2008-04-29 06:48:00 +00:00
John Birrell
e327f52446 The sources covered by Sun's CDDL have been repo copied below the
src/cddl and src/sys/cddl directories per the core@ decision following
the license review.

This change modifies the affected Makefiles to reference the sources
in their new location.
2008-03-27 23:21:25 +00:00
Ruslan Ermilov
47dd70868b Flag a hack. 2008-01-24 07:25:13 +00:00
Ruslan Ermilov
f0c2fb2d04 Style. 2008-01-24 07:24:30 +00:00
John Birrell
ee8a5fa77d Remove _SOLARIS_C_SOURCE now that it doesn't do anything in FreeBSD
headers. All OpenSolaris compatibility comes via the set of specific
compatibility headers in src/compat/opensolaris and
src/sys/compat/opensolaris.
2007-11-28 22:58:09 +00:00
John Birrell
dd43ab7d9b Use variable types which match the function prototypes. 2007-11-17 23:21:38 +00:00
Ulf Lilleengen
eec1c21f61 - Add ZFS-support to fstat(1). This allows ZFS-filsystems to be including in
the open file-listing. It is added as a separate source file, so it can
  respect WITH_/WITHOUT_CDDL as compile-flags.
- The warnlevel of the Makefile was decreased to quell solaris #pragma
  warnings.
- Expect that fstat(1) doesn't work with kernel compiled with
  DEBUG_VFS_LOCKS/DEBUG_LOCKS for now.

Approved by:	pjd (mentor)
2007-11-05 23:15:03 +00:00
Ed Maste
f9feee175b KERN_PROC_ALL produces a kinfo_proc for each thread in a process, which
caused fstat to produce duplicated output for threaded processes.  Instead
use KERN_PROC_PROC to get just one kinfo_proc per process.

MFC After:	2 weeks
2007-03-09 16:21:40 +00:00
Tor Egge
82be0a5a24 Add marker vnodes to ensure that all vnodes associated with the mount point are
iterated over when using MNT_VNODE_FOREACH.

Reviewed by:	truckman
2006-01-09 20:42:19 +00:00
Christian S.J. Peron
997591ca96 Un-break processing of device major/minor values with fstat -n. We do
this by accessing the cdev_priv element of the cdev structure. Looking
forward we need a better way to handle this, as this structure shouldn't
be frobbed by userspace.

Submitted by:	Doug Steinwand
PR:		bin/88203
MFC after:	1 week
Discussed with:	phk
2005-11-05 23:38:08 +00:00
Christian S.J. Peron
a4cdc0452a Introduce kdevtoname, which when given the kernel address of a
cdev structure, returns the device name associated with it through
the __si_namebuf member. This un-breaks the processing of devices.

This is a RELENG_6 candidate.

Reviewed by:	phk
2005-07-30 20:00:13 +00:00
Ruslan Ermilov
f682f10c76 Sync program's usage() with manpage's SYNOPSIS. 2005-05-21 09:55:10 +00:00
Poul-Henning Kamp
99d432b90c Dike out another kvm indiscretion. 2005-03-16 10:24:16 +00:00
Poul-Henning Kamp
dc2f8e798b Dike out unwarranted si_udev fondling. 2005-03-15 14:30:26 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Poul-Henning Kamp
6b02062275 Add text about jail root directory as well.
Submitted by:	"Mark W. Krentel" <krentel@dreamscape.com>
2005-01-30 08:03:20 +00:00
Poul-Henning Kamp
5dc1f79ed8 Report jail directory if set.
Sanity-check fd_lastfile.

PR:	62699
Patch by:	"Mark W. Krentel" <krentel@dreamscape.com>
2005-01-29 11:38:00 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Suleiman Souhlal
7a13f01f6f Get the vnode from file.f_vnode instead of file.f_data.
Nowadays, f_data points to the vnode only if the underlying filesystem
doesn't use it for other purposes (devfs uses it to store the cdev,
for example).

Found by:	csjp
Reviewed by:	csjp
Approved by:	phk, wes, grehan (mentor)
MFC after:	1 week
2005-01-11 18:52:12 +00:00
Poul-Henning Kamp
e93bd4ef59 filedesc0 is an internal detail of the kernel, don't look at it. 2004-11-07 20:38:29 +00:00
Poul-Henning Kamp
4ef77ed68a Add -D_KVM_VNODE to indicate that despite being a userland program,
we want to know the vnode structures internals.
2004-10-21 12:09:45 +00:00
Philippe Charnier
2a00e8eade Introduce options list the standard way. 2004-07-26 19:53:44 +00:00
Mike Silbersack
27eabced44 Slide pipe.h include after the _KERNEL define in preparation for disallowing
non-_KERNEL inclusions of pipe.h
2004-07-21 03:07:50 +00:00
Ruslan Ermilov
557b7fa148 Deal with double whitespace. 2004-07-03 00:24:45 +00:00
Ruslan Ermilov
6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
David Malone
1e925017b3 1) ANSIfy.
2) Use %p to print a pointer.
3) Use longs for fileids and ino to avoid comparing signed and unsigned.
4) Make the KVM_READ macro a little more cranky.
5) Set WARNS while I'm here.
2004-06-29 21:28:09 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Robert Watson
97b88fbf30 Teach fstat(1) about new location for socket state flags relating to
socket buffer state.

Submitted by:	rik
Reminded by:	le
2004-06-14 20:54:18 +00:00
Ruslan Ermilov
376d460cff Correct the description of the -N option. 2004-03-26 10:48:35 +00:00
Max Khon
6c7aa7fe1b Do not cache and correctly free() dosmount entry in case of errors.
PR:		53980 (partially)
2003-09-23 16:44:17 +00:00
John-Mark Gurney
ab1897e943 fix this code properly. msdosfs can't have device nodes on them.
comment how to read device nodes from ufs (if an adventurous soul wants
to fix it!).

Reviewed by:	bde
2003-06-24 08:18:18 +00:00
Maxim Konovalov
c30afbc578 o Fix rev. 1.41, print a header. -STABLE is OK.
PR:		bin/53585
Submitted by:	Alexey Dokuchaev <danfe@regency.nsu.ru>
2003-06-23 08:43:19 +00:00
John-Mark Gurney
cf56713abf correct spelling of struct cdev * from dev_t which is a 32bit type and
isn't very useful for passing pointers on LP64 systems.

device names on sparc64 and alpha should now work.
2003-06-19 02:09:22 +00:00
Matthew Dillon
48e3128b34 Bow to the whining masses and change a union back into void *. Retain
removal of unnecessary casts and throw in some minor cleanups to see if
anyone complains, just for the hell of it.
2003-01-13 00:33:17 +00:00
Matthew Dillon
cd72f2180b Change struct file f_data to un_data, a union of the correct struct
pointer types, and remove a huge number of casts from code using it.

Change struct xfile xf_data to xun_data (ABI is still compatible).

If we need to add a #define for f_data and xf_data we can, but I don't
think it will be necessary.  There are no operational changes in this
commit.
2003-01-12 01:37:13 +00:00
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Poul-Henning Kamp
ca916247cd Rename struct specinfo to the more appropriate struct cdev.
Agreed on:	jake, rwatson, jhb
2002-09-27 18:27:10 +00:00
Nate Lawson
e47c217844 Userland changes to go with vnode->v_tag change. 2002-09-14 18:51:10 +00:00
Bosko Milekic
d8aadd88cf Unbreak building of fstat following version 1.23 of
src/sys/ufs/ufs/quota.h by including mount.h before ufs/quota.h.
2002-08-14 16:34:13 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Kirk McKusick
1c85e6a35d This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by:	Poul-Henning Kamp <phk@freebsd.org>
2002-06-21 06:18:05 +00:00
Dag-Erling Smørgrav
1f910d6cae Factor out some code in preparation for un-kmeming fstat(1).
Sponsored by:	DARPA, NAI Labs
2002-06-06 18:39:53 +00:00
Josef Karthauser
1063e12617 Replace /kernel with /boot/kernel/kernel.
PR:		docs/37757
Submitted by:	Hiten Pandya <hiten@uk.FreeBSD.org>
2002-05-09 11:47:42 +00:00
Philippe Charnier
e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
Philippe Charnier
91966d21ff .Ar filename ... is equivalent to .Ar. 2002-04-12 21:31:24 +00:00
David Malone
27d57ea9bf Fix constness warnings.
Remove register keyword.
Don't initialise "badtype" in declaration - it was initialised below anyway.
Remove prototype for strcpy.
2002-03-30 14:03:53 +00:00
David Malone
abda1f5e3c Don't use gcc specific flags. 2002-03-30 14:01:55 +00:00
Garrett Wollman
90eca7b640 Use a slightly less obscure title than "file status". 2002-03-27 22:59:11 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
Brian Feldman
fca066fe02 Add support for devfs. In other words, for -CURRENT, make work at all
again for normal device nodes.
2001-12-17 13:42:46 +00:00
David Malone
b628b0dce5 Anding the fsid with 0xffff was causing aliasing problems.
PR:		17405, 16320
Submitted by:	Mark W. Krentel <krentel@dreamscape.com>
Submitted by:	Peter Edwards <peter.edwards@ireland.com>
MFC after:	2 weeks
2001-11-05 20:40:24 +00:00
Bruce Evans
6eabd84580 Compensate for "Compensate for header dethreading" by backing it out. 2001-10-10 17:48:44 +00:00
Peter Wemm
9119623471 Userland part of nfs client/server split and cleanup. 2001-09-18 23:34:44 +00:00
Ruslan Ermilov
3b7e5ccc6a SECURITY: Drop `setgid kmem' bit as early as possible. 2001-08-31 16:26:37 +00:00
Matt Jacob
df94d4d280 Fix 64 bit issues so that sockstat && fstat work correctly on alpha.
PR:		29231
Submitted by:	pherman@frenchfries.net
MFC after:	2 weeks
2001-07-25 20:31:20 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
625003720a mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
Peter Pentchev
e6ebeb5f57 Teach fstat(1) about FIFO's - it's OK to display them as regular files.
While I'm here, fix two second-level indents to be four spaces.

Reviewed by:	dd, -audit
2001-06-18 06:29:31 +00:00
Poul-Henning Kamp
753d49786e Remove MFS 2001-05-29 20:39:47 +00:00
Ruslan Ermilov
1166fb516b - sys/msdosfs moved to sys/fs/msdosfs
- msdos.ko renamed to msdosfs.ko
- /usr/include/msdosfs moved to /usr/include/fs/msdosfs
2001-05-25 08:14:14 +00:00
Poul-Henning Kamp
11529d1a19 define _KERNEL before including <sys/conf.h> 2001-05-23 23:03:00 +00:00
Ruslan Ermilov
3ab9a9d0e0 Removed -I${.CURDIR}/.../sys from CFLAGS. 2001-05-18 13:41:42 +00:00
Mark Murray
6e547eabb8 Compensate for header dethreading. 2001-05-01 08:46:02 +00:00
Greg Lehey
60fb0ce365 Revert consequences of changes to mount.h, part 2.
Requested by:	bde
2001-04-29 02:45:39 +00:00
Greg Lehey
5a0a51cf5a Include correct header files, in preparation for fixing sys/mount.h.
Suggested-by:	phk
2001-04-23 08:11:54 +00:00
Ian Dowse
b654e1067b Fix `fstat -m' (show memory-mapped files), which was broken by
revision 1.25. When evaluating the termination condition for the
iteration over all map entries, we must take care to use the kernel
versions of all pointers. The code was comparing a kernel pointer
to a pointer within a local variable, so the loop never terminated.
2001-02-15 22:42:44 +00:00
Ruslan Ermilov
9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
Kirk McKusick
1f7d250182 Change the proc information returned from the kernel so that it
no longer contains kernel specific data structures, but rather
only scalar values and structures that are already part of the
kernel/user interface, specifically rusage and rtprio. It no
longer contains proc, session, pcred, ucred, procsig, vmspace,
pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If
any of these changed in size, ps, w, fstat, gcore, systat, and
top would all stop working. The new structure has over 200 bytes
of unassigned space for future values to be added, yet is nearly
100 bytes smaller per entry than the structure that it replaced.
2000-12-12 07:25:57 +00:00
Alfred Perlstein
7a8671e9b7 remove struct mount from useland visibility 2000-12-04 09:21:05 +00:00
Ruslan Ermilov
8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Brian Feldman
d0482be885 Add a new options: -m enables searching for memory-mapped files.
It is not default because it's an expensive option by nature, making the
search take 2-3 times as long.

PR:		17555
Submitted by:	Ian Dowse <iedowse@maths.tcd.ie>
2000-04-05 05:45:40 +00:00
Brian Feldman
06e88916ef Support more filesystems in fstat(1): now you can use fstat(1) to
find out if files on msdosfs and cd9660 filestores are open.
There was also a movement of some common things to a header, a
small cleanup.

PR:	bin/16364 bin/7043
Submitted by:	Peter Edwards <peter.edwards@openet-telecom.com>
2000-03-16 02:02:34 +00:00
Yoshinobu Inoue
677e00c04e Fixed a little bit strange INET6 output.
Specified by: Ben Smithurst <ben@scientia.demon.co.uk>
Approved by: jkh
2000-02-19 21:46:45 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Brian Feldman
38cd1ee7d3 Make fstat work with file arguments again after being broken by dev_t
changes.  Thanks, Mr. Edwards!

Submitted by:	Peter Edwards <peter.edwards@ireland.com>
1999-11-13 21:13:25 +00:00
Sheldon Hearn
5ff829fdbf Add xrefs to the {f,net,sock}stat.1 manpages. While I'm in there, fix
the sockstat.1 document title, which still remembers when sockstat was
called lsock.

Reviewed by:	mpp
1999-09-06 13:14:24 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton
3be5f1f5ce Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
Ruslan Ermilov
0b7a57dd48 o use getprotobynumber(3) instead of hardcoded protocol names.
Divert(4) sockets will now appear as "internet raw divert"
  instead of "internet raw 254".

o -Wall tweak.

Reviewed by:	bde
1999-07-02 13:25:49 +00:00
Bruce Evans
22694ebad5 Fixed printf format errors. 1998-07-06 21:01:54 +00:00
Mark Murray
3492514dfd Include correct header to get definition of struct sockaddr_un. 1998-05-16 21:35:37 +00:00
Steve Price
9e7a1d01b0 Use -literal to make for a more pleasing list.
PR:		5547
Submitted by:	Matthew Hunt <mph@pobox.com>
1998-01-25 16:38:42 +00:00
Dima Ruban
d8ccfba46b Fix argument string for getopt.
Submitted by:	dillon@best.net
1997-09-18 23:16:17 +00:00
Alexander Langer
df8327e726 Display file size as an unsigned long. 1997-08-31 01:27:04 +00:00
John-Mark Gurney
e8a2a1c555 -I/sys converstion and Id line 1997-08-22 14:22:31 +00:00
Philippe Charnier
d49712cacf Typo. 1997-07-10 06:41:33 +00:00
Philippe Charnier
c1e6594288 Use err(3). 1997-07-08 11:02:48 +00:00
Bruce Evans
c263a0048d Removed `#define KERNEL'. This was a hack-around for nfs.h being broken
in the Lite2 merge to not export some nfs constants.  It started causing
warnings when I added a kernel-only #define for DIRBLKSIZ.

Removed `#define NFS'.  This was an old, bad interface for telling
<sys/mount.h> to export nfs stuff.
1997-03-29 12:50:41 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Peter Wemm
df3f5d9dd5 Merge from Lite2 1997-03-11 13:43:33 +00:00