summaryrefslogtreecommitdiffstats
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* Remove second consts in r233288 in order to appease C++ compilers.marius2012-03-261-10/+10
| | | | | | While at it, remove some style(9) bugs in libkern.h. Submitted by: kan
* Declare the CRC lookup-tables const as they hardly should change atmarius2012-03-211-10/+10
| | | | run-time.
* Implement extensions on top of standards instead of the other way around.ed2012-01-032-14/+2
| | | | | Now that index() and rindex() have become unused, simply turn them into wrappers around strchr() and strrchr(), respectively.
* Use strchr() and strrchr().ed2012-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.
* Remove the now unused skpc() function.ed2012-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.
* Introducing memcchr(3).ed2012-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.
* retire libkern getsavg2011-12-171-77/+0
| | | | | | Inspired by: bde MFC after: 2 months X-MFC-Note: if deemed a part of KPI, just call cngets internally
* Add unicode support to msdosfs and smbfs; original pathes from imura,kevlo2011-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.
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-071-1/+1
| | | | This means that their use is restricted to a single C file.
* Add strnlen() to libkern.jkim2011-10-041-0/+42
|
* Fix typos - remove duplicate "is".brucec2011-02-231-1/+1
| | | | | | PR: docs/154934 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days
* Add support for asterisk characters when filling in the GELI passworded2010-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)
* Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() generalattilio2010-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
* Provide memchr() in the libkern.raj2010-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
* Switch to our preferred 2-clause BSD license.joel2010-04-073-21/+3
| | | | Approved by: bp
* Start copyright notice with /*-joel2010-04-072-2/+2
|
* Move inet_aton() (specular to inet_ntoa(), already present in libkern)attilio2009-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
* done method is supposed to return int.delphij2009-06-221-1/+1
|
* Split tolower/toupper code from usual xlat16 kiconv table, and make itdelphij2009-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)
* add explanatory header licensekmacy2009-06-091-0/+36
|
* move jenkins hash to its own header in libkernkmacy2009-06-091-0/+149
|
* Add memmove() to the kernel, making the kernel compile with Clang.ed2009-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
* Remove redundant assignment of `s'.ed2009-02-261-1/+0
| | | | | | The variable is already initialized to `nptr'. Found by: LLVM's scan-build
* This commit fixes the issue with alias_sctp.c. Norrs2009-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)
* Add simple locking for the in-kernel iconv code. Translation operationsjhb2008-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
* Prefix the static shl function with '__' like its parent function __qdivrem tothompsa2008-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.
* The kernel implemented 'memcmp' is an alias for 'bcmp'. However, memcmpobrien2008-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).
* Add strcspn to libkern for use by xenbus routines. Will add to buildkmacy2008-08-151-0/+72
| | | | in separate commit.
* Return arc4_i = arc4_j = 0; line from previous backing out sinceache2008-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
* Per rwatson's request:ache2008-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.
* 1) Initialize arc4_i and arc4_j to 0 after key mixing as recommended inache2008-07-221-4/+7
| | | | | | draft-kaukonen-cipher-arcfour-03.txt (3.1.5) 2) Drop first 768 bytes as standard RC4-drop(768)
* Match the implementation of the inline function from libkern.h.obrien2008-07-141-4/+8
|
* Add prototype for __cmpd2().marcel2008-02-231-0/+1
|
* Bring back (without advertising clause) cmpdi2.c. It's needed on PowerPCmarcel2008-02-231-0/+54
| | | | when the FP emulator is compiled-in.
* Do not use __XSCALE__ to detect if clz is available, use _ARM_ARCH_5 instead.cognet2007-10-131-1/+1
| | | | MFC After: 3 days
* Unbreak high resolution profiling a little: use dummy asms to preventbde2007-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.
* strchr() and strrchr() are already present in the kernel, but with lesswkoszek2007-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)
* Add local ptototype for memset function.kan2007-04-061-0/+3
|
* Add trivial MI memset function implementation. GCC mandates thekan2007-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.
* Add strstr() function to the libkern.pjd2006-08-121-0/+63
|
* First pass at removing Alpha kernel support.jhb2006-05-114-172/+0
|
* Convert function declarations to ANSI C.rwatson2006-01-221-8/+2
| | | | MFC after: 1 week
* Ignore spurious '\0' first character read on a serial console.ru2006-01-141-0/+2
| | | | | This allows me to "boot -a" over a serial console. Tested on several machines.
* Normalize a significant number of kernel malloc type names:rwatson2005-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.
* Backout strtok() addition to libkern, strsep() is enough and strtok()pjd2005-10-061-98/+0
| | | | | | is not safe. Discussed with: stefanf, njl
* Add strtok() and strtok_r() function to libkern.pjd2005-10-061-0/+98
| | | | MFC after: 2 weeks
* - Fix checking range of strings of struct iconv_add_in in libsmb and libkiconv,imura2005-08-241-0/+6
| | | | | | - Add checking range of strings to iconv_sysctl_add(). Submitted by: Rudolf Cejka
* Ha! This is a very interesting bug.pjd2005-08-081-4/+6
| | | | | | | | | | | I copied strcasecmp() from userland to the kernel and it didn't worked! I started to debug the problem and I find out that this line: while (tolower(*us1) == tolower(*us2++)) { was adding _3_ bytes to 'us2' pointer. Am I loosing my minds here?!... No, in-kernel tolower() is a macro which uses its argument three times. Bad tolower(9), no cookie.
* Add strcasecmp() and strncasecmp() to libkern and connect to the build.pjd2005-08-081-0/+69
|
* Temporary restore a part of rev 1.6.imura2005-07-231-4/+2
| | | | | | | | | We must not increase a capability of buffer size here, because codes which call these functions expect that dst and src are the same size. This will cause problem when someone convert a character whose length is different between charsets on smbfs which was changed to use xlat16 converter.
OpenPOWER on IntegriCloud