Commit Graph

4319 Commits

Author SHA1 Message Date
Jacques Vidrine
c849849d06 It was reported that when using nss_ldap, getgrent(3) would behave
incorrectly when encountering `large' groups (many members and/or many
long member names).  The reporter tracked this down to the glibc NSS
module compatibility code (nss_compat.c): it would prematurely record
that a NSS module was finished iterating through its database in some
cases.

Two aspects are corrected:

1. nss_compat.c recorded that a NSS module was finished iterating
   whenever the module reported something other than SUCCESS.  The
   correct logic is to continue iteration when the module reports
   either SUCCESS or RETURN.  The __nss_compat_getgrent_r and
   __nss_compat_getpwent_r routines are updated to reflect this.

2. An internal helper macro __nss_compat_result is used to map glibc
   NSS status codes to BSD NSS status codes (e.g. NSS_STATUS_SUCCESS ->
   NS_SUCCESS).  It provided the obvious mapping.

   When a NSS routine is called with a too-small buffer, the
   convention in the BSD NSS code is to report RETURN.  (This is used
   to implement reentrant APIs such as getpwnam_r(3).)  However, the
   convention in glibc for this case is to set errno = ERANGE and
   overload TRYAGAIN.  __nss_compat_result is updated to handle this
   case.

PR:		bin/60287
Reported by:	Lachlan O'Dea <odela01@ca.com>
2004-01-09 13:43:49 +00:00
Jacques Vidrine
ff5fe653fa Adjust for brain outage that affected the previous commit.
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2004-01-06 20:29:40 +00:00
Jacques Vidrine
346866aa97 Add required headers. 2004-01-06 19:40:28 +00:00
Jacques Vidrine
2d24bf11c8 Add required headers and function declarations. 2004-01-06 19:28:07 +00:00
Jacques Vidrine
78ea1df143 Remove unused variables. Add required headers and function
declarations.
2004-01-06 18:53:26 +00:00
Jacques Vidrine
1d0342a3d5 Use ANSI C function definition for _mcount' and remove static'
prototype from header file.

Discussed with:	bde, maybe one year ago
2004-01-06 18:49:54 +00:00
Jacques Vidrine
a587d2f78f Add missing declaration. 2004-01-06 18:45:58 +00:00
Jacques Vidrine
e602b918db Work around a `warning: zero-length printf format string'. 2004-01-06 18:45:13 +00:00
Jacques Vidrine
2a8d656d26 Avoid undefined behavior:
foo[i] = bar[++i];  /* Which operator [] will be evaluated first? */
2004-01-06 18:43:31 +00:00
Jacques Vidrine
27a97dffc1 Make intentions explicit with additional parenthesis. 2004-01-06 18:32:24 +00:00
Jacques Vidrine
84d9142f58 Remove unused variables and function declarations. Add missing headers. 2004-01-06 18:26:15 +00:00
Maxim Konovalov
d22427bf0f Describe kern.ipc.nsfbufsused and kern.ipc.nsfbufspeak.
Reviewed by:	silby
2003-12-29 12:29:37 +00:00
Doug Rabson
4da7d0f5dd Make sure we initialise dirp->dd_size if we aren't reading a unionfs
directory.

Special thanks to: valgrind
2003-12-26 12:00:46 +00:00
Alfred Perlstein
7e2a61e17d Add restrict qualifiers. (docs)
PR: 44394
Submitted by: Craig Rodrigues <rodrige@attbi.com>
2003-12-24 18:52:41 +00:00
Andrey A. Chernov
ad4688e131 Properly advance "x/y/z" form slash-pointers in some rare cases
PR:             60539
2003-12-24 10:16:46 +00:00
Tom Rhodes
f2eeb0218f Back out previous commit due to incorrect content.
Noticed by:	wollman
2003-12-23 18:42:55 +00:00
Tom Rhodes
a0137e7055 Document many of the missing posix.1b options.
PR:		20528
Submitted by:	bms (original version)
Requested by:	mike (awhile ago)
2003-12-23 17:29:35 +00:00
Alexander Kabaev
50bcce79ff Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor
ó++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor

The ABI was initially defined for ia64, but GCC3 and Intel compilers
have adopted it on other platforms.

This is the patch from PR bin/59552 with a number of changes by
me.

PR:		bin/59552
Submitted by:	Bradley T Hughes (bhughes at trolltech dot com)
2003-12-19 17:11:21 +00:00
Alexander Kabaev
61cf73b3eb Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor
C++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor

The ABI was initially defined for ia64, but GCC3 and Intel compilers
have adopted it on other platforms.

This is the patch from PR bin/59552 with a number of changes by
me.

PR:		bin/59552
Submitted by:	Bradley T Hughes (bhughes at trolltech dot com)
2003-12-19 17:11:20 +00:00
Andrey A. Chernov
6abda1f093 First byte of GBK-like sequences is 0x81, not 0x80 2003-12-19 12:54:42 +00:00
Jordan K. Hubbard
fee66713ad Brucification: Don't initialize in declaration, make sure extra lines
follow declaration section.
2003-12-18 07:44:53 +00:00
Jordan K. Hubbard
dee551158f Do comparison using appropriate casting first, as per SUSv3 (search for first
[last] character, not int).
2003-12-17 02:46:48 +00:00
Joseph Koshy
08d4b26dd8 Document the effect of sysctl tunables controlling p_candebug(9) on
ktrace(2).
2003-12-14 14:54:53 +00:00
Bruce Evans
e481bf775f Fixed English error in previous commit. Fixed some older English errors.
Removed a redundant clause.
2003-12-11 09:53:25 +00:00
Mike Heffner
9e1cf49390 Add reference to standards/55112 for next time SHLIB_MAJOR is bumped.
Suggested by: wollman
2003-12-10 16:33:17 +00:00
Diomidis Spinellis
e0b2680610 Add sticky(8) cross reference.
PR:		docs/60068
Submitted by:	Ken Stailey
MFC after:	2 weeks
2003-12-10 15:08:41 +00:00
Peter Grehan
448264b8a8 - Put manh/manl bitfields into correct-sized integral type.
- remove XXX normalization bit comment, code is correct.
2003-12-10 13:04:42 +00:00
Marcel Moolenaar
75c3ca909b Add a short description of the kse_switchin(2) syscall to the kse
manpage and add a kse_switchin link. While here, list kse_thr_interrupt
before kse_wakeup in the MLINKS variable and the synopsis.
2003-12-10 02:38:51 +00:00
Tim J. Robbins
40c5c1f8a1 Set __mbrtowc and __wcrtomb correctly when changing to the C/POSIX locale.
Save __mbrtowc and __wcrtomb and restore them when changing back to
the cached locale.

Reported by:	perky
2003-12-08 23:52:22 +00:00
Murray Stokely
a298e0ba03 Add support for timeout: and attempts: resolver options.
Submitted by:	Paul Vixie <paul@vix.com> / ISC
MFC After:	1 week
2003-12-07 12:32:24 +00:00
Tim J. Robbins
bc0b3a1800 Split multibyte(3) into separate manual pages for each function.
Instead of just deleting it, turn the original page into a general
overview of the multibyte character conversion functions, somewhat
similar to stdio(3).
2003-12-07 06:33:52 +00:00
Tim J. Robbins
da44487bd7 Split the documentation for localeconv() off into a separate manual page. 2003-12-07 06:00:00 +00:00
Tim J. Robbins
5745b7c5af Fix prototype for getchar_unlocked(). 2003-12-07 05:12:51 +00:00
Peter Wemm
04cb6b3aa6 "Fix" makecontext() so that the C code begins execution with its
ABI-required stack alignment.  C code expects that the push of the
return address disturbed the 16 byte alignment and it will take corrective
measures to fix it before making another call.  Of course, if its wrong
to start with, then all hell breaks loose.  Essentially we "fix" this
by making the stack alignment odd to start with.

This was one of the things that broke on libkse with apps that use
floating point/varargs/etc.

Approved by:  re (scottl)
2003-12-05 01:36:44 +00:00
David Greenman
186e347f2c Fixed a bug in sendfile(2) where the sent data would be corrupted due
to sendfile(2) being erroneously automatically restarted after a signal
is delivered. Fixed by converting ERESTART to EINTR prior to exiting.

Updated manual page to indicate the potential EINTR error, its cause
and consequences.

Approved by: re@freebsd.org
2003-12-01 22:12:50 +00:00
Marcel Moolenaar
fd7707aa50 Do not adjust to the pagesize at runtime. Besides for the one-time
initialization overhead, there's a problem in that we never call
imalloc() and thus malloc_init() for zero-sized allocations. As a
result, malloc(0) returns NULL when it's the first or only malloc in
the program. Any non-zero allocation will initialize the malloc code
with the side-effect that subsequent zero-sized allocations return a
non-NULL pointer. This is because the pointer we return for zero-
sized allocations is calculated from malloc_pageshift, which needs
to be initialized at runtime on ia64.

The result of the inconsistent behaviour described above is that
configure scripts failed the test for a GNU compatible malloc. This
resulted in a lot of broken ports.

Other, even simpler, solutions were possible as well:
1.  initialize malloc_pageshift with some non-zero value (say 13 for
    8KB pages) and keep the runtime adjustment.
2.  Stop using malloc_pageshift to calculate ZEROSIZEPTR.

Removal of the runtime adjustment was chosen because then ia64 is the
same as any other platform. It is not to say that using a page size
obtained at runtime is bad per se. It's that there's currently a high
level of gratuity for its existence and the moment it causes problems
is the moment you need to get rid of it. Hence, it's not unthinkable
that this commit is (partially) reverted some time in the future when
we do have a good reason for it and a good way to achieve it.

Approved by: re@ (rwatson)
Reported by: kris (portmgr@) -- may the ports be with you
2003-11-28 18:03:22 +00:00
Tim J. Robbins
5314115636 Replace out of date struct statfs definition with a reference to statfs(2).
Approved by:	re
2003-11-21 01:30:28 +00:00
Diomidis Spinellis
434c74760f Fix problem where initgroups would silently truncate groups with
more than NGROUP elements without providing the opportunity to
setgroups to fail and correctly return error and set errno.

MFC after:	2 weeks
2003-11-19 15:51:26 +00:00
Diomidis Spinellis
988d4dc315 Documented missing EINVAL errno value
kern_prot.c:
if (ngrp > NGROUPS)
	return (EINVAL);

MFC after:	2 weeks
2003-11-19 13:05:50 +00:00
Jake Burkholder
eaf21f315e Install the user trap handlers that libc provides from a constructor, so
that they will be installed before application constructors are invoked.
Its possible to link applications such that this fails, application code
is invoked before they are installed, but, well, Don't Do That.

Approved by:	re (jhb)
2003-11-18 14:21:41 +00:00
Robert Watson
a2f046e874 Staticize label_default_head to prevent it from leaking out of mac.c.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-17 19:48:35 +00:00
Jacques Vidrine
8d870a43f9 Baby steps. Set WARNS=1 for libc. 2003-11-17 04:20:02 +00:00
Jacques Vidrine
c91e947dbd Detect range errors when using the %s specifier. Previously, LONG_MAX
was rejected as a range error, while any values less than LONG_MIN
were silently substituted with LONG_MIN.  Furthermore, on some
platforms `time_t' has less range than `long' (e.g. alpha), which may
give incorrect results when parsing some strings.
2003-11-17 04:19:15 +00:00
Robert Watson
237a5de859 Update mac_set.3 to account for new behavior of mac_set_fd() in the
context of sockets, and document EINVAL as a possible failure mode
based on the object selected, not just the label provided.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-16 20:21:21 +00:00
Robert Watson
920325ee1d Implement mac_get_peer(3) using getsockopt() with SOL_SOCKET and
SO_PEERLABEL.  This provides an interface to query the label of a
socket peer without embedding implementation details of mac_t in
the application.  Previously, sizeof(*mac_t) had to be specified
by an application when performing getsockopt().

Document mac_get_peer(3), and expand documentation of the other
mac_get(3) functions.  Note that it's possible to get EINVAL back
from mac_get_fd(3) when pointing it at an inappropriate object.

NOTE: mac_get_fd() and mac_set_fd() support for sockets will
follow shortly, so the documentation is slightly ahead of the
code.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-16 20:18:24 +00:00
Robert Watson
5859b37843 Memory allocated by mac_to_text() must be freed using free(3) not
mac_free(3), which is used only for variables of type mac_t in
the FreeBSD implementation.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-16 04:32:46 +00:00
Tim J. Robbins
607e2cc177 Resync. struct statfs and flag definitions with sys/mount.h. 2003-11-16 04:08:16 +00:00
Robert Watson
143460168a Remove debugging printf that crept into the last commit. 2003-11-15 04:05:49 +00:00
Robert Watson
6e07ce26f9 /etc/mac.conf is implicitly read and parsed when the MAC configuration
is accessed for the first time as a result of an application looking
up label configuration information.  Previously, the check and read
were kicked off by mac_prepare_(typename)() functions; since
mac_prepare_type() may now be directly employed by a user process,
push the check and initialization into that function.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-15 03:34:58 +00:00
Tim J. Robbins
8962b7a518 Update cross references after utf2/euc move. 2003-11-15 02:26:04 +00:00