summaryrefslogtreecommitdiffstats
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix kiconv on the 64bit plathomes.imura2005-05-241-5/+5
| | | | | | | | | | | | | | - Correct idxp pointer to point the properly address of the each array of the kiconv character conversion tables, so that character conversion work properly when file systems are mounted with kiconv options. - The definition of ICONV_CSMAXDATALEN was also bogus because it was defined as if all machines were 32bit computers. Tested on: amd64 MFC after: 1 month
* Update comment to direct the reader to libkern.h instead of systm.h.marcel2005-04-281-1/+1
| | | | | | The functions were moved. Pointed out by: johan@
* Refactor the CRC-32 code to enhance its usability. Move the actualmarcel2005-04-271-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | CRC logic to a new function: crc32_raw() that obtains the initial CRC value as well as leaves any post-processing to the caller. As such, it can be used when the initial CRC value is not ~0U or when the final CRC value does need to be inverted (bitwise). It also means that crc32_raw() can be called repeatedly when the data is not available as a single block, such as for scatter/gather lists and the likes. Avoid the additional call overhead incured by the refactoring by moving the implementation off crc32() to sys/systm.h and making it inlinable. Since crc32_raw() is itself trivial and since it may be used in loops that iterate over fragments, having it available for inlining can be beneficial. Hence, move its implementation to sys/systm.h as well. Keep the original implementation of crc32() in libkern/crc32.c for documentation purposes (as a comment of course). Triggered by: Jose M Rodriguez (josemi at freebsd dot jazztel dot es) Discussed on: current@ Tested on: amd64, ia64 (BVO having GPT partitions) Jargon file candidate: BVO = By Virtue Of :-)
* Replace the current strspn() and strcspn() with significantly fasterdas2005-04-021-24/+40
| | | | | | | | | implementations inspired by the ones in DragonFly. Unlike the DragonFly versions, these have a small data cache footprint, and my tests show that they're never slower than the old code except when the charset or the span is 0 or 1 characters. This implementation is generally faster than DragonFly until either the charset or the span gets in the ballpark of 32 to 64 characters.
* Add strspn() to libkern.glebius2005-02-101-0/+55
| | | | Ok'ed by: rwatson
* MFlibc: Remove extra closing parenthesis.ru2005-02-032-2/+2
|
* We do want to print '\n'/'\r'.pjd2005-02-031-0/+1
| | | | Pointed out by: stefanf
* 'c' cannot be -1.pjd2005-02-031-1/+0
| | | | Submitted by: stefanf
* - Move gets() function to libkern (I want to use it outside vfs_mount.c).pjd2005-02-031-0/+67
| | | | | | | | | | - Add buffer size limitations (overflow will not be possible anymore). - Add 'visible' option, which will allow for passphrase reading in the future. - Remove special treatment of '@' and '#', those two are only confusing. Discussed with: rwatson MFC after: 2 weeks
* Because the argument to strvalid() is a size_t, use a size_t to iteraterwatson2005-01-291-1/+1
| | | | | | over the array. Submitted by: stefanf
* Per permission from McAfee, remove clause 3 of the BSD license onrwatson2005-01-291-3/+0
| | | | strvalid.c.
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-0733-33/+43
|
* Use the RET macro.cognet2004-11-092-6/+6
|
* Implement ffs with clz for Xscale.cognet2004-11-071-1/+8
| | | | Idea taken from: NetBSD
* Don't attempt to profile __udivsi3() and friends, as mcount() uses them.cognet2004-10-011-4/+4
|
* Move the kernel-specific logic to adjust frompc from MI to MD. Formarcel2004-08-271-33/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | these two reasons: 1. On ia64 a function pointer does not hold the address of the first instruction of a functions implementation. It holds the address of a function descriptor. Hence the user(), btrap(), eintr() and bintr() prototypes are wrong for getting the actual code address. 2. The logic forces interrupt, trap and exception entry points to be layed-out contiguously. This can not be achieved on ia64 and is generally just bad programming. The MCOUNT_FROMPC_USER macro is used to set the frompc argument to some kernel address which represents any frompc that falls outside the kernel text range. The macro can expand to ~0U to bail out in that case. The MCOUNT_FROMPC_INTR macro is used to set the frompc argument to some kernel address to represent a call to a trap or interrupt handler. This to avoid that the trap or interrupt handler appear to be called from everywhere in the call graph. The macro can expand to ~0U to prevent adjusting frompc. Note that the argument is selfpc, not frompc. This commit defines the macros on all architectures equivalently to the original code in sys/libkern/mcount.c. People can take it from here... Compile-tested on: alpha, amd64, i386, ia64 and sparc64 Boot-tested on: i386
* Convert the vfsconf list to a TAILQ.phk2004-07-271-8/+3
| | | | | | | | Introduce vfs_byname() function to find things on it. Staticize vfs_nmount() function under the name vfs_donmount(). Various cleanups.
* Copy qsort_r(3) from libc to libkern.glebius2004-07-152-24/+49
| | | | | Reviewed by: phk Approved by: julian (mentor)
* Import libkern arm specific bits.cognet2004-05-143-0/+713
|
* Fixed some style bugs (unsorting of prototypes in previous commit, andbde2004-05-051-8/+8
| | | | messes involving the idempotency guard).
* Prototype __ashldi3(), __ashrdi3() and __lshrdi3().cognet2004-05-041-0/+4
|
* Remove advertising clause from University of California Regent'simp2004-04-0735-140/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Bring these files closer to style(9) conformance by comparing arobert2004-03-292-2/+2
| | | | dereferenced character pointer to '\0' instead of using the ! operator.
* These are changes to allow to use the Intel C/C++ compiler (lang/icc)trhodes2004-03-121-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to build the kernel. It doesn't affect the operation if gcc. Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as icc v8 may define __GNUC__ some parts may look strange but are necessary. Additional changes: - in_cksum.[ch]: * use a generic C version instead of the assembly version in the !gcc case (ASM code breaks with the optimizations icc does) -> no bad checksums with an icc compiled kernel Help from: andre, grehan, das Stolen from: alpha version via ppc version The entire checksum code should IMHO be replaced with the DragonFly version (because it isn't guaranteed future revisions of gcc will include similar optimizations) as in: ---snip--- Revision Changes Path 1.12 +1 -0 src/sys/conf/files.i386 1.4 +142 -558 src/sys/i386/i386/in_cksum.c 1.5 +33 -69 src/sys/i386/include/in_cksum.h 1.5 +2 -0 src/sys/netinet/igmp.c 1.6 +0 -1 src/sys/netinet/in.h 1.6 +2 -0 src/sys/netinet/ip_icmp.c 1.4 +3 -4 src/contrib/ipfilter/ip_compat.h 1.3 +1 -2 src/sbin/natd/icmp.c 1.4 +0 -1 src/sbin/natd/natd.c 1.48 +1 -0 src/sys/conf/files 1.2 +0 -1 src/sys/conf/files.amd64 1.13 +0 -1 src/sys/conf/files.i386 1.5 +0 -1 src/sys/conf/files.pc98 1.7 +1 -1 src/sys/contrib/ipfilter/netinet/fil.c 1.10 +2 -3 src/sys/contrib/ipfilter/netinet/ip_compat.h 1.10 +1 -1 src/sys/contrib/ipfilter/netinet/ip_fil.c 1.7 +1 -1 src/sys/dev/netif/txp/if_txp.c 1.7 +1 -1 src/sys/net/ip_mroute/ip_mroute.c 1.7 +1 -2 src/sys/net/ipfw/ip_fw2.c 1.6 +1 -2 src/sys/netinet/igmp.c 1.4 +158 -116 src/sys/netinet/in_cksum.c 1.6 +1 -1 src/sys/netinet/ip_gre.c 1.7 +1 -2 src/sys/netinet/ip_icmp.c 1.10 +1 -1 src/sys/netinet/ip_input.c 1.10 +1 -2 src/sys/netinet/ip_output.c 1.13 +1 -2 src/sys/netinet/tcp_input.c 1.9 +1 -2 src/sys/netinet/tcp_output.c 1.10 +1 -1 src/sys/netinet/tcp_subr.c 1.10 +1 -1 src/sys/netinet/tcp_syncache.c 1.9 +1 -2 src/sys/netinet/udp_usrreq.c 1.5 +1 -2 src/sys/netinet6/ipsec.c 1.5 +1 -2 src/sys/netproto/ipsec/ipsec.c 1.5 +1 -1 src/sys/netproto/ipsec/ipsec_input.c 1.4 +1 -2 src/sys/netproto/ipsec/ipsec_output.c and finally remove sys/i386/i386 in_cksum.c sys/i386/include in_cksum.h ---snip--- - endian.h: * DTRT in C++ mode - quad.h: * we don't use gcc v1 anymore, remove support for it Suggested by: bde (long ago) - assym.h: * avoid zero-length arrays (remove dependency on a gcc specific feature) This change changes the contents of the object file, but as it's only used to generate some values for a header, and the generator knows how to handle this, there's no impact in the gcc case. Explained by: bde Submitted by: Marius Strobl <marius@alchemy.franken.de> - aicasm.c: * minor change to teach it about the way icc spells "-nostdinc" Not approved by: gibbs (no reply to my mail) - bump __FreeBSD_version (lang/icc needs to know about the changes) Incarnations of this patch survive gcc compiles since a loooong time, I use it on my desktop. An icc compiled kernel works since Nov. 2003 (exceptions: snd_* if used as modules), it survives a build of the entire ports collection with icc. Parts of this commit contains suggestions or submissions from Marius Strobl <marius@alchemy.franken.de>. Reviewed by: -arch Submitted by: netchild
OpenPOWER on IntegriCloud