aboutsummaryrefslogtreecommitdiff
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
...
* Use strcmp that I replaced by accident.Kevin Lo2012-05-211-3/+3
| | | | Notes: svn path=/head/; revision=235713
* Fix broken ref countKevin Lo2012-05-211-0/+1
| | | | | | | Submitted by: gcooper Notes: svn path=/head/; revision=235712
* Fix improper handling of variadic args with ICDEBUGKevin Lo2012-05-211-3/+1
| | | | | | | | PR: kern/168095 Submitted by: gcooper Notes: svn path=/head/; revision=235711
* Remove dead codeKevin Lo2012-05-211-5/+3
| | | | Notes: svn path=/head/; revision=235710
* Remove second consts in r233288 in order to appease C++ compilers.Marius Strobl2012-03-261-10/+10
| | | | | | | | | While at it, remove some style(9) bugs in libkern.h. Submitted by: kan Notes: svn path=/head/; revision=233517
* Declare the CRC lookup-tables const as they hardly should change atMarius Strobl2012-03-211-10/+10
| | | | | | | run-time. Notes: svn path=/head/; revision=233288
* Implement extensions on top of standards instead of the other way around.Ed Schouten2012-01-032-14/+2
| | | | | | | | Now that index() and rindex() have become unused, simply turn them into wrappers around strchr() and strrchr(), respectively. Notes: svn path=/head/; revision=229366
* Use strchr() and strrchr().Ed Schouten2012-01-021-2/+2
| | | | | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel. Notes: svn path=/head/; revision=229272
* Remove the now unused skpc() function.Ed Schouten2012-01-011-49/+0
| | | | | | | | | | | | It was only used by ufs and ext2 and I have really strong doubts that there are other pieces of code that also use this function. If it turns out that external drivers use this code as well, I'd be happy to migrate or revert. Bump __FreeBSD_version while there. Notes: svn path=/head/; revision=229204
* Introducing memcchr(3).Ed Schouten2012-01-011-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | It seems two of the file system drivers we have in the tree, namely ufs and ext3, use a function called `skpc()'. The meaning of this function does not seem to be documented in FreeBSD, but it turns out one needs to be a VAX programmer to understand what it does. SPKC is an instruction on the VAX that does the opposite of memchr(). It searches for the non-equal character. Add a new function called memcchr() to the tree that has the following advantages over skpc(): - It has a name that makes more sense than skpc(). Just like strcspn() matches the complement of strspn(), memcchr() is the complement of memchr(). - It is faster than skpc(). Similar to our strlen() in libc, it compares entire words, instead of single bytes. It seems that for this routine this yields a sixfold performance increase on amd64. - It has a man page. Notes: svn path=/head/; revision=229198
* retire libkern getsAndriy Gapon2011-12-171-77/+0
| | | | | | | | | Inspired by: bde MFC after: 2 months X-MFC-Note: if deemed a part of KPI, just call cngets internally Notes: svn path=/head/; revision=228642
* Add unicode support to msdosfs and smbfs; original pathes from imura,Kevin Lo2011-11-182-0/+552
| | | | | | | | | bug fixes by Kuan-Chung Chiu <buganini at gmail dot com>. Tested by me in production for several days at work. Notes: svn path=/head/; revision=227650
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Add strnlen() to libkern.Jung-uk Kim2011-10-041-0/+42
| | | | Notes: svn path=/head/; revision=226029
* Fix typos - remove duplicate "is".Rebecca Cran2011-02-231-1/+1
| | | | | | | | | PR: docs/154934 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days Notes: svn path=/head/; revision=218965
* Add support for asterisk characters when filling in the GELI passwordEd Schouten2010-11-141-1/+9
| | | | | | | | | | | | | | during boot. Change the last argument of gets() to indicate a visibility flag and add definitions for the numerical constants. Except for the value 2, gets() will behave exactly the same, so existing consumers shouldn't break. We only use it in two places, though. Submitted by: lme (older version) Notes: svn path=/head/; revision=215299
* Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() generalAttilio Rao2010-09-242-0/+403
| | | | | | | | | | | | | in the kernel (just as inet_ntoa() and inet_aton()) are and sync their prototype accordingly with already mentioned functions. Sponsored by: Sandvine Incorporated Reviewed by: emaste, rstone Approved by: dfr MFC after: 2 weeks Notes: svn path=/head/; revision=213103
* Provide memchr() in the libkern.Rafal Jaworowski2010-06-021-0/+51
| | | | | | | | | | | This is required by libfdt and will be compiled in conditionally only for FDT-enabled platforms. Reviewed by: imp Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=208751
* Switch to our preferred 2-clause BSD license.Joel Dahl2010-04-073-21/+3
| | | | | | | Approved by: bp Notes: svn path=/head/; revision=206361
* Start copyright notice with /*-Joel Dahl2010-04-072-2/+2
| | | | Notes: svn path=/head/; revision=206360
* Move inet_aton() (specular to inet_ntoa(), already present in libkern)Attilio Rao2009-11-121-0/+136
| | | | | | | | | | | into libkern in order to made it usable by other modules than alias_proxy. Obtained from: Sandvine Incorporated Sponsored by: Sandvine Incorporated MFC: 1 week Notes: svn path=/head/; revision=199208
* done method is supposed to return int.Xin LI2009-06-221-1/+1
| | | | Notes: svn path=/head/; revision=194665
* Split tolower/toupper code from usual xlat16 kiconv table, and make itXin LI2009-06-223-24/+168
| | | | | | | | | | | possible to do tolower/toupper independently without code conversion. Submitted by: imura (but bugs are mine) Obtained from: http://people.freebsd.org/~imura/kiconv/ (1_kiconv_wctype_kern.diff, 1_kiconv_wctype_user.diff) Notes: svn path=/head/; revision=194638
* add explanatory header licenseKip Macy2009-06-091-0/+36
| | | | Notes: svn path=/head/; revision=193860
* move jenkins hash to its own header in libkernKip Macy2009-06-091-0/+149
| | | | Notes: svn path=/head/; revision=193854
* Add memmove() to the kernel, making the kernel compile with Clang.Ed Schouten2009-02-281-0/+38
| | | | | | | | | | | | | | | When copying big structures, LLVM generates calls to memmove(), because it may not be able to figure out whether structures overlap. This caused linker errors to occur. memmove() is now implemented using bcopy(). Ideally it would be the other way around, but that can be solved in the future. On ARM we don't do add anything, because it already has memmove(). Discussed on: arch@ Reviewed by: rdivacky Notes: svn path=/head/; revision=189170
* Remove redundant assignment of `s'.Ed Schouten2009-02-261-1/+0
| | | | | | | | | The variable is already initialized to `nptr'. Found by: LLVM's scan-build Notes: svn path=/head/; revision=189065
* This commit fixes the issue with alias_sctp.c. NoRandall Stewart2009-02-141-0/+643
| | | | | | | | | | | | | | | | | longer do we require SCTP to be in the kernel for the lib to be able to handle SCTP. We do this by moving the CRC32c checksum into libkern/crc32.c and then adjusting all routines to use the common methods. Note that this will improve the performance of iSCSI since they were using the old single 256 bit table lookup versus the slicing 8 algorithm (which gives a 4x speed up in CRC32c calculation :-D) Reviewed by:rwatson, gnn, scottl, paolo MFC after: 4 week? (assuming we MFC the alias_sctp changes) Notes: svn path=/head/; revision=188605
* Add simple locking for the in-kernel iconv code. Translation operationsJohn Baldwin2008-12-051-5/+27
| | | | | | | | | | | | | do not need any locking. Opening and closing translators is serialized using an sx lock. Note: This depends on the earlier fix to kern_module.c to properly order MOD_UNLOAD events. MFC after: 2 months Notes: svn path=/head/; revision=185652
* Prefix the static shl function with '__' like its parent function __qdivrem toAndrew Thompson2008-10-091-3/+3
| | | | | | | | | | avoid being picked up by the DTrace fbt provider. This is called by __udivdi3() for doing 64bit division on a 32bit arch and may be called from within the dtrace context causing a double fault. Notes: svn path=/head/; revision=183733
* The kernel implemented 'memcmp' is an alias for 'bcmp'. However, memcmpDavid E. O'Brien2008-09-231-0/+53
| | | | | | | | | | | | | | and bcmp are not the same thing. 'man bcmp' states that the return is "non-zero" if the two byte strings are not identical. Where as, 'man memcmp' states that the return is the "difference between the first two differing bytes (treated as unsigned char values" if the two byte strings are not identical. So provide a proper memcmp(9), but it is a C implementation not a tuned assembly implementation. Therefore bcmp(9) should be preferred over memcmp(9). Notes: svn path=/head/; revision=183299
* Add strcspn to libkern for use by xenbus routines. Will add to buildKip Macy2008-08-151-0/+72
| | | | | | | in separate commit. Notes: svn path=/head/; revision=181748
* Return arc4_i = arc4_j = 0; line from previous backing out sinceAndrey A. Chernov2008-07-261-0/+1
| | | | | | | | | | just found it in OpenBSD, see their sys/crypto/arc4.c, function rc4_keysetup, line ctx->x = ctx->y = 0; Obtained from: OpenBSD Notes: svn path=/head/; revision=180825
* Per rwatson's request:Andrey A. Chernov2008-07-251-7/+4
| | | | | | | | | | "If you don't get a review within a day or two, I would firmly recommend backing out the changes" back out all my changes as unreviewed by secteam@ yet. Notes: svn path=/head/; revision=180805
* 1) Initialize arc4_i and arc4_j to 0 after key mixing as recommended inAndrey A. Chernov2008-07-221-4/+7
| | | | | | | | | draft-kaukonen-cipher-arcfour-03.txt (3.1.5) 2) Drop first 768 bytes as standard RC4-drop(768) Notes: svn path=/head/; revision=180707
* Match the implementation of the inline function from libkern.h.David E. O'Brien2008-07-141-4/+8
| | | | Notes: svn path=/head/; revision=180514
* Add prototype for __cmpd2().Marcel Moolenaar2008-02-231-0/+1
| | | | Notes: svn path=/head/; revision=176496
* Bring back (without advertising clause) cmpdi2.c. It's needed on PowerPCMarcel Moolenaar2008-02-231-0/+54
| | | | | | | when the FP emulator is compiled-in. Notes: svn path=/head/; revision=176492
* Do not use __XSCALE__ to detect if clz is available, use _ARM_ARCH_5 instead.Olivier Houchard2007-10-131-1/+1
| | | | | | | MFC After: 3 days Notes: svn path=/head/; revision=172615
* Unbreak high resolution profiling a little: use dummy asms to preventBruce Evans2007-06-131-1/+6
| | | | | | | | | | | | | timing loops being optimized away. Once apon a time, gcc promised not to optimize away timing loops, but gcc started optimizing away the call to a null function in the timing loop here some time between gcc-3.3.3 and gcc-3.4.6, and it started optimizing away the timing loop itself some time between gcc-3.4.6 and gcc-4.2. Notes: svn path=/head/; revision=170659
* strchr() and strrchr() are already present in the kernel, but with lessWojciech A. Koszek2007-04-102-0/+8
| | | | | | | | | | | | | | | | popular names. Hence: - comment current index() and rindex() functions, as these serve the same functionality as, respectively, strchr() and strrchr() from userland; - add inlined version of strchr() and strrchr(), as we tend to use them more often; - remove str[r]chr() definitions from ZFS code; Reviewed by: pjd Approved by: cognet (mentor) Notes: svn path=/head/; revision=168604
* Add local ptototype for memset function.Alexander Kabaev2007-04-061-0/+3
| | | | Notes: svn path=/head/; revision=168403
* Add trivial MI memset function implementation. GCC mandates theAlexander Kabaev2007-04-051-0/+37
| | | | | | | | | existence of this function as a linkable symbol in standalone configurations and existing inline memcpy from libkern.h fails this requirement. Notes: svn path=/head/; revision=168400
* Add strstr() function to the libkern.Pawel Jakub Dawidek2006-08-121-0/+63
| | | | Notes: svn path=/head/; revision=161243
* First pass at removing Alpha kernel support.John Baldwin2006-05-114-172/+0
| | | | Notes: svn path=/head/; revision=158458
* Convert function declarations to ANSI C.Robert Watson2006-01-221-8/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=154660
* Ignore spurious '\0' first character read on a serial console.Ruslan Ermilov2006-01-141-0/+2
| | | | | | | | This allows me to "boot -a" over a serial console. Tested on several machines. Notes: svn path=/head/; revision=154372
* Normalize a significant number of kernel malloc type names:Robert Watson2005-10-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names. Notes: svn path=/head/; revision=151897
* Backout strtok() addition to libkern, strsep() is enough and strtok()Pawel Jakub Dawidek2005-10-061-98/+0
| | | | | | | | | is not safe. Discussed with: stefanf, njl Notes: svn path=/head/; revision=151025
* Add strtok() and strtok_r() function to libkern.Pawel Jakub Dawidek2005-10-061-0/+98
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=150994