summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Use umtx to implement process sharable semaphore, to make this work,davidxu2010-01-056-79/+682
| | | | | | | | | | | | | | | | | | | | | | now type sema_t is a structure which can be put in a shared memory area, and multiple processes can operate it concurrently. User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open() to initialize a shared semaphore. Named semaphore uses file system and is located in /tmp directory, and its file name is prefixed with 'SEMD', so now it is chroot or jail friendly. In simplist cases, both for named and un-named semaphore, userland code does not have to enter kernel to reduce/increase semaphore's count. The semaphore is designed to be crash-safe, it means even if an application is crashed in the middle of operating semaphore, the semaphore state is still safely recovered by later use, there is no waiter counter maintained by userland code. The main semaphore code is in libc and libthr only has some necessary stubs, this makes it possible that a non-threaded application can use semaphore without linking to thread library. Old semaphore implementation is kept libc to maintain binary compatibility. The kernel ksem API is no longer used in the new implemenation. Discussed on: threads@
* Modernize scandir(3) and alphasort(3) interfaces according to the IEEEkib2010-01-043-18/+15
| | | | | | | | | | | | | | | | | | | | Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions, so we better follow too (older glibc used old BSDish alphasort prototype and corresponding type of the comparision function for scandir). While there, change the definitions of the functions to ANSI C and fix several style issues nearby. Remove requirement for "sys/types.h" include for functions from manpage. POSIX also requires that alphasort(3) sorts as if strcoll(3) was used, but leave the strcmp(3) call in the function for now. Adapt in-tree callers of scandir(3) to new declaration. The fact that select_sections() from catman(1) could modify supplied struct dirent is a bug. PR: standards/142255 MFC after: 2 weeks
* Don't forget to clean up the file copied from the kernel sources.ed2010-01-021-0/+2
| | | | MFC after: 1 week
* The devices that supported EVFILT_NETDEV kqueue filters were removed inbrooks2009-12-311-20/+0
| | | | | | | | | | | | r195175. Remove all definitions, documentation, and usage. fifo_misc.c: Remove all kqueue tests as fifo_io.c performs all those that would have remained. Reviewed by: rwatson MFC after: 3 weeks X-MFC note: don't change vlan_link_state() function signature
* Use _once() to initialize the pthread key for thread-local storage to holdjhb2009-12-301-14/+14
| | | | | | the results of gmtime() instead of using a pthread mutex directly. MFC after: 1 week
* Document _FAST and _PRECISE clocks.kib2009-12-291-10/+40
| | | | | Submitted by: Valentin Nechayev <netch segfault kiev ua> MFC after: 3 days
* Document CLOCK_SECOND, add cross-reference from time(3) to clock_gettime(2).kib2009-12-292-3/+7
| | | | | Based on submission by: pluknet gmail com MFC after: 3 days
* Use clock_gettime(CLOCK_SECOND) instead of gettimeofday(2) forkib2009-12-291-4/+3
| | | | | | | | implementation of time(3). CLOCK_SECOND is much faster. No objections from: phk Submitted by: Valentin Nechayev <netch segfault kiev ua> MFC after: 1 week
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.antoine2009-12-281-1/+1
| | | | | | | | | Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version) MFC after: 1 month
* Use a local copy of entry_d for finding matches. Otherwise, if entry_d pointedmarkus2009-12-251-1/+6
| | | | | | | | to an entry of 'acl', all ACL entries starting with entry_d would be deleted. Reviewed by: trasz Approved by: emax (mentor) MFC after: 3 days
* MFV of tzdata2009t, r200831edwin2009-12-221-1/+1
| | | | | | | | | | zic: - Fix URL / reference to Calendrical Calculations: Third Edition libc/stdtime: - Fix typo in tzfile.5 (no changes in our part) MFC after: 1 week
* Use vsprintf instead of rolling our own.delphij2009-12-211-9/+1
| | | | | | PR: bin/140496 Submitted by: Jeremy Huddleston <jeremyhu apple.com> MFC after: 1 month
* Use vsscanf instead of rolling our own.delphij2009-12-211-24/+1
| | | | | | PR: bin/140530 Submitted by: Jeremy Huddleston <jeremyhu apple.com> MFC after: 1 month
* K&R -> ANSI prototype.delphij2009-12-211-8/+3
| | | | MFC after: 1 month
* Use _once() to initialize the pthread key for thread-local storage to holdjhb2009-12-211-14/+14
| | | | | | the results of localtime() instead of using a pthread mutex directly. MFC after: 1 week
* (no commit message)matteo2009-12-161-1/+2
|
* cpuset(2): fix a typo and a markup error in the man pagejilles2009-12-151-2/+2
| | | | MFC after: 1 week
* Simplify arena_run_reg_dalloc(), and remove a bug that was due to incorrectjasone2009-12-101-89/+28
| | | | initialization of ssize_invs.
* Fix the posix_memalign() changes in r196861 to actually return a NULL pointerjasone2009-12-101-0/+1
| | | | | | as intended. PR: standards/138307
* sem_init(3): document process shared semaphores and their restrictionsjilles2009-12-081-18/+9
|
* Revert behavior change to setenv(), unsetenv() and putenv() until a morescf2009-12-071-3/+6
| | | | thorough security review has been completed.
* Update the getenv(3) man page to reflect the recent change to the behaviorscf2009-12-061-9/+9
| | | | | | | of setenv(), putenv() and unsetenv() when dealing with corrupt entries in environ. They now output a warning and complete their task without error. MFC after: 1 week
* Change the behavior of setenv(), putenv() and unsetenv() to continue parsingscf2009-12-061-6/+3
| | | | | | | | | | | | instead of returning an error if a corrupt (not a "name=value" string) entry in the environ array is detected when (re)-building the internal environment. This should prevent applications or libraries from experiencing issues arising from the expectation that these calls will complete even with corrupt entries. The behavior is now as it was prior to 7.0. Reviewed by: jilles MFC after: 1 week
* Improve the comment within getenv() explaining the search order it takes toscf2009-12-061-8/+9
| | | | | | | | | | find a variable. Include a note that it must not cause the internal environment to be generated since malloc() depends upon getenv(). To call malloc() would create a circular dependency. Recommended by: green Approved by: jilles MFC after: 1 week
* Fix many "function declaration isn't a prototype" warnings in libc.ed2009-12-0512-42/+27
| | | | | I've only fixed code that seems to be written by `us'. There are still many warnings like this present in resolv/, rpc/, stdtime/ and yp/.
* Don't let the C library depend on <utmp.h>.ed2009-12-053-14/+12
| | | | | | The maximum length of a username has nothing to do with the size of the username in the utmp files. Use MAXLOGNAME, which is defined as 17 (UT_USERSIZE + 1).
* Remove warnings from exec.c.ed2009-12-051-20/+19
| | | | | | | | The entries in the argv array are not const themselves, but sometimes we want to fill in const values. Just make the array const and use __DECONST() to make it const for the execve()-call itself. Also convert the only K&R prototype to ANSI.
* Use ANSI C prototypes inside termios.ed2009-12-051-31/+13
| | | | While there, add a missing __unused to hide a warning in tcsetbreak().
* Remove (hidden) warning about missing prototypes for fdevname(3).ed2009-12-051-0/+1
|
* Add a missing word to a sentence in the return values section.trhodes2009-12-041-1/+1
|
* - Update the Spanish NLS cataloggabor2009-12-031-5/+51
| | | | | | | | | | | Reviewed by: carvay, the.infamous.paul@gmail.com, Joan Picanyol i Puig <lists-freebsd-es@biaix.org>, Ing . Marcos Luis Ortiz Valmaseda <mlortiz@uci.cu>, eskanete@gmail.com, Jose M Rodriguez <josemi@freebsd.jazztel.es>, Guillermo Hernandez <guillermo@QuerySoft.es>, dani.doni@gmail.com
* The fd_mask type is an unsigned long, not an int, so treat the mask as ajhb2009-12-031-2/+2
| | | | | | | | | | long instead of an int when examining the results of select() to look for RPC requests. Previously this routine would ignore RPC requests to sockets whose file descriptor mod 64 was greater than 31 on a 64-bit platform. PR: amd64/141130 Submitted by: liujb of array networks MFC after: 3 days
* Fix the dprintf() prototype.brueffer2009-12-021-2/+2
| | | | | | PR: 141087 Submitted by: Jeremy Huddleston <jeremyhu@apple.com> MFC after: 3 days
* Add an .Nm for strncat.brueffer2009-12-011-2/+3
| | | | | | PR: 141037 Submitted by: Jeremy Huddleston <jeremyhu@apple.com> MFC after: 3 days
* Temporarily revert the previous change because the linker has beengreen2009-12-011-36/+28
| | | | modified so that it will abort when the environment is bad.
* Describe what setpgid(2) does when pgid=0. The text has beenkeramida2009-12-011-0/+5
| | | | | | | | | | copied from NetBSD's manpage, and it also matches the behavior described by the Open Group's online copy of setpgid.2 at http://www.opengroup.org/onlinepubs/009695399/functions/setpgid.html Obtained from: NetBSD Submitted by: Petros Barbayiannis <petrosbarbayiannis@yahoo.gr> MFC after: 1 week
* Do not gratuitously fail *env(3) operations due to corrupt ('='-less)green2009-12-011-28/+36
| | | | | | | | | | | | | **environ entries. This puts non-getenv(3) operations in line with getenv(3) in that bad environ entries do not cause all operations to fail. There is still some inconsistency in that getenv(3) in the absence of any environment-modifying operation does not emit corrupt environ entry warnings. I also fixed another inconsistency in getenv(3) where updating the global environ pointer would not be reflected in the return values. It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3) in order to see the change.
* - correct xref sectionsdanger2009-11-282-4/+4
| | | | | | PR: docs/140940 Submitted by: Bruce Cran <bruce@cran.org.uk> MFC after: 1 week
* Properly use the envp argument in execvPe().ed2009-11-271-2/+2
| | | | | | | | | | | | | | | execvPe() is called by _execvpe(), which we added to implement posix_spawnp(). We just took execvP() and added the envp argument. Unfortunately we forgot to change the implementation to use envp over environ. This fixes the following piece of code: | char * const arg[2] = { "env", NULL }; | char * const env[2] = { "FOO=BAR", NULL }; | posix_spawnp(NULL, "/usr/bin/env", NULL, NULL, arg, env); MFC after: 2 weeks
* Reset path name back to original correctly in fts_build() whenjh2009-11-261-5/+2
| | | | | | | | | | | FTS_NOCHDIR option is used. fts_build() could strip a trailing slash from path name in post-order visit if a path pointing to an empty directory was given for fts_open(). PR: bin/133907, kern/134513 Reviewed by: das Approved by: trasz (mentor) MFC after: 1 month
* Clarify that the value of the fts_info field is different in post-order.jh2009-11-261-4/+3
| | | | | | Discussed with: das Approved by: trasz (mentor) MFC after: 1 week
* Implement sighold, sigignore, sigpause, sigrelse, sigset functionskib2009-11-264-8/+250
| | | | | | | | | | from SUSv4 XSI. Note that the functions are obsoleted, and only provided to ease porting from System V-like systems. Since sigpause already exists in compat with different interface, XSI sigpause is named xsi_sigpause. Reviewed by: davidxu MFC after: 3 weeks
* Style: use structure assignment rather than memcpy() to copy awollman2009-11-251-1/+1
| | | | structure.
* In clnt_raw_create(), avoid minor race condition initializing thewollman2009-11-251-4/+7
| | | | | | | file-scope variable clntraw_private. Found by: Clang static analyzer MFC after: 7 days
* In svc_raw_reply(), don't leave stat uninitialized if the MSG_ACCEPTEDwollman2009-11-251-3/+2
| | | | | | | && SUCCESS case succeeds. The stack garbage might be zero. Found by: Clang static analyzer MFC after: 7 days
* Eliminate more dead stores.wollman2009-11-257-10/+9
| | | | | Found by: Clang static analyzer MFC after: 7 days
* Make all three if conditions look similar by always initializing nsecwollman2009-11-251-1/+2
| | | | | | | | and moving the default initialization of prec into the else clause. The clang static analyzer erroneously thought that nsec can be used uninitialized here; it was not actually possible, but better to make the code clearer. (Clang can't know that sprintf() won't modify *pi behind the scenes.)
* In __mbsconv(), if prec was zero, nconv could have been usedwollman2009-11-251-1/+1
| | | | | | | | | uninitialized. Initialize it to a safe value so that there's no chance of returning an error if stack garbage happens to be equal to (size_t)-1 or (size_t)-2. Found by: Clang static analyzer MFC after: 7 days
* Eliminate dead store.wollman2009-11-251-1/+1
| | | | | Found by: Clang static analyzer MFC after: 7 days
* Revert the previous change to pthread_once() stub in libc. It is actuallyjhb2009-11-203-7/+3
| | | | | | | | a feature that libstdc++ depends on to simulate the behavior of libc's internal '__isthreaded' variable. One benefit of this is that _libc_once() is now private to _once_stub.c. Requested by: kan
OpenPOWER on IntegriCloud