if the block has moved, arrange so that trailing newlines are never placed in the string
in the first place, by accumulating them and adding them only after we've encountered a
non-newline character. This allows also for more efficient appending since we know how much
we need beforehand. From FreeBSD.
it will always be displayed when an unprivilegied user moves files across
filesystems (mv(1) uses cp -p in that case). After all, there is no warning
that we loose a setuid bit during a move or copy, so this makes sense.
Fixes bin/45259
Also introduce library functions for copying extended attributes from one
file to another:
- extattr_copy_file, extattr_copy_fd, extattr_copy_link, with FreeBSD style,
where a namespace is to be supplied
- cpxattr, fcpxattr, lcpxattr, with Linux style, where all namespaces
accessible to the caller are copied, and the others are silently ignored.
getpagesize() to size_t. For some reason getpagesize() is defined to
return int, and several of the page counts we get come back from the
kernel as int32_t; in LP64 without the cast the byte count will be
computed in a 32-bit value and for large processes will overflow and
become negative... and then remain negative when divided by 1024 to
convert to kilobytes.
Fixes a problem I hit the other day where I saw negative RSS, which
turns out also to be PR 40642.
Note: other logic in here will break down when we first get >2TB
processes... and int32 page counts will break on >8TB processes. But
hopefully we won't see any of that for a few years yet.
Push -Wno-array-bounds down to the cases that depend on it.
Selectively disable warnings for 3rd party software or non-trivial
issues to be reviewed later to get clang -Werror to build most of the
tree.
C99ism (inlined variable declaration), which hurts when pdksh is used
for bootstrapping pkgsrc. Move the two declarations to the beginning
of the block.
"if" and "of" with the exception that the communicate with a rump
kernel instead of the host kernel.
For example, to write stdout to /tmp/file.txt in a rump kernel namespace:
dd rof=/tmp/file.txt
copy /file1 to /file2 inside a rump kernel:
dd rif=/file1 rof=/file2
copy a snippet from /dev/rmd0d on the rump kernel to the host fs:
dd rif=/dev/rmd0d of=save seek=1000 count=3
Eat that, usermode OS.
(I'll document the operands one I have some manpage to refer to
for rump client use).
Bring back fixes from revision 1.75:
- Fix a couple of bugs to make the following two echo statements print the
same output as they should:
line='#define bindir "/usr/bin" /* comment */'
echo "${line%%/\**}"
echo ${line%%/\**}
1. ISDBLQUOTE() was not working properly for non VSNORMAL expansions because
varnest was incremented before the variable was completely parsed. Add
an insub adjustment to keep track of that.
2. When we have a quoted backslash, we either need to escape twice, because
one level of escaping will be stripped later (in the variable substitution
case) or simply enter the backslash.
same output as they should:
line='#define bindir "/usr/bin" /* comment */'
echo "${line%%/\**}"
echo ${line%%/\**}
1. ISDBLQUOTE() was not working properly for non VSNORMAL expansions because
varnest was incremented before the variable was completely parsed. Add
an insub adjustment to keep track of that.
2. When we have a quoted backslash, we need to escape twice, because one
level of escaping will be stripped later. (XXX: Do that when insub == 1
only?)
- Make macros statements
Write out the mmap-ed data in small chunks to avoid locking the output
file for a long time.
Suggested by David Holland on "source-changes-d" mailing list.
a very annoying property: if the source media is slow (like a slow
network), the target file will be locked for the duration of the
entire max 8MB write and cause processes attempting to e.g. stat()
it to "tstile" (for several minutes in the worst case). Revisit
this if/when vnode locking gets a little smarter.
chs ok (although he would rather see vnode locking improvements,
but that's a slightly larger project)
if user don't specify --force-local but opened file is actually
a local file.
- Make cpio to accept -F option as described in manpage.
- Make pax to set forcelocal flag if requested to do so.
- Add missing break statement.
This document should now serve as a reasonable tutorial for the
modern POSIX shell. Comments and additional fixes for mistakes I may
have made are solicited.
allowed to leak into POSIX and selects the behavior cd already implements.
Closes PR bin/42557 and also relevant to PR pkg/42168.
I suppose this should probably be pulled up to both -4 and -5...
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.
Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).
Discussed on <tech-kern>, reviewed by <ad>.
need to be on a stack instead of being a single variable since
directories are processed depth-first. Otherwise dne randomly
depends on the previously processed entry.
This fixes both chmod of non-created directories (they used to be
chmod'd even when not created if their last child element did not
exist in the target subtree) and a "foo exists" bug exposed by my
last commit which removed directory sorting.
all regression tests passed
before directories since files (usually) are in the same cylinder
group and subdirectories aren't. However, this mostly changed with
the new ffs dirpref algorithm in 2001.
No sorting has two effects:
1) copy appears to be somewhat faster (e.g. on my laptop cp'ing build
objdir to tmpfs is 7% faster after the change)
2) source file parameters no longer get randomly shuffled due to
fts doing an unstable sort of them. this means that
"cp 1 2 3 4 dest/" will copy the files in that order instead
of e.g. 3 4 1 2.
have been this way since at least 4.4. This will still dump core if
malloc fails on the first trip through, instead of on any malloc
failure, but should otherwise behave much more reasonably.
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 :-)