summaryrefslogtreecommitdiff
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Use __FBSDID().David E. O'Brien2003-06-1138-75/+117
| | | | Notes: svn path=/head/; revision=116189
* Deprecate machine/limits.h in favor of new sys/limits.h.Alexander Kabaev2003-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> Notes: svn path=/head/; revision=114216
* Further GC of M_STRING, missed previously.Robert Watson2003-02-261-2/+0
| | | | Notes: svn path=/head/; revision=111518
* Replace license with two-clause BSD; an old license template with threeRobert Watson2003-02-261-7/+4
| | | | | | | clauses was used by mistake. Notes: svn path=/head/; revision=111517
* Pass a malloc type into the libkern strdup() implementation explicitly,Robert Watson2003-02-251-2/+2
| | | | | | | | | | so that callers can specify what malloc pool the resulting memory should come from. Requested by: phk Notes: svn path=/head/; revision=111506
* Add an implementation of strdup() to libkern. Allocated memory is ofRobert Watson2003-02-231-0/+54
| | | | | | | | | | | | type M_STRING, now defined in malloc.h. Useful when string parsing must occur using the kernel strsep() and we want to avoid toasting the source string. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=111317
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-192-3/+3
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Improve a comment and undo a bogus s/a/an/ in a comment. An asm guruJens Schweikhardt2003-02-112-6/+6
| | | | | | | | | should add more comments explaining which registers hold which variables. Spotted by: bde Notes: svn path=/head/; revision=110725
* Add restrict keyword to string functions.Jeffrey Hsu2003-02-103-10/+3
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=110605
* Since we drop NSHUFF values now, set default seed to what it becomesAndrey A. Chernov2003-02-051-1/+1
| | | | | | | after srandom(1) Notes: svn path=/head/; revision=110422
* Drop NSHUFF values right after srandom() to remove part of seed -> 1stAndrey A. Chernov2003-02-041-0/+6
| | | | | | | value correlation. Correlation still remains because of algorithm limits. Notes: svn path=/head/; revision=110322
* Park & Miller PRNG can be safely initialized with any value but 0 and stuckAndrey A. Chernov2003-02-031-2/+4
| | | | | | | | | | at 0 as designed. Its BSD adaptation tries to fight it by mapping 0 to 2147483647 after calculation, but this method not works since 2147483647 seed returns to 0 again on the next interation. Instead of after calculation mapping, map 0 to another value _before_ calculation, so it never stucks. Notes: svn path=/head/; revision=110281
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-212-3/+3
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,Jens Schweikhardt2003-01-012-2/+2
| | | | | | | especially in troff files. Notes: svn path=/head/; revision=108533
* Fix instances of macros with improperly parenthasized arguments.Alfred Perlstein2002-11-091-1/+1
| | | | | | | Verified by: md5 Notes: svn path=/head/; revision=106696
* Slight overhaul of arc4random() and friends.Poul-Henning Kamp2002-10-111-22/+27
| | | | | | | | | | | | | | | | | | | | | | One bug fixed: Use getmicrouptime() to trigger reseeds so that we cannot be tricked by a clock being stepped backwards. Express parameters in natural units and with natural names. Don't use struct timeval more than we need to. Various stylistic and readability polishing. Introduce arc4rand(void *ptr, u_int len, int reseed) function which returns a stream of pseudo-random bytes, observing the automatic reseed criteria as well as allowing forced reseeds. Rewrite arc4random() in terms of arc4rand(). Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=104900
* Hook up strsep(3) to libkern following a repo-copy by Peter. This willRobert Watson2002-10-101-2/+2
| | | | | | | | | allow us to avoid nasty by-hand string parsing stuff in a number of places in the kernel, reducing the risk of unexpected consequences for kernel correctness. Notes: svn path=/head/; revision=104799
* Allow for multiple #includes of this file.Poul-Henning Kamp2002-10-081-0/+4
| | | | Notes: svn path=/head/; revision=104667
* Import the libc fnmatch() into the kernel. This will be used by,Dima Dorfman2002-10-081-20/+9
| | | | | | | | | | | | | | among other things, the DEVFS rule subsystem to match nodes against a path pattern supplied by the user. fnmatch.c was repo-copied from src/lib/libc/gen/fnmatch.c, and the only changes to it are those necessary to make it compile in the kernel. The relevant parts of fnmatch.h were imported into libkern.h. Approved by: -arch Notes: svn path=/head/; revision=104652
* Fix a bunch of s/int */size_t */.Maxime Henrion2002-10-061-2/+4
| | | | Notes: svn path=/head/; revision=104568
* Use sys/libkern.h not /usr/include/string.hPeter Wemm2002-09-062-2/+2
| | | | Notes: svn path=/head/; revision=103000
* Include sys/libkern.h for the kernel prototypes of these libkern functionsJohn Baldwin2002-08-228-8/+8
| | | | | | | | | | instead of including the userland string.h header. Prompted by: breakage with old string.h from recent machine/types.h fix Approved by: peter (in principle) Notes: svn path=/head/; revision=102281
* Convert GNU variadic macros to the ISO 9X variety.Mark Murray2002-07-151-1/+3
| | | | Notes: svn path=/head/; revision=100080
* For some reason this didn't get added in my previous commit.Poul-Henning Kamp2002-05-291-0/+107
| | | | Notes: svn path=/head/; revision=97521
* Remove bogus include of <machine/ansi.h>.Mike Barcroft2002-04-111-1/+0
| | | | Notes: svn path=/head/; revision=94401
* Remove 'register' keyword.David E. O'Brien2002-03-213-11/+11
| | | | Notes: svn path=/head/; revision=92889
* Remove __P.Alfred Perlstein2002-03-204-14/+14
| | | | Notes: svn path=/head/; revision=92741
* DBA update: used the wrong of several NAI DBAs.Robert Watson2002-03-071-1/+1
| | | | Notes: svn path=/head/; revision=91826
* Add the following functions/macros to support byte order conversions andThomas Moestl2002-02-2712-169/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | device drivers for bus system with other endinesses than the CPU (using interfaces compatible to NetBSD): - bwap16() and bswap32(). These have optimized implementations on some architectures; for those that don't, there exist generic implementations. - macros to convert from a certain byte order to host byte order and vice versa, using a naming scheme like le16toh(), htole16(). These are implemented using the bswap functions. - stream bus space access functions, which do not perform a byte order conversion (while the normal access functions would if the bus endianess differs from the CPU endianess). htons(), htonl(), ntohs() and ntohl() are implemented using the new functions above for kernel usage. None of the above interfaces is currently exported to user land. Make use of the new functions in a few places where local implementations of the same functionality existed. Reviewed by: mike, bde Tested on alpha by: mike Notes: svn path=/head/; revision=91394
* o Move NTOHL() and associated macros into <sys/param.h>. These areMike Barcroft2002-02-1812-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from <sys/types.h>. o Add missing <arpa/inet.h> includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm Notes: svn path=/head/; revision=90868
* Add a 'strvalid()' call to libkern. Given a character pointer, andRobert Watson2002-02-181-0/+55
| | | | | | | | | | | | buffer length, determine if the pointer is to a valid string. Currently, the only check is whether a '\0' appears in the buffer. This is useful when pulling in a structure from userland that may contain one or more strings, and validity testing must be performed on elements of the structure. When copying normal string arguments, copyinstr() is expected to be used. Notes: svn path=/head/; revision=90819
* * Remove __P and convert to ANSI prototypes.David E. O'Brien2002-02-011-1/+3
| | | | | | | | * Remove 'register'. (some functions had 7+ register functions...) * Fix SCM ID's. Notes: svn path=/head/; revision=90045
* rcsid[]->__FBSDIDDavid E. O'Brien2001-11-073-20/+11
| | | | Notes: svn path=/head/; revision=86170