summaryrefslogtreecommitdiffstats
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Remove register keyword and constify tmp values. This fixesgrehan2004-02-121-3/+3
| | | | | PPC compile warning - PPC is the only consumer of this code path.
* Translate from GNU C to ISO C.des2004-01-144-4/+4
|
* Cast to unsigned to avoid sign-extension problems.des2004-01-134-4/+4
|
* Add C implementations of ffsl(), fls() and flsl().des2004-01-133-0/+156
|
* ANSIfy, de-register, replace VAX reference with actual description.des2004-01-131-6/+5
|
* Make msdosfs long filenames matching case insensitive again.fjoe2003-12-081-8/+13
| | | | | PR: 59765 Submitted by: Ryuichiro Imura <imura@ryu16.org>
* - Support for multibyte charsets in LIBICONV.fjoe2003-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>
* Lock down arc4random so it can be safely called w/o Giant.silby2003-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.
* Lower initial drop value to 50, it is enough to hide linearityache2003-08-101-2/+2
|
* Backed out the micro-optimization in 1.4. It was to help gcc-2.6.3bde2003-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.)
* Use __FBSDID().obrien2003-06-1138-75/+117
|
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-295-5/+5
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
OpenPOWER on IntegriCloud