summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Fix PRcracauer2010-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/143350 Empty string test gone wrong. Testing this requires that you have a locale that has the sign string unset but has int_n_sign_posn set (the default locale falls through to use "()" around negative numbers which is probably another bug). I created that setup by hand and indeed without this fix negative numbers are put out as positive numbers (doesn't fall through to use "-" as default indicator). Unfixed example in nl_NL.ISO8859-1 with lc->negative_sign set to empty string: strfmon(buf, sizeof(buf), "%-8i", -42.0); ==> example2: 'EUR 42,00' 'Eu 42,00' Fixed: example2: 'EUR 42,00-' 'Eu 42,00-' This file and suggested fix are identical in at least freebsd-8. Backport might be appropriate but some expert on locales should probably have a look at us defaulting to negative numbers in parenthesis when LC_* is default. That doesn't look right and is not what other OSes are doing. PR: 143350 Submitted by: Corinna Vinschen Reviewed by: bug reporter submitted, tested by me
* - Deal with some special cases [1]gabor2010-02-091-30/+54
| | | | | | | - style(9) nits Pointed out by: jilles [1] Approved by: delphij (mentor)
* Add PT_VM_TIMESTAMP and PT_VM_ENTRY so that the tracing process canmarcel2010-02-091-1/+76
| | | | | | | | obtain the memory map of the traced process. PT_VM_TIMESTAMP can be used to check if the memory map changed since the last time to avoid iterating over all the VM entries unnecesarily. MFC after: 1 month
* Mark up "unsigned char".ru2010-02-044-4/+11
|
* Reinstate the ptrace patch to restore the 'gp' register after callingneel2010-02-041-0/+3
| | | | | | | | | | a function. I made a mistake in assuming that the .cprestore directive will cause the assembler to automatically restore 'gp' after the 'jalr'. The .cprestore directive does its magic only after 'jal' and 'bal' instructions - not the 'jalr'. Pointed out by: c.jayachandran@gmail.com
* -White space cleanup (missing spaces in new line)rrs2010-02-031-5/+2
| | | | | | -Remove extra tab. -Took out the duplicate code that cprestore does. All suggested by Neel.
* Also add a cross-reference to NetBSD updlastlogx().ed2010-02-031-1/+3
|
* This fixes a bug found and fixed by JC. Basicallyrrs2010-02-031-1/+13
| | | | | | | no save was being done of the ra and gp pointers before we call the __error function. Obtained from: JC (c.jayachandran@gmail.com)
* Bump .Dd, forgotten in r203393gavin2010-02-021-1/+1
| | | | | Approved by: ed (mentor, implicit) MFC after: 1 week
* The multiplicand a = 0x5deece66d = 25214903917, not 0xfdeece66d.gavin2010-02-021-1/+1
| | | | | | | | | This bug in the man page has gone unnoticed for over 15 years! PR: docs/143461 Submitted by: Jeremy Huddleston jeremyhu apple.com Approved by: ed (mentor, implicit) MFC after: 1 week
* Implement strndup(3) using strnlen(3).ed2010-02-021-3/+1
| | | | | This makes the implementation a bit more consistent with strdup(3), which uses strlen(3).
* Fix bugs:jasone2010-01-314-1352/+2256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix a race in chunk_dealloc_dss(). * Check for allocation failure before zeroing memory in base_calloc(). Merge enhancements from a divergent version of jemalloc: * Convert thread-specific caching from magazines to an algorithm that is more tunable, and implement incremental GC. * Add support for medium size classes, [4KiB..32KiB], 2KiB apart by default. * Add dirty page tracking for pages within active small/medium object runs. This allows malloc to track precisely which pages are in active use, which makes dirty page purging more effective. * Base maximum dirty page count on proportion of active memory. * Use optional zeroing in arena_chunk_alloc() to avoid needless zeroing of chunks. This is useful in the context of DSS allocation, since a long-lived application may commonly recycle chunks. * Increase the default chunk size from 1MiB to 4MiB. Remove feature: * Remove the dynamic rebalancing code, since thread caching reduces its utility.
* Remove extra semicolon.brucec2010-01-311-1/+1
| | | | Approved by: rrs (mentor)
* Fix typo of ENOTCONN.brucec2010-01-314-3/+5
| | | | | | Add missing RETURN VALUES section in sctp_opt_info(3). Approved by: rrs (mentor)
* Perform some cleanups to devname(3).ed2010-01-311-13/+10
| | | | | | | | | | | - Make sure the mode argument is either a character or a block device. - Use S_IS*() instead of checking S_IF*-flags by hand. - Don't use kern.devname when the argument is already NODEV. - Always call snprintf with the proper amount of arguments corresponding with the format. - Perform some whitespace fixes. Tabs instead of 4 spaces, missing space for return statement. - Remove unneeded includes.
* - Fix some style(9) bugsgabor2010-01-291-17/+16
| | | | Pointed out by: bde
* You must include fcntl.h (in practice) to be able to do anything usefulrwatson2010-01-291-0/+1
| | | | | | with shm_open(2), as otherwise the O_ flags are undefined. MFC after: 3 days
* Add missing return, in a rare case where we can't allocate memory inemaste2010-01-271-0/+1
| | | | | | | deallocate. Submitted by: Ryan Stone (rysto32 at gmail dot com) Approved by: jasone
* Remove pseudo-terminals from ttys(5).ed2010-01-271-36/+1
| | | | | | | | | | | | When we had utmp(5), we had to list all the psuedo-terminals in ttys(5) to make ttyslot(3) function properly. Now that pututxline(3) deals with slot allocation internally (not based on TTY names), we don't need to list all the TTYs on the system in ttys(5) to make user accounting work properly. This patch removes all the entries from the /etc/ttys files, but also the pts(4) entries that were appended implicitly, which was added in r154838.
* Add information about when nmount(2) was introduced.trasz2010-01-261-1/+5
|
* - style(9)gabor2010-01-251-25/+25
| | | | Approved by: delphij
* Cache failing and opened catalogs in catopen() and related functions.gabor2010-01-251-17/+131
| | | | | | | | | | | | | Continuous catopen() calls cause 4 failig stat(2) each, which means a lot of overhead. It is also a good idea to keep the opened catalogs in the memory to speed up further catopen() calls to the same catalog since these catalogs are not big at all. In this case, we count references and only free() the allocated space when the reference count reaches 0. The reads and writes to the cache are syncronized with an rwlock when these functions are called from a threaded program. Requested by: kib Approved by: delphij
* Improve the ttyname(3) manual page.ed2010-01-241-20/+5
| | | | | | - Remove unrelated references to tty(5). - Remove unneeded relation with FILE *. - Add better cross references.
* Make strsignal(3) thread-safe.ume2010-01-241-4/+48
| | | | MFC after: 2 weeks
* EMPTY records don't have a timestamp.ed2010-01-231-1/+2
|
* Reapply r201145 to lib/libc/gen/sem.cantoine2010-01-231-1/+1
|
* Just ignore the timestamps given to pututxline().ed2010-01-233-23/+12
| | | | | | | | | | | | | I've noticed many applications do a bad job at timekeeping, for several reasons: - Applications like screen(1) don't update time records when restoring the old user login record. - Many applications only set ut_tv.tv_sec, not ut_tv.tv_usec. This causes many problems for tools such as ac(8), which require the timestamps to be properly ordered. This is why I've decided to let the utmpx code obtain valid timestamps itself.
* English nitpicking.ed2010-01-221-1/+1
| | | | Submitted by: jmallett
* Describe why pututxline() doesn't entirely conform to standards.ed2010-01-221-2/+20
|
* Remove comments about breaking the specification.ed2010-01-221-2/+0
| | | | | | | | | | | | | | | I've discussed this issue with the Austin Group and it will be fixed in future revisions of the specification. The issue was that ut_line fields weren't supposed to be valid for LOGIN_PROCESS entries, while getutxline() would try to match these records anyway. They also agreed on our way of implementing pututxline() without getutxid() (which other operating systems also do), but unfortunately they disagreed with our way of replacing DEAD_PROCESS entries, which is a pity. The current specification allows the utmpx database to become infinitely big over time. See also: http://austingroupbugs.net/view.php?id=213#c378
* - Update Galician cataloggabor2010-01-211-0/+46
|
* The waitpid(2) function needs neither sys/time.h nor sys/resource.h.pjd2010-01-201-2/+2
|
* Style: reword comment.ache2010-01-201-1/+1
| | | | Submitted by: bde
* For alphasort() add reference to strcoll(3)ache2010-01-201-2/+4
|
* Style: rename internal function to opendir_compar()ache2010-01-201-2/+2
| | | | Pointed by: bde
* Style: remove extra empty line in the comment.ache2010-01-201-1/+0
| | | | Pointed by: bde
* Revert r202447 by re-exposing the old uname(3) function.ed2010-01-192-3/+4
| | | | | | | | | | | | | | | | It makes hardly any sense to expose a symbol which should only be provided for binary compatibility, but it seems we don't have a lot of choice here. There are many autoconf scripts out there that try to create a binary that links against the old symbol to see whether uname(3) is present. These scripts fail to detect uname(3) now. It should be noted that the behaviour we implement is not against the standards: | The following shall be declared as a function and may also be defined | as a macro: | | int uname(struct utsname *);
* Double checking my commit I found that comment saying thatache2010-01-181-7/+3
| | | | | | | | POSIX 2008 and XSI 7require strcoll() for opendir() is not true. I can't find such requirement in POSIX 2008 and XSI 7. So, back out that part of my commit, returning old strcmp(), and remove this misleading comment.
* preserve errno when processing error cases.davidxu2010-01-181-1/+3
|
* a) Use strcoll() in opendir() and alphasort() as POSIX 2008 requires.ache2010-01-182-8/+4
| | | | | | | | | | | | | | | | | It also matches now how our 'ls' works for years. b) Remove comment expressed 2 fears: 1) One just simple describe how strcoll() works in _any_ context, not for directories only. Are we plan to remove strcoll() from everything just because it is little more complex than strcmp()? I doubt, and directories give nothing different here. Moreover, strcoll() used in 'ls' for years and nobody complaints yet. 2) Plain wrong statement about undefined strcoll() behaviour. strcoll() always gives predictable results, falling back to strcmp() on any trouble, see strcoll(3). No objections from -current list discussion.
* Perform several small cleanups to the utmpx code.ed2010-01-175-60/+62
| | | | | | | | | | | | | | | | - Massively reduce BSS usage. Let futx_to_utx() dynamically allocate the structure. There is only a very small amount of applications out there that needs to use the utmpx database. Wasting 1 KB on unused structures makes little sense. - Just let getutxid() search for matching ut_id's for any *PROCESS-type. This makes the code a bit more future-proof. - Fix a POSIX-mistake: when reading POSIX and the OpenSolaris implementation, getutxline() must return USER_PROCESS and LOGIN_PROCESS records whose ut_lines match. When reading POSIX, it seems LOGIN_PROCESS should not use ut_line at the first place. I have reported this issue.
* Add forgotten break; keyword to getutxid().ed2010-01-171-0/+2
| | | | | We should not fall through to the ut_id comparison. Only ut_type should be compared when using OLD_TIME, NEW_TIME, BOOT_TIME or SHUTDOWN_TIME.
* Simplify ttyslot(3).ed2010-01-171-25/+1
| | | | | | | | | | | After comparing how other systems deal with utmp/utmpx, I noticed many systems don't even care about ttyslot(3) anymore, since utmpx doesn't use TTY slots anyway. We don't provide any tools to access old utmp files anymore, so there is no use in letting applications write to a proper offset within the utmp file. Just let ttyslot(3) always return 0, which seems to be the default behaviour on operating systems like Linux as well.
* Unexpose the old uname(3) function.ed2010-01-162-4/+3
| | | | | | Nowadays uname(3) is an inline function around __xuname(3). Prevent linkage of new binaries against this compatibility function, similar to what I did with ttyslot(3).
* Also call sem_module_init in sem_close to initialize mutexdavidxu2010-01-151-0/+2
| | | | with some attributes.
* Add wtmpcvt(1).ed2010-01-141-0/+1
| | | | | | | | | | This utility allows users to convert their wtmp databases to the new format. It makes no sense for users to keep their wtmp log files if they are unable to view them. It basically copies ut_line into ut_id as well. This makes it possible for last(1) and ac(8) to match login records with their corresponding logout record.
* Remove ttyslot from Symbol.map anyway.ed2010-01-141-1/+0
| | | | Requested by: kan
* Unbreak pututxline() on 32-bit architectures.ed2010-01-141-4/+4
| | | | | | | | I forgot to cast the size_t's back to off_t before negating them, causing all sorts of artifacts where the log files would grow to 2^32 - 197 bytes. Reported by: ume
* Revert the change to Symbol.map, made in r202274.ed2010-01-141-0/+1
| | | | | | | | | | | | | Even though we use __sym_compat(), we should list the symbol in Symbol.map. ttyslot() is now listed as follows, which seems to do the right thing: | Symbol table '.dynsym' contains 2755 entries: | Num: Value Size Type Bind Vis Ndx Name | 613: 00000000000477b0 121 FUNC GLOBAL DEFAULT 10 ttyslot@FBSD_1.0 Reported by: kib
* Don't use fseeko() to obtain the file offset.ed2010-01-141-1/+1
| | | | | I was a bit confused with lseek(), which returns the new offset. We should ftello() to obtain it using stdio.
OpenPOWER on IntegriCloud