aboutsummaryrefslogtreecommitdiff
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* 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
* - Fix checking range of strings of struct iconv_add_in in libsmb and libkiconv,R. Imura2005-08-241-0/+6
| | | | | | | | | - Add checking range of strings to iconv_sysctl_add(). Submitted by: Rudolf Cejka Notes: svn path=/head/; revision=149415
* Ha! This is a very interesting bug.Pawel Jakub Dawidek2005-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. Notes: svn path=/head/; revision=148865
* Add strcasecmp() and strncasecmp() to libkern and connect to the build.Pawel Jakub Dawidek2005-08-081-0/+69
| | | | Notes: svn path=/head/; revision=148861
* Temporary restore a part of rev 1.6.R. 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. Notes: svn path=/head/; revision=148342
* Fix kiconv on the 64bit plathomes.R. 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 Notes: svn path=/head/; revision=146573
* Update comment to direct the reader to libkern.h instead of systm.h.Marcel Moolenaar2005-04-281-1/+1
| | | | | | | | | The functions were moved. Pointed out by: johan@ Notes: svn path=/head/; revision=145611
* Refactor the CRC-32 code to enhance its usability. Move the actualMarcel Moolenaar2005-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 :-) Notes: svn path=/head/; revision=145604
* Replace the current strspn() and strcspn() with significantly fasterDavid Schultz2005-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. Notes: svn path=/head/; revision=144545
* Add strspn() to libkern.Gleb Smirnoff2005-02-101-0/+55
| | | | | | | Ok'ed by: rwatson Notes: svn path=/head/; revision=141665
* MFlibc: Remove extra closing parenthesis.Ruslan Ermilov2005-02-032-2/+2
| | | | Notes: svn path=/head/; revision=141209
* We do want to print '\n'/'\r'.Pawel Jakub Dawidek2005-02-031-0/+1
| | | | | | | Pointed out by: stefanf Notes: svn path=/head/; revision=141208
* 'c' cannot be -1.Pawel Jakub Dawidek2005-02-031-1/+0
| | | | | | | Submitted by: stefanf Notes: svn path=/head/; revision=141207
* - Move gets() function to libkern (I want to use it outside vfs_mount.c).Pawel Jakub Dawidek2005-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 Notes: svn path=/head/; revision=141206
* Because the argument to strvalid() is a size_t, use a size_t to iterateRobert Watson2005-01-291-1/+1
| | | | | | | | | over the array. Submitted by: stefanf Notes: svn path=/head/; revision=140960
* Per permission from McAfee, remove clause 3 of the BSD license onRobert Watson2005-01-291-3/+0
| | | | | | | strvalid.c. Notes: svn path=/head/; revision=140959
* /* -> /*- for copyright notices, minor format tweaks as necessaryWarner Losh2005-01-0733-33/+43
| | | | Notes: svn path=/head/; revision=139815
* Use the RET macro.Olivier Houchard2004-11-092-6/+6
| | | | Notes: svn path=/head/; revision=137463
* Implement ffs with clz for Xscale.Olivier Houchard2004-11-071-1/+8
| | | | | | | Idea taken from: NetBSD Notes: svn path=/head/; revision=137342
* Don't attempt to profile __udivsi3() and friends, as mcount() uses them.Olivier Houchard2004-10-011-4/+4
| | | | Notes: svn path=/head/; revision=136031
* Move the kernel-specific logic to adjust frompc from MI to MD. ForMarcel Moolenaar2004-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 Notes: svn path=/head/; revision=134398
* Convert the vfsconf list to a TAILQ.Poul-Henning Kamp2004-07-271-8/+3
| | | | | | | | | | | Introduce vfs_byname() function to find things on it. Staticize vfs_nmount() function under the name vfs_donmount(). Various cleanups. Notes: svn path=/head/; revision=132710
* Copy qsort_r(3) from libc to libkern.Gleb Smirnoff2004-07-152-24/+49
| | | | | | | | Reviewed by: phk Approved by: julian (mentor) Notes: svn path=/head/; revision=132228
* Import libkern arm specific bits.Olivier Houchard2004-05-143-0/+713
| | | | Notes: svn path=/head/; revision=129210
* Fixed some style bugs (unsorting of prototypes in previous commit, andBruce Evans2004-05-051-8/+8
| | | | | | | messes involving the idempotency guard). Notes: svn path=/head/; revision=128965
* Prototype __ashldi3(), __ashrdi3() and __lshrdi3().Olivier Houchard2004-05-041-0/+4
| | | | Notes: svn path=/head/; revision=128935
* Remove advertising clause from University of California Regent'sWarner Losh2004-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 Notes: svn path=/head/; revision=128019
* Bring these files closer to style(9) conformance by comparing aRobert Drehmel2004-03-292-2/+2
| | | | | | | dereferenced character pointer to '\0' instead of using the ! operator. Notes: svn path=/head/; revision=127586
* These are changes to allow to use the Intel C/C++ compiler (lang/icc)Tom Rhodes2004-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 Notes: svn path=/head/; revision=126891
* Remove register keyword and constify tmp values. This fixesPeter Grehan2004-02-121-3/+3
| | | | | | | | PPC compile warning - PPC is the only consumer of this code path. Notes: svn path=/head/; revision=125725
* Translate from GNU C to ISO C.Dag-Erling Smørgrav2004-01-144-4/+4
| | | | Notes: svn path=/head/; revision=124514
* Cast to unsigned to avoid sign-extension problems.Dag-Erling Smørgrav2004-01-134-4/+4
| | | | Notes: svn path=/head/; revision=124482
* Add C implementations of ffsl(), fls() and flsl().Dag-Erling Smørgrav2004-01-133-0/+156
| | | | Notes: svn path=/head/; revision=124480
* ANSIfy, de-register, replace VAX reference with actual description.Dag-Erling Smørgrav2004-01-131-6/+5
| | | | Notes: svn path=/head/; revision=124479
* Make msdosfs long filenames matching case insensitive again.Max Khon2003-12-081-8/+13
| | | | | | | | PR: 59765 Submitted by: Ryuichiro Imura <imura@ryu16.org> Notes: svn path=/head/; revision=123293
* - Support for multibyte charsets in LIBICONV.Max Khon2003-09-264-9/+304
| | | | | | | | | | | - CD9660_ICONV, NTFS_ICONV and MSDOSFS_ICONV kernel options (with corresponding modules). - kiconv(3) for loadable charset conversion tables support. Submitted by: Ryuichiro Imura <imura@ryu16.org> Notes: svn path=/head/; revision=120492
* Lock down arc4random so it can be safely called w/o Giant.Mike Silbersack2003-08-151-17/+26
| | | | | | | | | Minor code reorganization was required, but the only functional change was that the first 1024 bytes of output are thrown out after each reseed, rather than just the initial seed. Notes: svn path=/head/; revision=118938
* Lower initial drop value to 50, it is enough to hide linearityAndrey A. Chernov2003-08-101-2/+2
| | | | Notes: svn path=/head/; revision=118732
* Backed out the micro-optimization in 1.4. It was to help gcc-2.6.3Bruce Evans2003-07-251-6/+1
| | | | | | | | | | | | on i486's (and probably i386's), but it has had very little effect since gcc-2.7 or gcc-2.95. With gcc-3.3, it gave a small pessimization for at least i386's, athlon-xp's and pentium4's, a small optimization (I think) for pentium1's, and made no difference for i386's. (movzbl is best for all the later processors, and the micro-optimization was to stop it being used on i486's.) Notes: svn path=/head/; revision=118017