Commit Graph

9228 Commits

Author SHA1 Message Date
Ed Maste
7149ebf446 Use %zu for size_t, not %zd.
Submitted by:	ru
MFC after:	1 week
2009-09-23 15:32:59 +00:00
Mike Silbersack
aae0914135 In netstat -x, do not try to print out tcp timer status for udp sockets. 2009-09-23 05:32:33 +00:00
Jilles Tjoelker
a05cb85237 Update find(1) man page for -L/-delete interaction.
It is a bit unfortunate that the example to delete broken symlinks now uses
rm(1), but allowing this with -delete would require fixing fts(3) to not
imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option).

PR:		bin/90687
MFC after:	2 weeks
2009-09-20 16:47:56 +00:00
Diomidis Spinellis
ac8f32ce62 IEEE Std 1003.1, 2004 Edition states:
"The escape sequence '\n' shall match a <newline> embedded in
the pattern space."

It is unclear whether this also applies to a \n embedded in a
character class.  Disable the existing handling of \n in a character
class following Mac OS X, GNU sed version 4.1.5 with --posix, and
SunOS 5.10 /usr/bin/sed.

Pointed by:	Marius Strobl
Obtained from:	Mac OS X
2009-09-20 15:47:31 +00:00
Diomidis Spinellis
76570d0a99 Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementation
of the y (translate) command.

"If a backslash character is immediately followed by a backslash
character in string1 or string2, the two backslash characters shall
be counted as a single literal backslash character"

Pointed by:	Marius Strobl
Obtained from:	Mac OS X
2009-09-20 15:17:40 +00:00
Diomidis Spinellis
128e6a12b5 Allow [ to be used as a delimiter.
Pointed by:	Marius Strobl
Obtained from:	Apple
2009-09-20 14:11:33 +00:00
Mike Silbersack
b8614722ff Add the ability to see TCP timers via netstat -x. This can be a useful
feature when you have a seemingly stuck socket and want to figure
out why it has not been closed yet.

No plans to MFC this, as it changes the netstat sysctl ABI.

Reviewed by:	andre, rwatson, Eric Van Gyzen
2009-09-16 05:33:15 +00:00
Roman Divacky
d77fa17750 Add C/c/f/p/v switches plus a bunch of minor fixes and cleanups.
Obtained from:	NetBSD
Approved by:	des (maintainer)
Approved by:	ed (mentor, implicit)
2009-09-08 15:55:13 +00:00
Xin LI
277dbce981 Constify format string pointer, otherwise this would trigger warning when
higher warning level is enabled.
2009-09-08 01:11:23 +00:00
Pawel Jakub Dawidek
b61d9eabb4 Make sure to use up-to-date libarchive header files from source tree when
compiling tar and not the ones from /usr/include/.

Reviewed by:	kientzle
Approved by:	kientzle
2009-09-07 06:37:44 +00:00
Edward Tomasz Napierala
fa2db9145a Add NFSv4 ACL support to find(1).
Reviewed by:	rwatson
2009-09-04 20:01:16 +00:00
Andrey A. Chernov
234f1d7f1a Remove single occurance of HAS_CTYPE ifdef, ctype functions
used here for a long time and needs their header in anycase.
2009-09-04 07:44:27 +00:00
George V. Neville-Neil
54fc657d59 Add ARP statistics to the kernel and netstat.
New counters now exist for:
requests sent
replies sent
requests received
replies received
packets received
total packets dropped due to no ARP entry
entrys timed out
Duplicate IPs seen

The new statistics are seen in the netstat command
when it is given the -s command line switch.

MFC after:	2 weeks
In collaboration with: bz
2009-09-03 21:10:57 +00:00
Hajimu UMEMOTO
34903a55c3 Fix the problem that the entry broke into two lines with multi-byte
AM/PM format.

Reported by:	takawata
2009-08-30 11:17:42 +00:00
Colin Percival
f9f231846a Don't try to mmap the contents of empty files. This behaviour was harmless
prior to r195693, since historical behaviour of mmap(2) was to silently
ignore length-zero mmap requests; but mmap now returns EINVAL, which caused
look(1) to emit an error message and fail.

Among other things, this makes `freebsd-update fetch` on a newly installed
8.0-BETA3 system print bogus warning messages.

MFC after:	3 days
2009-08-26 03:30:06 +00:00
Andriy Gapon
497e910cd3 fstat: fix fsid comparison when executed on systems with 64-bit long
This affects only fstat on zfs and devfs, only on 64-bit systems
and only when fsid is greater than 2^31 - 1.
When fstat examines a file via stat(2) it takes uint32_t st_dev
and assigns to (signed) (64-bit) long fsid, this results in
a positive value.
When fstat examines opened files it takes int32_t f_fsid.val[0]
and assigns to (signed) (64-bit) long fsid, this results in
a negative value.
So, while initially st_dev and f_fsid.val[0] have the same bit
values they get promoted to different 64-bit values because
of the signed-vs-unsigned difference.

A fix is to use "more natural" positive numbers by introducing
intermediate unsigned cast for f_fsid.val[0].

Reviewed by:	jhb, lulf
Approved by:	re (kib)
MFC after:	1 week (to stable/7)
2009-08-20 10:57:14 +00:00
Dima Panov
5ad0a62fe0 Add my birthday
Approved by:	re (rwatson) miwi (mentor)
2009-08-15 15:40:30 +00:00
Robert Watson
d19d55a76f Update procstat(1) for the fact that devfs paths are no longer unsupported.
Approved by:	re (kib)
2009-08-12 10:41:37 +00:00
Xin LI
deb6327793 Correct a stack underflow in gzip:
- Limit suffix to be no more than 30 bytes long.  This matches GNU
   behavior.
 - Correct usage of memcpy().

Note that this commit only corrects the stack underflow issue, we
still need some other fixes to cover other edges. [1]

Reported by:	Ron Jude <ronj wytheville org>
Discussed with:	Matthew Green (original NetBSD gzip author),
		Eygene Ryabinkin <rea-fbsd codelabs ru> [1]
Approved by:	re (kib)
2009-07-31 08:37:27 +00:00
Xin LI
f0be0a1f8c Update less to v436. This is considered as a bugfix release from vendor.
Major changes from v429:
 * Don't pass "-" to non-pipe LESSOPEN unless it starts with "-".
 * Allow a fraction as the argument to the -# (--shift) option.
 * Fix highlight bug when underlined/overstruck text matches at end of line.
 * Fix non-regex searches with ctrl-R.

Approved by:	re (kensmith, kib)
2009-07-29 09:20:32 +00:00
Brooks Davis
254d03c508 Introduce a new sysctl process mib, kern.proc.groups which adds the
ability to retrieve the group list of each process.

Modify procstat's -s option to query this mib when the kinfo_proc
reports that the field has been truncated.  If the mib does not exist,
fall back to the truncated list.

Reviewed by:	rwatson
Approved by:	re (kib)
MFC after:	2 weeks
2009-07-24 19:12:19 +00:00
John Baldwin
013818111a Add a new type of VM object: OBJT_SG. An OBJT_SG object is very similar to
a device pager (OBJT_DEVICE) object in that it uses fictitious pages to
provide aliases to other memory addresses.  The primary difference is that
it uses an sglist(9) to determine the physical addresses for a given offset
into the object instead of invoking the d_mmap() method in a device driver.

Reviewed by:	alc
Approved by:	re (kensmith)
MFC after:	2 weeks
2009-07-24 13:50:29 +00:00
John Baldwin
29985e350d Move the check to ensure the locate database has the minimum required size
when using mmap() before invoking mmap().  This avoids a confusing error
message when locate is invoked against a zero-size database after the
recent change to make mmap() fail requests to map 0 bytes.

Submitted by:	Jaakko Heinonen  jh of saunalahti dot fi
Approved by:	re (kensmith)
MFC after:	1 week
2009-07-24 13:40:25 +00:00
Yi-Jheng Lin
bd8311d481 - Add my birthday
- Add myself to ports committers and to lwhsu's mentee list

Approved by:	re (kib), lwhsu (mentor)
2009-07-21 09:54:04 +00:00
Bjoern A. Zeeb
da1b35844b Remove no longer needed #include after removing the legacy
vimage API in r195741.

Reviewed by:	rwatson
Approved by:	re (kib)
2009-07-18 10:36:18 +00:00
Ed Schouten
523a386d23 Make mklocale work again, now that fwrite()'s return codes are different.
Submitted by:	Navdeep Parhar <nparhar gmail com>
Approved by:	re (kib)
2009-07-14 09:19:33 +00:00
Edward Tomasz Napierala
e50022797f Add manual page links to advertise procstat(1) a little better.
Approved by:	re (kib)
2009-07-09 16:40:00 +00:00
Brian Somers
58a654f664 Fix some uninitialise variables.
PR:		136383
Submitted by:	Ulrich Spoerlein - uqs at spoerlein dot net
Approved by:	re (kib)
MFC after:	3 weeks
2009-07-08 10:16:16 +00:00
Tim Kientzle
3e0fc6d3f3 This addresses some issues with my earlier -R fix that
were pointed out by Brooks Davis and Alexey Dokuchaev:
* It now tries to lookup arguments as names first, then tries
   to parse them as numbers.  In particular, this makes the
   behavior consistent with POSIX conventions when usernames
   consist entirely of digits.
* It now uses strtoul() for the numeric parsing.

Finally, I've included an update to the test harness
to exercise the new numeric cases for -R.

Approved by:	re (kib)
2009-07-06 02:02:45 +00:00
Tim Kientzle
99b13cfb97 This fixes bsdcpio's -R option to accept numeric
user or group Ids as well as user or group names.
In particular, this fixes freesbie2, which uses
-R 0:0 to copy a bunch of files so that the result
will be owned by root.

Also fixes a related bug that mixed-up the uid
and gid specified by -R when in passthrough mode.

Thanks to Dominique Goncalves for reporting this
regression.

Approved by:	re (kib)
2009-07-03 17:54:33 +00:00
Brian Somers
53c405786b Support shadow.byname and shadow.byuid maps, protecting them by
insisting on privileged port access.

Include /var/yp/Makefile.local if it exists and suggest using
it to override /var/yp/Makefile behaviour.

Approved by:	re (kib)
MFC after:	3 weeks
2009-06-25 16:15:39 +00:00
Xin LI
b47ed83de8 Sync with NetBSD:
- gzip -n does not store timestamp; [1]
 - Reduce diff against NetBSD by moving some casts in our local
   versions.

PR:		bin/134955
Obtained from:	NetBSD
MFC after:	1 month
2009-06-24 21:51:02 +00:00
John Baldwin
b648d4806b Change the ABI of some of the structures used by the SYSV IPC API:
- The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned
  short.
- The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned
  short.
- The mode member of struct ipc_perm is now mode_t instead of unsigned short
  (this is merely a style bug).
- The rather dubious padding fields for ABI compat with SV/I386 have been
  removed from struct msqid_ds and struct semid_ds.
- The shm_segsz member of struct shmid_ds is now a size_t instead of an
  int.  This removes the need for the shm_bsegsz member in struct
  shmid_kernel and should allow for complete support of SYSV SHM regions
  >= 2GB.
- The shm_nattch member of struct shmid_ds is now an int instead of a
  short.
- The shm_internal member of struct shmid_ds is now gone.  The internal
  VM object pointer for SHM regions has been moved into struct
  shmid_kernel.
- The existing __semctl(), msgctl(), and shmctl() system call entries are
  now marked COMPAT7 and new versions of those system calls which support
  the new ABI are now present.
- The new system calls are assigned to the FBSD-1.1 version in libc.  The
  FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls.
- A simplistic framework for tagging system calls with compatibility
  symbol versions has been added to libc.  Version tags are added to
  system calls by adding an appropriate __sym_compat() entry to
  src/lib/libc/incldue/compat.h. [1]

PR:		kern/16195 kern/113218 bin/129855
Reviewed by:	arch@, rwatson
Discussed with:	kan, kib [1]
2009-06-24 21:10:52 +00:00
Doug Rabson
0775314b63 Don't use sys/nfs/rpcv2.h - it is part of the old kernel RPC implementation
and will be removed.
2009-06-24 18:42:21 +00:00
Jamie Gritton
de6f37045c Add libjail, a (somewhat) simpler interface to the jail_set and jail_get
system calls and the security.jail.param sysctls.

Approved by:	bz (mentor)
2009-06-24 18:18:35 +00:00
Xin LI
ad852a184d %.s expects an int as the length specifier, so cast properly. 2009-06-23 23:37:25 +00:00
Xin LI
560daf85d9 Use strlcpy() instead of manually setting the last byte of the array to \0. 2009-06-23 23:34:46 +00:00
Xin LI
884f7c03dd Use strlcpy() instead of explicitly set \0 on the tail of the array. 2009-06-23 23:32:24 +00:00
Xin LI
db995e0027 Use C99 initialization when necessary; apply static to internal rountines.
This makes nfsstat WARNS=3 clean.
2009-06-23 23:18:19 +00:00
Xin LI
4f619e0e57 K&R -> ANSI 2009-06-23 23:17:04 +00:00
Xin LI
1946089b52 Use getprogname() instead of referencing __progname. 2009-06-23 23:16:00 +00:00
Konstantin Belousov
c9253e931d Usermode portion of the support for swap allocation accounting:
- update for getrlimit(2) manpage;
- support for setting RLIMIT_SWAP in login class;
- addition to the limits(1) and sh and csh limit-setting builtins;
- tuning(7) documentation on the sysctls controlling overcommit.

In collaboration with:	pho
Reviewed by:	alc
Approved by:	re (kensmith)
2009-06-23 20:57:27 +00:00
Xin LI
4ca8a62bb3 Add support for uncompressing pack(1)'ed files. Pack(1) is a program found
in some commercial Unix systems, which utilizes Huffman minimum redundancy
code tree to compress files.  This implementation supports the "new" pack
format only, just like GNU gzip did.

Thanks for oliver@'s archive set which I can test against, and Mingyan Guo
for providing helpful review of my code.

PR:		bin/109567
MFC after:	1 month
2009-06-21 09:39:43 +00:00
Brooks Davis
5255c009dd Restore the check against running as root that I accidentally removed in
r194493.
2009-06-20 18:24:29 +00:00
Christian S.J. Peron
0e37f3e196 Implement the -z (zero counters) option for the various bpf counters.
Add necessary changes to the kernel for this (basically introduce a
bpf_zero_counters() function).  As well, update the man page.

MFC after:	1 month
Discussed with:	rwatson
2009-06-19 20:31:44 +00:00
Xin LI
80b807fef2 Two fixes for SMALL case when compiling with WARNS=6:
- Reduce scope where return value can be referenced.
 - Add a dummy access to timestamp to silence warning.

Submitted by:	Mingyan Guo <guomingyan gmail com>
2009-06-19 19:28:21 +00:00
Brooks Davis
54404cfb13 In preparation for raising NGROUPS and NGROUPS_MAX, change base
system callers of getgroups(), getgrouplist(), and setgroups() to
allocate buffers dynamically.  Specifically, allocate a buffer of size
sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow).

This (or similar gymnastics) is required for the code to actually follow
the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime
and where getgroups may return {NGROUPS_MAX}+1 results on systems like
FreeBSD which include the primary group.

In id(1), don't pointlessly add the primary group to the list of all
groups, it is always the first result from getgroups().  In principle
the old code was more portable, but this was only done in one of the two
places where getgroups() was called to the overall effect was pointless.

Document the actual POSIX requirements in the getgroups(2) and
setgroups(2) manpages.  We do not yet support a dynamic NGROUPS, but we
may in the future.

MFC after:	2 weeks
2009-06-19 15:58:24 +00:00
Brooks Davis
68cc62cec1 When checking if we can write to a file, use access() instead of a
manual permission check based on stat output.  Also, get rid of the
executability check since it is not used.

MFC after:	2 weeks
2009-06-19 15:52:35 +00:00
Hajimu UMEMOTO
46f39347f5 Since the width is always 2, it is enough to put just one
trailing space is enough.

MFC after:	1 week
2009-06-18 16:40:00 +00:00
Hajimu UMEMOTO
bd97a998dc Fix column width of weekday names for multibyte locales.
Noticed by:	nyan
Discussed with:	matusita, takawata
MFC after:	1 week
2009-06-17 14:47:06 +00:00