The NetBSD Project

CVS log for src/bin/sh/miscbltin.c

[BACK] Up to [cvs.NetBSD.org] / src / bin / sh

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.53.2.1 / (download) - annotate - [select for diffs], Fri Nov 3 10:07:09 2023 UTC (4 months, 3 weeks ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Changes since 1.53: +35 -4 lines
Diff to previous 1.53 (colored) next main 1.54 (colored) to selected 1.23 (colored)

Pull up following revision(s) (requested by kre in ticket #454):

	bin/sh/miscbltin.c: revision 1.54

If the read builtin is told to read into IFS, we must avoid doing
that until all current uses of IFS are complete (as we have IFS's
value cached in ifs - if IFS alters, ifs might point anywhere).
Handle this by deferring assignments to IFS until everything is done.

This makes us appear to comply with the (currently) proposed requirement
for read by POSIX that field splitting complete before vars are
assigned.   (Other shells, like dash, ksh93, yash, bosh behave like this)

That might end up being unspecified though, as other shells (bosh,
mksh) assign each field to its var as it is delimited (though bosh
appears to have bugs).   If we wanted to go that route, the issue here
could have been handled by re-doing the init of ifs after every
setvar() that is performed here (except the last, after which it is
no longer needed).

Revision 1.54 / (download) - annotate - [select for diffs], Thu Oct 5 20:33:31 2023 UTC (5 months, 3 weeks ago) by kre
Branch: MAIN
CVS Tags: HEAD
Changes since 1.53: +35 -4 lines
Diff to previous 1.53 (colored) to selected 1.23 (colored)

If the read builtin is told to read into IFS, we must avoid doing
that until all current uses of IFS are complete (as we have IFS's
value cached in ifs - if IFS alters, ifs might point anywhere).
Handle this by deferring assignments to IFS until everything is done.
This makes us appear to comply with the (currently) proposed requirement
for read by POSIX that field splitting complete before vars are
assigned.   (Other shells, like dash, ksh93, yash, bosh behave like this)

That might end up being unspecified though, as other shells (bosh,
mksh) assign each field to its var as it is delimited (though bosh
appears to have bugs).   If we wanted to go that route, the issue here
could have been handled by re-doing the init of ifs after every
setvar() that is performed here (except the last, after which it is
no longer needed).

XXX pullup -10

Revision 1.53 / (download) - annotate - [select for diffs], Sun Dec 11 08:23:10 2022 UTC (15 months, 2 weeks ago) by kre
Branch: MAIN
CVS Tags: netbsd-10-base
Branch point for: netbsd-10
Changes since 1.52: +21 -10 lines
Diff to previous 1.52 (colored) to selected 1.23 (colored)


It appears that POSIX intends to add a -d X option to the read command
in its next version, so it can be used as -d '' (to specify a \0 end
character for the record read, rather than the default \n) to accompany
find -print0 and xargs -0 options (also likely to be added).

Add support for -d now.   While here fix a bug where escaped nul
chars (\ \0) in non-raw mode were not being dropped, as they are
when not escaped (if not dropped, they're still not used in any
useful way, they just ended the value at that point).

Revision 1.44.2.1 / (download) - annotate - [select for diffs], Thu Oct 27 16:16:50 2022 UTC (17 months ago) by martin
Branch: netbsd-8
Changes since 1.44: +12 -7 lines
Diff to previous 1.44 (colored) next main 1.45 (colored) to selected 1.23 (colored)

Pull up following revision(s) (requested by kre in ticket #1779):

	bin/sh/miscbltin.c: revision 1.51
	bin/sh/miscbltin.c: revision 1.52

PR bin/56972  Fix escape ('\') handling in sh read builtin.

In 1.35 (March 2005) (the big read fixup), most escape handling and IFS
processing in the read builtin was corrected.  However 2 cases were missed,
one is a word (something to be assigned to any variable but the last) in
which every character is escaped (the code was relying on a non-escaped char
to set the "in a word" status), and second trailing IFS whitespace at
the end of the line was being deleted, even if the chars had been escaped
(the escape chars are no longer present).

See the PR for more details (including the case that detected the problem).

After fixing this, I looked at the FreeBSD code (normally might do it
before, but these fixes were trivial) to check their implementation.

Their code does similar things to ours now does, but in a completely
different way, their read builtin is more complex than ours needs to
be (they handle more options).   For anyone tempted to simply incorporate
their code, note that it relies upon infrastructure changes elsewhere
in the shell, so would not be a simple cut and drop in exercise.

This needs pullups to -3 -4 -5 -6 -7 -8 and -9 (fortunately this is
happening before -10 is branched, so will never be broken this way there).

 -

Don't output the error for bad usage (no var name given)
after already writing the prompt (set with the -p option).

That results in nonsense like:
	$ read -p foo
	fooread: arg count

While here, improve the error message so it means something.

Now we will get:
$ read -p foo
read: variable name required
Usage: read [-r] [-p prompt] var...

[Detected by code reading while doing the work for the previous fix]

Revision 1.44.12.1 / (download) - annotate - [select for diffs], Thu Oct 27 16:14:42 2022 UTC (17 months ago) by martin
Branch: netbsd-9
Changes since 1.44: +12 -7 lines
Diff to previous 1.44 (colored) next main 1.45 (colored) to selected 1.23 (colored)

Pull up following revision(s) (requested by kre in ticket #1549):

	bin/sh/miscbltin.c: revision 1.51
	bin/sh/miscbltin.c: revision 1.52

PR bin/56972  Fix escape ('\') handling in sh read builtin.

In 1.35 (March 2005) (the big read fixup), most escape handling and IFS
processing in the read builtin was corrected.  However 2 cases were missed,
one is a word (something to be assigned to any variable but the last) in
which every character is escaped (the code was relying on a non-escaped char
to set the "in a word" status), and second trailing IFS whitespace at
the end of the line was being deleted, even if the chars had been escaped
(the escape chars are no longer present).

See the PR for more details (including the case that detected the problem).

After fixing this, I looked at the FreeBSD code (normally might do it
before, but these fixes were trivial) to check their implementation.

Their code does similar things to ours now does, but in a completely
different way, their read builtin is more complex than ours needs to
be (they handle more options).   For anyone tempted to simply incorporate
their code, note that it relies upon infrastructure changes elsewhere
in the shell, so would not be a simple cut and drop in exercise.

This needs pullups to -3 -4 -5 -6 -7 -8 and -9 (fortunately this is
happening before -10 is branched, so will never be broken this way there).

 -

Don't output the error for bad usage (no var name given)
after already writing the prompt (set with the -p option).

That results in nonsense like:
	$ read -p foo
	fooread: arg count

While here, improve the error message so it means something.

Now we will get:
$ read -p foo
read: variable name required
Usage: read [-r] [-p prompt] var...

[Detected by code reading while doing the work for the previous fix]

Revision 1.52 / (download) - annotate - [select for diffs], Fri Aug 19 12:52:31 2022 UTC (19 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.51: +6 -5 lines
Diff to previous 1.51 (colored) to selected 1.23 (colored)

Don't output the error for bad usage (no var name given)
after already writing the prompt (set with the -p option).

That results in nonsense like:

	$ read -p foo
	fooread: arg count

While here, improve the error message so it means something.

Now we will get:

$ read -p foo
read: variable name required
Usage: read [-r] [-p prompt] var...

[Detected by code reading while doing the work for the previous fix]

Revision 1.51 / (download) - annotate - [select for diffs], Fri Aug 19 12:17:18 2022 UTC (19 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.50: +8 -4 lines
Diff to previous 1.50 (colored) to selected 1.23 (colored)

PR bin/56972  Fix escape ('\') handling in sh read builtin.

In 1.35 (March 2005) (the big read fixup), most escape handling and IFS
processing in the read builtin was corrected.  However 2 cases were missed,
one is a word (something to be assigned to any variable but the last) in
which every character is escaped (the code was relying on a non-escaped char
to set the "in a word" status), and second trailing IFS whitespace at
the end of the line was being deleted, even if the chars had been escaped
(the escape chars are no longer present).

See the PR for more details (including the case that detected the problem).

After fixing this, I looked at the FreeBSD code (normally might do it
before, but these fixes were trivial) to check their implementation.
Their code does similar things to ours now does, but in a completely
different way, their read builtin is more complex than ours needs to
be (they handle more options).   For anyone tempted to simply incorporate
their code, note that it relies upon infrastructure changes elsewhere
in the shell, so would not be a simple cut and drop in exercise.

This needs pullups to -3 -4 -5 -6 -7 -8 and -9 (fortunately this is
happening before -10 is branched, so will never be broken this way there).

Revision 1.50 / (download) - annotate - [select for diffs], Sat Apr 16 14:26:26 2022 UTC (23 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.49: +65 -23 lines
Diff to previous 1.49 (colored) to selected 1.23 (colored)

Redo the way the builtin cmd 'ulimit' getopt() (nextopt() really, but it
is essentially the same) arg string is generated, to lessen the chances
that the table of limits, and the arg string that allows limits to be
reported or set will get out of sync.   They weren't (as long as we didn't
grow an RLIMIT_SWAP) this is just tidier.

While here, reorder the limits table fields, and shrink a couple that
were needlessly wasteful, to save some space -- for most architectures
this should save 8 bytes per table entry (there are currently 13).
(Some minor code bloat offsets this slightly because of int type
promotions now required).

NFCI.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Apr 16 14:23:36 2022 UTC (23 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.48: +10 -4 lines
Diff to previous 1.48 (colored) to selected 1.23 (colored)

While doing the previous change, I noticed that when used in a
particularly perverse way, the error message for a bad octal
constant as the new umask value could incorrectly claim that the
-S option (which would need to be present to cause this issue)
was the detected bad value.   Fix that to report the actual
incorrect arg.

And while fiddling, also check for args to umask that are too big
to be sane mask values (the biggest permitted is 07777) and use
mode_t as the mask variable type, rather than int.

Revision 1.48 / (download) - annotate - [select for diffs], Sat Apr 16 14:20:45 2022 UTC (23 months, 1 week ago) by kre
Branch: MAIN
Changes since 1.47: +4 -3 lines
Diff to previous 1.47 (colored) to selected 1.23 (colored)

Avoid generating error messages implying that user errors are illegal.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Dec 12 11:18:46 2021 UTC (2 years, 3 months ago) by andvar
Branch: MAIN
Changes since 1.46: +4 -4 lines
Diff to previous 1.46 (colored) to selected 1.23 (colored)

s/Miscelaneous/Miscellaneous/ and s/slahes/slashes/ in comments.

Revision 1.46 / (download) - annotate - [select for diffs], Tue Nov 16 11:27:50 2021 UTC (2 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.45: +14 -3 lines
Diff to previous 1.45 (colored) to selected 1.23 (colored)

Detect write errors to stdout, and exit(1) from some built-in
commands which (primarily) are used just to generate output
(or with a particular option combination do so).

Revision 1.45 / (download) - annotate - [select for diffs], Wed Sep 15 18:30:57 2021 UTC (2 years, 6 months ago) by kre
Branch: MAIN
Changes since 1.44: +44 -21 lines
Diff to previous 1.44 (colored) to selected 1.23 (colored)

Have the ulimit command watch for ulimit -n (alter number of available fds)
and keep the rest of the shell aware of any changes.

While here, modify 'ulimit -aSH' to print both the soft and hard limits
for the resources, rather than just (in this case, as H comes last) the
hard limit.   In any other case when both S and H are present, and we're
examining a limit, use the soft limit (just as if neither were given).

No change for setting limits (both are set, unless exactly one of -H
or -S is given).   However, we now check for overflow when converting
the value to be assigned, rather than just truncating the value however
it happens to work out...

Revision 1.44.10.2 / (download) - annotate - [select for diffs], Tue Apr 21 19:37:34 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.44.10.1: +0 -0 lines
Diff to previous 1.44.10.1 (colored) to branchpoint 1.44 (colored) next main 1.45 (colored) to selected 1.23 (colored)

Ooops, restore accidently removed files from merge mishap

Revision 1.44.10.1, Tue Apr 21 18:41:06 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.44: +2 -2 lines
FILE REMOVED

Sync with HEAD

Revision 1.43.6.1 / (download) - annotate - [select for diffs], Fri May 19 00:22:51 2017 UTC (6 years, 10 months ago) by pgoyette
Branch: prg-localcount2
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored) next main 1.44 (colored) to selected 1.23 (colored)

Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)

Revision 1.44 / (download) - annotate - [select for diffs], Sat May 13 15:03:34 2017 UTC (6 years, 10 months ago) by gson
Branch: MAIN
CVS Tags: prg-localcount2-base3, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Branch point for: phil-wifi, netbsd-9, netbsd-8
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored) to selected 1.23 (colored)

Fix inconsistent whitespace

Revision 1.43 / (download) - annotate - [select for diffs], Sat May 9 13:28:55 2015 UTC (8 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: prg-localcount2
Changes since 1.42: +4 -3 lines
Diff to previous 1.42 (colored) to selected 1.23 (colored)

CID 1225078: check getrlimit return

Revision 1.40.2.1 / (download) - annotate - [select for diffs], Tue Oct 30 18:46:08 2012 UTC (11 years, 5 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.40: +6 -3 lines
Diff to previous 1.40 (colored) next main 1.41 (colored) to selected 1.23 (colored)

sync with head

Revision 1.42 / (download) - annotate - [select for diffs], Mon Jun 11 18:28:10 2012 UTC (11 years, 9 months ago) by njoly
Branch: MAIN
CVS Tags: yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, khorben-n900, agc-symver-base, agc-symver
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored) to selected 1.23 (colored)

Allow thread limit queries by adding the new -r flag to ulimit. Add
the corresponding documentation in the man page.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Jun 9 02:49:48 2012 UTC (11 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.40: +5 -2 lines
Diff to previous 1.40 (colored) to selected 1.23 (colored)

support RLIMIT_NTHR.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Oct 11 15:27:11 2011 UTC (12 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: yamt-pagecache
Changes since 1.39: +18 -16 lines
Diff to previous 1.39 (colored) to selected 1.23 (colored)

print the flag too next to the units like bash does.

Revision 1.38.4.1 / (download) - annotate - [select for diffs], Thu Jun 23 14:17:48 2011 UTC (12 years, 9 months ago) by cherry
Branch: cherry-xenmp
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored) next main 1.39 (colored) to selected 1.23 (colored)

Catchup with rmind-uvmplock merge.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Jun 18 21:18:46 2011 UTC (12 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored) to selected 1.23 (colored)

PR/45069: Henning Petersen: Use prototypes from builtins.h .

Revision 1.37.2.1 / (download) - annotate - [select for diffs], Wed May 13 19:15:51 2009 UTC (14 years, 10 months ago) by jym
Branch: jym-xensuspend
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored) next main 1.38 (colored) to selected 1.23 (colored)

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.36.26.1 / (download) - annotate - [select for diffs], Wed Apr 1 00:25:21 2009 UTC (15 years ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b
Changes since 1.36: +3 -3 lines
Diff to previous 1.36 (colored) next main 1.37 (colored) to selected 1.23 (colored)

Pull up following revision(s) (requested by mrg in ticket #622):
	bin/csh/csh.1: revision 1.46
	bin/csh/func.c: revision 1.37
	bin/ps/print.c: revision 1.111
	bin/ps/ps.c: revision 1.74
	bin/sh/miscbltin.c: revision 1.38
	bin/sh/sh.1: revision 1.92 via patch
	external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
	lib/libkvm/kvm_proc.c: revision 1.82
	sys/arch/mips/mips/cpu_exec.c: revision 1.55
	sys/compat/darwin/darwin_exec.c: revision 1.57
	sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
	sys/compat/irix/irix_resource.c: revision 1.15
	sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
	sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
	sys/compat/linux/common/linux_limit.h: revision 1.5
	sys/compat/osf1/osf1_resource.c: revision 1.14
	sys/compat/svr4/svr4_resource.c: revision 1.18
	sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
	sys/kern/exec_subr.c: revision 1.62
	sys/kern/init_sysctl.c: revision 1.160
	sys/kern/kern_exec.c: revision 1.288
	sys/kern/kern_resource.c: revision 1.151
	sys/sys/param.h: patch
	sys/sys/resource.h: revision 1.31
	sys/sys/sysctl.h: revision 1.184
	sys/uvm/uvm_extern.h: revision 1.153
	sys/uvm/uvm_glue.c: revision 1.136
	sys/uvm/uvm_mmap.c: revision 1.128
	usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)

Revision 1.38 / (download) - annotate - [select for diffs], Sun Mar 29 01:02:49 2009 UTC (15 years ago) by mrg
Branch: MAIN
CVS Tags: matt-premerge-20091211, matt-mips64-premerge-20101231, jym-xensuspend-nbase, jym-xensuspend-base, cherry-xenmp-base, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: cherry-xenmp
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored) to selected 1.23 (colored)

- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)

Revision 1.37 / (download) - annotate - [select for diffs], Sun Dec 28 19:53:37 2008 UTC (15 years, 3 months ago) by christos
Branch: MAIN
Branch point for: jym-xensuspend
Changes since 1.36: +2 -6 lines
Diff to previous 1.36 (colored) to selected 1.23 (colored)

rlim_t will be unsigned as TOG mandates.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Oct 1 20:23:54 2005 UTC (18 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-5-base, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, mjf-devfs2-base, mjf-devfs2, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: netbsd-5
Changes since 1.35: +4 -3 lines
Diff to previous 1.35 (colored) to selected 1.23 (colored)

fix setmode error handling.

Revision 1.34.2.1 / (download) - annotate - [select for diffs], Thu Apr 7 11:34:20 2005 UTC (18 years, 11 months ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0
Changes since 1.34: +83 -33 lines
Diff to previous 1.34 (colored) next main 1.35 (colored) to selected 1.23 (colored)

Pull up revision 1.35 (requested by dsl in ticket #117):
Fix the way the 'read' builtin processes IFS.  In particular:
- IFS whitespace is now processes correctly,
- Trailing non-whitespace IFS characters are added to the last variable
  iff a subsequent variable would have been assigned a non-null string.
Now passes the 'read' tests in http://www.research.att.com/~gsf/public/ifs.sh

Revision 1.35 / (download) - annotate - [select for diffs], Sat Mar 19 14:22:50 2005 UTC (19 years ago) by dsl
Branch: MAIN
Changes since 1.34: +83 -33 lines
Diff to previous 1.34 (colored) to selected 1.23 (colored)

Fix the way the 'read' builtin processes IFS.  In particular:
- IFS whitespace is now processes correctly,
- Trailing non-whitespace IFS characters are added to the last variable
  iff a subsequent variable would have been assigned a non-null string.
Now passes the 'read' tests in http://www.research.att.com/~gsf/public/ifs.sh

Revision 1.34 / (download) - annotate - [select for diffs], Mon Apr 19 01:36:32 2004 UTC (19 years, 11 months ago) by lukem
Branch: MAIN
CVS Tags: netbsd-3-base
Branch point for: netbsd-3
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored) to selected 1.23 (colored)

Correct the description of sbsize; it is parsed in bytes not kbytes.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Apr 17 15:41:29 2004 UTC (19 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.32: +6 -3 lines
Diff to previous 1.32 (colored) to selected 1.23 (colored)

understand rlimit sbsize

Revision 1.32 / (download) - annotate - [select for diffs], Thu Aug 7 09:05:35 2003 UTC (20 years, 7 months ago) by agc
Branch: MAIN
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2
Changes since 1.31: +3 -7 lines
Diff to previous 1.31 (colored) to selected 1.23 (colored)

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.

Revision 1.31 / (download) - annotate - [select for diffs], Sun Nov 24 22:35:41 2002 UTC (21 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.30: +5 -11 lines
Diff to previous 1.30 (colored) to selected 1.23 (colored)

Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
  (so I could unset -e PS1 before running the test shell...)

Revision 1.30 / (download) - annotate - [select for diffs], Sun Feb 4 19:52:06 2001 UTC (23 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, ELRICshvfork-base, ELRICshvfork
Changes since 1.29: +3 -4 lines
Diff to previous 1.29 (colored) to selected 1.23 (colored)

remove redundant declarations and nexted externs.

Revision 1.29 / (download) - annotate - [select for diffs], Thu Jan 4 15:39:51 2001 UTC (23 years, 2 months ago) by lukem
Branch: MAIN
Changes since 1.28: +4 -4 lines
Diff to previous 1.28 (colored) to selected 1.23 (colored)

use more standard %ll_ in favour of %q_

Revision 1.28 / (download) - annotate - [select for diffs], Wed Nov 22 19:20:31 2000 UTC (23 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.27: +9 -8 lines
Diff to previous 1.27 (colored) to selected 1.23 (colored)

error message cleanup:
    - don't print the builtin name twice
    - explain why things fail
    - no extra newline

Revision 1.27 / (download) - annotate - [select for diffs], Sat Sep 26 19:28:12 1998 UTC (25 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4, minoura-xpg4dl-base, minoura-xpg4dl, comdex-fall-1999-base, comdex-fall-1999
Changes since 1.26: +3 -2 lines
Diff to previous 1.26 (colored) to selected 1.23 (colored)

include <stdlib.h> to get the prototype for free()

Revision 1.26 / (download) - annotate - [select for diffs], Thu Sep 24 17:49:48 1998 UTC (25 years, 6 months ago) by itohy
Branch: MAIN
Changes since 1.25: +11 -5 lines
Diff to previous 1.25 (colored) to selected 1.23 (colored)

The return value of setmode(3) is a pointer to malloc()'ed area
and must be freed to avoid memory leaks if called repeatedly.
The leaks occured on symbolic umask command, such as "umask go-w",
which is undocumented.

Revision 1.25 / (download) - annotate - [select for diffs], Wed May 20 00:32:05 1998 UTC (25 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored) to selected 1.23 (colored)

Cast is*() args to unsigned chars in case the ctype macros are implemented
using arrays.

Revision 1.19.2.2 / (download) - annotate - [select for diffs], Fri May 8 06:01:04 1998 UTC (25 years, 10 months ago) by mycroft
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002
Changes since 1.19.2.1: +9 -6 lines
Diff to previous 1.19.2.1 (colored) to branchpoint 1.19 (colored) next main 1.20 (colored) to selected 1.23 (colored)

Sync with trunk, per request of christos.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Feb 4 20:10:17 1998 UTC (26 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.23: +4 -4 lines
Diff to previous 1.23 (colored)

Fix printf formats so they work on the Alpha.

Revision 1.23 / (download) - annotate - [selected], Wed Jan 21 10:47:39 1998 UTC (26 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.22: +4 -4 lines
Diff to previous 1.22 (colored)

BSD4_4 is a standard symbol in <sys/param.h>; make sure that files
that need this defined, include <sys/param.h> and don't define it in
the Makefile. Add a comment to that effect.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Jan 16 16:26:22 1998 UTC (26 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored) to selected 1.23 (colored)

test for the boundary condition in the previous trailing blank fix

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jan 15 19:39:11 1998 UTC (26 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.20: +5 -2 lines
Diff to previous 1.20 (colored) to selected 1.23 (colored)

PR/4805: Ty Sarna: read builtin does not remove trailing blanks.

Revision 1.19.2.1 / (download) - annotate - [select for diffs], Thu Nov 6 07:00:17 1997 UTC (26 years, 4 months ago) by mellon
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-RELEASE, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Changes since 1.19: +8 -8 lines
Diff to previous 1.19 (colored) to selected 1.23 (colored)

Pull rev 1.20 up from trunk (kleink)

Revision 1.20 / (download) - annotate - [select for diffs], Wed Nov 5 14:05:28 1997 UTC (26 years, 4 months ago) by kleink
Branch: MAIN
Changes since 1.19: +8 -8 lines
Diff to previous 1.19 (colored) to selected 1.23 (colored)

Per 1003.2, the (builtin) read utility shall treat the backslash as an
escape character (including line continuation), unless the `-r' option
is specified:
* adopt to this behaviour, add the `-r' option to disable it;
* remove the `-e' option, which was previously necessary to get this behaviour.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jul 4 21:02:09 1997 UTC (26 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-3-base
Branch point for: netbsd-1-3
Changes since 1.18: +5 -3 lines
Diff to previous 1.18 (colored) to selected 1.23 (colored)

Fix compiler warnings.

Revision 1.18 / (download) - annotate - [select for diffs], Fri Apr 11 23:08:15 1997 UTC (26 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.17: +11 -2 lines
Diff to previous 1.17 (colored) to selected 1.23 (colored)

Make this work on systems that don't have quads

Revision 1.15.6.1 / (download) - annotate - [select for diffs], Sun Jan 26 04:57:26 1997 UTC (27 years, 2 months ago) by rat
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-PATCH001
Changes since 1.15: +6 -6 lines
Diff to previous 1.15 (colored) next main 1.16 (colored) to selected 1.23 (colored)

Update /bin/sh from trunk per request of Christos Zoulas.  Fixes
many bugs.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Jan 11 02:04:38 1997 UTC (27 years, 2 months ago) by tls
Branch: MAIN
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored) to selected 1.23 (colored)

kill 'register'

Revision 1.16 / (download) - annotate - [select for diffs], Wed Oct 16 15:45:11 1996 UTC (27 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.15: +5 -5 lines
Diff to previous 1.15 (colored) to selected 1.23 (colored)

PR/2808: Remove trailing whitespace (from FreeBSD)

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jun 12 19:44:16 1995 UTC (28 years, 9 months ago) by jtc
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA, netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Branch point for: netbsd-1-2
Changes since 1.14: +7 -9 lines
Diff to previous 1.14 (colored) to selected 1.23 (colored)

Changed type of rlimit values from quad_t to rlim_t.  Cast rlim_t's to
quad_t's and use "%qd" in printf.
Eliminated unneccessary conditional.

Revision 1.14 / (download) - annotate - [select for diffs], Thu May 11 21:29:32 1995 UTC (28 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.13: +162 -1 lines
Diff to previous 1.13 (colored) to selected 1.23 (colored)

Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.

Revision 1.13 / (download) - annotate - [select for diffs], Tue Mar 21 09:09:33 1995 UTC (29 years ago) by cgd
Branch: MAIN
Changes since 1.12: +7 -2 lines
Diff to previous 1.12 (colored) to selected 1.23 (colored)

convert to new RCS id conventions.

Revision 1.12 / (download) - annotate - [select for diffs], Mon Dec 5 19:07:45 1994 UTC (29 years, 3 months ago) by cgd
Branch: MAIN
Changes since 1.11: +11 -3 lines
Diff to previous 1.11 (colored) to selected 1.23 (colored)

clean up further.  more patches from Jim Jegers

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jun 11 16:12:11 1994 UTC (29 years, 9 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) to selected 1.23 (colored)

Add RCS ids.

Revision 1.10 / (download) - annotate - [select for diffs], Thu May 12 17:08:56 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.9: +0 -2 lines
Diff to previous 1.9 (colored) to selected 1.23 (colored)

use prototypes provided by header files instead of our own

Revision 1.9 / (download) - annotate - [select for diffs], Thu May 12 17:03:45 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.8: +2 -0 lines
Diff to previous 1.8 (colored) to selected 1.23 (colored)

Include appropriate header files to bring function prototypes into scope.

Revision 1.8 / (download) - annotate - [select for diffs], Wed May 11 17:53:54 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.7: +66 -14 lines
Diff to previous 1.7 (colored) to selected 1.23 (colored)

integrate NetBSD's POSIX.2 compliant umask builtin

Revision 1.7 / (download) - annotate - [select for diffs], Wed May 11 17:10:18 1994 UTC (29 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.6: +17 -70 lines
Diff to previous 1.6 (colored) to selected 1.23 (colored)

sync with 4.4lite

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Wed May 11 17:01:32 1994 UTC (29 years, 10 months ago) by jtc
Branch: WFJ-920714, CSRG
CVS Tags: lite-1
Changes since 1.1.1.1: +4 -4 lines
Diff to previous 1.1.1.1 (colored) to selected 1.23 (colored)

44lite code

Revision 1.6 / (download) - annotate - [select for diffs], Wed Apr 6 19:08:14 1994 UTC (29 years, 11 months ago) by cgd
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored) to selected 1.23 (colored)

do right right thing if 'read' given no args.  ptd out by Geoff Rehmet

Revision 1.5 / (download) - annotate - [select for diffs], Sun Aug 1 18:57:56 1993 UTC (30 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored) to selected 1.23 (colored)

Add RCS identifiers.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jul 21 00:02:33 1993 UTC (30 years, 8 months ago) by jtc
Branch: MAIN
Changes since 1.3: +67 -15 lines
Diff to previous 1.3 (colored) to selected 1.23 (colored)

Make umask builtin of shell POSIX 1003.2 compliant:
Print out a symbolic mask with the -S option; and accept symbolic mask
specifications.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Mar 23 00:28:32 1993 UTC (31 years ago) by cgd
Branch: MAIN
CVS Tags: netbsd-alpha-1, netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9, netbsd-0-8
Changes since 1.2: +1 -1 lines
Diff to previous 1.2 (colored) to selected 1.23 (colored)

changed "Id" to "Header" for rcsids

Revision 1.2 / (download) - annotate - [select for diffs], Mon Mar 22 08:04:00 1993 UTC (31 years ago) by cgd
Branch: MAIN
Changes since 1.1: +1 -0 lines
Diff to previous 1.1 (colored) to selected 1.23 (colored)

added rcs ids to all files

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Sun Mar 21 09:45:37 1993 UTC (31 years ago) by cgd
Branch: WFJ-920714, CSRG
CVS Tags: patchkit-0-2-2, WFJ-386bsd-01
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored) to selected 1.23 (colored)

initial import of 386bsd-0.1 sources

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 21 09:45:37 1993 UTC (31 years ago) by cgd
Branch: MAIN
Diff to selected 1.23 (colored)

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>