summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
* Use struct vdso_timehands data to implement fast gettimeofday(2) andkib2012-06-2210-2/+374
| | | | | | | | | | | | | | | clock_gettime(2) functions if supported. The speedup seen in microbenchmarks is in range 4x-7x depending on the hardware. Only amd64 and i386 architectures are supported. Libc uses rdtsc and kernel data to calculate current time, if enabled by kernel. Hopefully, this code is going to migrate into vdso in some future. Discussed with: bde Reviewed by: jhb Tested by: flo MFC after: 1 month
* Add the functions documented in the man pages in commit 237393 to theissyl02012-06-211-2/+7
| | | | | | | | relevant Makefile. Reminded by: gavin Approved by: gabor (mentor) MFC after: 5 days
* Be explicit about the dependency on nsparser.h.obrien2012-06-211-1/+1
|
* Add more locale-specific functions to the relevant man pages:issyl02012-06-214-7/+54
| | | | | | | | | | | - libc/string/strcoll.3 - libc/string/strstr.3 - libc/string/strxfrm.3 - libc/string/strcasecmp.3 Reviewed by: theraven, gabor Approved by: gabor (mentor) MFC after: 5 days
* Don't close an uninitialized descriptor. [1]eadler2012-06-201-2/+6
| | | | | | | | | | Add a sanity check for the validity of the passed fd. PR: kern/139080 [1] Submitted by: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> [1] Reviewed by: pjd (briefly) Approved by: cperciva MFC after: 1 week
* Further refine the implementation of POSIX_FADV_NOREUSE.jhb2012-06-191-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | First, extend the changes in r230782 to better handle the common case of using NOREUSE with sequential reads. A NOREUSE file descriptor will now track the last implicit DONTNEED request it made as a result of a NOREUSE read. If a subsequent NOREUSE read is adjacent to the previous range, it will apply the DONTNEED request to the entire range of both the previous read and the current read. The effect is that each read of a file accessed sequentially will apply the DONTNEED request to the entire range that has been read. This allows NOREUSE to properly handle misaligned reads by flushing each buffer to cache once it has been completely read. Second, apply the same changes made to read(2) by r230782 and this change to writes. This provides much better performance in the sequential write case as it allows writes to still be clustered. It also provides much better performance for misaligned writes. It does mean that NOREUSE will be generally ineffective for non-sequential writes as the current implementation relies on a future NOREUSE write's implicit DONTNEED request to flush the dirty buffer from the current write. MFC after: 2 weeks
* libc: Reduce relative relocations in strftime().jilles2012-06-171-1/+1
|
* More style.kib2012-06-161-19/+14
| | | | MFC after: 3 days
* Revert part of the r235740 which changed separate allocation of thekib2012-06-161-2/+7
| | | | | | | | | | | | | | string buffer for each linelist l_line into one large string. Since linelists parsed out during the previous passes store the pointers to previously allocated l_lines, the reallocation caused undefined behaviour on accessing the buffers, and quite deterministic fault on freeing them (in mountd(8) startup). This fixes reading of netgroup(5) file which contains more then one netgroup. Discussed with: ghelmer MFC after: 3 days
* mandoc fixes.joel2012-06-161-14/+5
| | | | Obtained from: OpenBSD
* Per kib, since __flt_rounds is being added to FreeBSD 10, itkientzle2012-06-151-0/+3
| | | | | | belongs in FBSD_1.3. MFC after: 1 week
* Make sure that fstab fd is not leaked on exec.kib2012-06-141-1/+11
| | | | | | PR: kern/169023 Submitted by: Jukka Ukkonen <jau iki fi> MFC after: 1 week
* __flt_rounds is a public symbol (expands from the FLT_ROUNDS macro),kientzle2012-06-141-1/+1
| | | | | | | | | | so include it in the public namespace on arm just as with other architectures. This corrects r236816. Submitted by: Jan Sieka MFC after: 1 week
* Switch from 4-clause to 2-clause BSD license. (OpenBSD r1.22)delphij2012-06-111-8/+1
| | | | | | No functional change. Obtained from: NetBSD via OpenBSD
* Fix a leak when setting the global character locale to "C" from something else.theraven2012-06-111-7/+13
| | | | Reported by: mm
* __flt_rounds was omitted from the exported symbols here.kientzle2012-06-091-0/+1
| | | | | | Submitted by: Jan Sieka Reviewed by: arm@ MFC after: 1 week
* Fix two warnings about self-assignment in libc. These normally onlydim2012-06-062-2/+2
| | | | | | | trigger with clang, when you either use -save-temps, or ccache. Reported by: Sevan / Venture37 <venture37@gmail.com> MFC after: 3 days
* 1) Although unpublished version of standardache2012-06-051-17/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://austingroupbugs.net/view.php?id=385#c713 (Resolved state) recommend this way for the current standard (called "earlier" in the text) "However, earlier versions of this standard did not require this, and the same example had to be written as: // buf was obtained by malloc(buflen) ret = write(fd, buf, buflen); if (ret < 0) { int save = errno; free(buf); errno = save; return ret; } " from feedback I have for previous commit it seems that many people prefer to avoid mass code change needed for current standard compliance and prefer to track unpublished standard instead, which requires now that free() itself must save errno, not its usage code. So, I back out "save errno across free()" part of previous commit, and will fill PR for changing free() isntead. 2) Remove now unused serrno. MFC after: 1 week
* 1) IEEE Std 1003.1-2008, "errno" section, is explicit thatache2012-06-041-6/+16
| | | | | | | | | | | | | | | | | "The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified." However, free() in IEEE Std 1003.1-2008 does not mention its interaction with errno, so MAY modify it after successful call (it depends on particular free() implementation, OS-specific, etc.). So, save errno across free() calls to make code portable and POSIX-conformant. 2) Remove unused serrno assignment. MFC after: 1 week
* Remove invalid remark about pipes.ed2012-06-021-2/+2
| | | | | | | | | The stat structures returned on pipes seems to contain all the information required by POSIX. Especially the wording "and thus to a pipe" makes little sense, because it seems to imply a certain relationship between sockets and pipes that simply isn't there. MFC after: 2 weeks
* mdoc: minor Bl improvements.joel2012-06-021-1/+1
|
* Style(9) improvements: remove unnecessary parenthesis, improve orderghelmer2012-06-011-50/+52
| | | | | | | of local variable declarations, remove bogus casts, and resolve long lines. Reviewed by: bde
* Only set _w to 0 when the file stream is not currently reading. Withouteadler2012-05-301-1/+1
| | | | | | | | | | this fflush may fail to write data in the buffer. PR: kern/137819 Submitted by: Eric Blake <ebb9@byu.net> Reviewed by: theraven Approved by: cperciva MFC after: 2 weeks
* Clarify the SEEK_HOLE description, it repositions the file pointer.kib2012-05-261-4/+4
| | | | MFC after: 3 days
* Doh... Don't add __eabi to an old version tag (i.e. FBSD_1.0). Add it to themarcel2012-05-251-1/+4
| | | | | | current one (= FBSD_1.3). Pointed out by: kib
* Allow building for the PowerPC EABI by providing a dummy __eabi()marcel2012-05-243-1/+35
| | | | | | | function. The purpose of the __eabi() function is to set up the runtime and is called first thing by main(). The runtime is already set up for us prior to caling main, so there's nothing to do for us in the EABI case.
* Add two new locale-specific man pages:issyl02012-05-233-1/+157
| | | | | | | | | - libc/stdio/scanf_l.3 - libc/stdio/printf_l.3 Reviewed by: theraven Approved by: gabor (mentor) MFC after: 5 days
* Update copyright date.tuexen2012-05-231-2/+3
| | | | MFC after: 3 days
* Add missing header needed by free()kevlo2012-05-221-0/+1
| | | | Reported by: tinderbox
* Add checks for memory allocation failures in appropriate places, andghelmer2012-05-211-12/+27
| | | | | | | | avoid creating bad entries in the grp list as a result of memory allocation failures while building new entries. PR: bin/83340 Reviewed by: delphij (prior version of patch)
* Apply style(9) to return and switch/case statements.ghelmer2012-05-211-19/+22
| | | | Reviewed by: delphij (prior version of the patch)
* Disable NLS catalog use in libc if built with WITHOUT_NLS option.gleb2012-05-211-0/+2
| | | | Functions affected: strerror, strsignal, gai_strerror.
* Don't link against libssp if MK_SSP is set to no.marcel2012-05-191-1/+5
| | | | Note that this still misses a proper dependency at this time.
* Put my name as copyright owner of lib/libc/gen/dirfd.c added in r235647.gleb2012-05-191-7/+4
| | | | Requested by: kib@
* Hide DIR definition by making it an opaque struct typedef.gleb2012-05-1913-7/+127
| | | | | | | | | | Introduce dirfd() libc exported symbol replacing macro with same name, preserve _dirfd() macro for internal use. Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable name to prevent shadowing global symbol. Sponsored by: Google Summer Of Code 2011
* Use the LLINDEX macro to access the link-level I/F index. This makesmarcel2012-05-194-4/+4
| | | | | | | it possible to work with a different type for the sdl_index field -- it only requires a recompile. Obtained from: Juniper Networks, Inc.
* mdoc: avoid unterminated quoted strings.joel2012-05-131-5/+5
|
* Minor mdoc nits.joel2012-05-131-1/+1
|
* Minor mdoc nits.joel2012-05-122-4/+4
|
* Remove tab from kernel configuration option. This is consistent with the restjoel2012-05-121-1/+1
| | | | of our manual pages.
* mdoc: end list context with El.joel2012-05-121-0/+1
|
* General mdoc(7) and typo fixes.gjb2012-05-1114-20/+21
| | | | | | PR: 167734 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org) MFC after: 3 days
* According to SUSv4, realpath(3) must fail ifkib2012-05-112-12/+29
| | | | | | | | | | | | | | | | | [ENOENT] A component of file_name does not name an existing file or file_name points to an empty string. [ENOTDIR] A component of the path prefix is not a directory, or the file_name argument contains at least one non- <slash> character and ends with one or more trailing <slash> characters and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory. Add checks for the listed conditions, and set errno accordingly. Update the realpath(3) manpage to mention SUS behaviour. Remove the requirement to include sys/param.h before stdlib.h. PR: 128933 MFC after: 3 weeks
* Fix copy/paste error in lib/libc/locale/toupper.c.dim2012-05-101-1/+1
| | | | Submitted by: Kohji Okuno <okuno.kohji@jp.panasonic.com>
* Remove reference to non-existent FreeBSD Security Architectureeadler2012-05-091-3/+1
| | | | | Approved by: cperciva MFC after: 3 days
* Plug a leak.kib2012-05-081-2/+5
| | | | | Submitted by: Greg Bednarek <gbednarek averesystems com> MFC after: 1 week
* General mdoc(7) and typo fixes.gjb2012-05-0813-17/+20
| | | | | PR: 167713 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org)
* Remove debug output.tuexen2012-05-041-1/+0
| | | | MFC after: 3 days
* Remove incorrect __restrict qualifier on several pointersdumbbell2012-04-302-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The typical case was: static __inline int convert_ccl(FILE *fp, char * __restrict p, [...]) { [...] if (p == SUPPRESS_PTR) { [...] } else { [...] } [...] } This qualifier says that the pointer is the only one at that time pointing to the resource. Here, clang considers that "p" will never match "SUPPRESS_PTR" and optimize the if{} block out. This leads to segfaults in programs calling vfscanf(3) and vfwscanf(3) with just the format string (no arguments following it). The following softwares were reported to abort with segmentation fault and this patch fixes it: o cmake o smartd o devel/ORBit2 dim@ opened an LLVM PR to discuss this clang optimization: http://llvm.org/bugs/show_bug.cgi?id=12656 Tested by: bsam@
* fix a further typo in the pdfork(2) man page.rwatson2012-04-301-1/+1
| | | | | Submitted by: Norman Hardy MFC after: 3 days
OpenPOWER on IntegriCloud