summaryrefslogtreecommitdiffstats
path: root/sys/libkern
Commit message (Collapse)AuthorAgeFilesLines
* Make the rcsid and FreeBSD IDs more sane in the wcs* and wmem* files.obrien2001-05-243-2/+14
| | | | Do the same for the non-wcs*/wmem* files while I'm here.
* Add function prototypes and base module for kernel side iconv library.bp2001-04-093-0/+671
| | | | | | | | | Add simple "xlat" converter which performs 8to8 table based conversion. Unicode converter will be added in the near future. Reviewed by: silence on arch@ Files placement reviewed by: bde Obtained from: smbfs
* Rewrite of the CAM error recovery code.ken2001-03-271-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the major changes include: - The SCSI error handling portion of cam_periph_error() has been broken out into a number of subfunctions to better modularize the code that handles the hierarchy of SCSI errors. As a result, the code is now much easier to read. - String handling and error printing has been significantly revamped. We now use sbufs to do string formatting instead of using printfs (for the kernel) and snprintf/strncat (for userland) as before. There is a new catchall error printing routine, cam_error_print() and its string-based counterpart, cam_error_string() that allow the kernel and userland applications to pass in a CCB and have errors printed out properly, whether or not they're SCSI errors. Among other things, this helped eliminate a fair amount of duplicate code in camcontrol. We now print out more information than before, including the CAM status and SCSI status and the error recovery action taken to remedy the problem. - sbufs are now available in userland, via libsbuf. This change was necessary since most of the error printing code is shared between libcam and the kernel. - A new transfer settings interface is included in this checkin. This code is #ifdef'ed out, and is primarily intended to aid discussion with HBA driver authors on the final form the interface should take. There is example code in the ahc(4) driver that implements the HBA driver side of the new interface. The new transfer settings code won't be enabled until we're ready to switch all HBA drivers over to the new interface. src/Makefile.inc1, lib/Makefile: Add libsbuf. It must be built before libcam, since libcam uses sbuf routines. libcam/Makefile: libcam now depends on libsbuf. libsbuf/Makefile: Add a makefile for libsbuf. This pulls in the sbuf sources from sys/kern. bsd.libnames.mk: Add LIBSBUF. camcontrol/Makefile: Add -lsbuf. Since camcontrol is statically linked, we can't depend on the dynamic linker to pull in libsbuf. camcontrol.c: Use cam_error_print() instead of checking for CAM_SCSI_STATUS_ERROR on every failed CCB. sbuf.9: Change the prototypes for sbuf_cat() and sbuf_cpy() so that the source string is now a const char *. This is more in line wth the standard system string functions, and helps eliminate warnings when dealing with a const source buffer. Fix a typo. cam.c: Add description strings for the various CAM error status values, as well as routines to look up those strings. Add new cam_error_string() and cam_error_print() routines for userland and the kernel. cam.h: Add a new CAM flag, CAM_RETRY_SELTO. Add enumerated types for the various options available with cam_error_print() and cam_error_string(). cam_ccb.h: Add new transfer negotiation structures/types. Change inq_len in the ccb_getdev structure to be "reserved". This field has never been filled in, and will be removed when we next bump the CAM version. cam_debug.h: Fix typo. cam_periph.c: Modularize cam_periph_error(). The SCSI error handling part of cam_periph_error() is now in camperiphscsistatuserror() and camperiphscsisenseerror(). In cam_periph_lock(), increase the reference count on the periph while we wait for our lock attempt to succeed so that the periph won't go away while we're sleeping. cam_xpt.c: Add new transfer negotiation code. (ifdefed out) Add a new function, xpt_path_string(). This is a string/sbuf analog to xpt_print_path(). scsi_all.c: Revamp string handing and error printing code. We now use sbufs for much of the string formatting code. More of that code is shared between userland the kernel. scsi_all.h: Get rid of SS_TURSTART, it wasn't terribly useful in the first place. Add a new error action, SS_REQSENSE. (Send a request sense and then retry the command.) This is useful when the controller hasn't performed autosense for some reason. Change the default actions around a bit. scsi_cd.c, scsi_da.c, scsi_pt.c, scsi_ses.c: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Selection timeouts shouldn't be covered by a sense flag. scsi_pass.[ch]: SF_RETRY_SELTO -> CAM_RETRY_SELTO. Get rid of the last vestiges of a read/write interface. libkern/bsearch.c, sys/libkern.h, conf/files: Add bsearch.c, which is needed for some of the new table lookup routines. aic7xxx_freebsd.c: Define AHC_NEW_TRAN_SETTINGS if CAM_NEW_TRAN_CODE is defined. sbuf.h, subr_sbuf.c: Add the appropriate #ifdefs so sbufs can compile and run in userland. Change sbuf_printf() to use vsnprintf() instead of kvprintf(), which is only available in the kernel. Change the source string for sbuf_cpy() and sbuf_cat() to be a const char *. Add __BEGIN_DECLS and __END_DECLS around function prototypes since they're now exported to userland. kdump/mkioctls: Include stdio.h before cam.h since cam.h now includes a function with a FILE * argument. Submitted by: gibbs (mostly) Reviewed by: jdp, marcel (libsbuf makefile changes) Reviewed by: des (sbuf changes) Reviewed by: ken
* RIP <machine/lock.h>.markm2001-02-111-1/+0
| | | | | | | Some things needed bits of <i386/include/lock.h> - cy.c now has its own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK() has been moved to <i386/include/apic.h> (AKA <machine/apic.h>). Reviewed by: jhb
* - Reverse the order of two loop invariant to ensure strlcat() does notjedgar2001-01-171-3/+6
| | | | | | | | | | attempt to read memory when siz is 0 - Clarify comments referring to strlcat() usage PR: 24278, 24295 Submitted by: Tony Finch <dot@dotat.at> Richard Kettlewell <rjk@greenend.org.uk> Reviewed by: -audit
* Convert all instances of:benno2001-01-1212-12/+12
| | | | | | | | | | | | | | | #include "quad.h" to: #include <libkern/quad.h> as the former breaks under a kernel build. This change had already been performed on the files that were used in other kernel builds, however the PowerPC kernel build seems to require some that weren't being used. Reviewed by: obrien, peter
* Add __ucmpdi2 prototype to quelch a warning.phk2000-12-071-0/+1
|
* Recouple arc4random(9) to the entropy device. This works whether themarkm2000-12-021-2/+4
| | | | | | | entropy device is loaded or not. If the entropy device is NOT loaded, the the quality of perturbations supplied by this will suffer.
* add threadsafe version of inet_ntoa (inet_ntoa_r takes a buffer to fill)alfred2000-11-251-0/+14
| | | | this is used by some debugging functions
* Fix compilation of profiled kernels by including <machine/lock.h>phk2000-10-141-0/+1
|
* Next round of fixes to the ia64 code. This includes simulated clock anddfr2000-10-0414-0/+1334
| | | | | | | disk drivers along with a load of fixes to context switching, fork handling and a load of other stuff I can't remember now. This takes us as far as start_init() before it dies. I guess now I will have to finish off the VM system and syscall handling :-).
* Back out previous revision now that sys/random.h is properly fixed.jhb2000-09-111-2/+0
|
* Add #include's of sys/proc.h and sys/param.h to silence a warning.jhb2000-09-111-0/+2
|
* Comment out unavailable call. This needs to be revisited when the entropymarkm2000-06-251-3/+4
| | | | | device is complete. Reviewed by: dfr
* Add $FreeBSD$peter2000-05-018-1/+9
|
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-9/+9
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* Zap c_index() and c_rindex(). Bruce prefers these to implicitly convertpeter1999-12-102-39/+20
| | | | | a const into a non-const as they do in libc. I feel that defeating the type checking like that quite evil, but that's the way it is.
* Eliminate compiler warning.archie1999-12-014-4/+4
|
* In the extremely miniscule chance that read_random returns <= 0, don't trydan1999-11-291-2/+6
| | | | and use that return code as a modulus (panics are bad, mmmkay?)
* Address the concerns of the ``randomness'' of the initial PRNG. Now, wedan1999-11-281-14/+32
| | | | | | | use bits from /dev/random to stir the S-box. Also add an internal counter to keep the S-box stirred on a regular basis. Reviewed by: msmith
* Introduce OpenBSD-like Random PIDs. Controlled by a sysctl knobdan1999-11-281-0/+89
| | | | | | | | (kern.randompid), which is currently defaulted off. Use ARC4 (RC4) for our random number generation, which will not get me executed for violating crypto laws; a Good Thing(tm). Reviewed and Approved by: bde, imp
* Change the prototype of the strto* routines to make the secondarchie1999-11-244-8/+8
| | | | | | | | | | | parameter a char ** instead of a const char **. This make these kernel routines consistent with the corresponding libc userland routines. Which is actually 'correct' is debatable, but consistency and following the spec was deemed more important in this case. Reviewed by (in concept): phk, bde
* Tempt fate and stop index from converting a const char * into a char *.peter1999-11-212-18/+42
| | | | | | | I've made a seperate version (c_index() etc) that use const/const, but I'm not sure it's worth it considering there is one file in the tree that uses index on const strings (kern_linker.c) and it's easily adjusted to scan the strings directly (and is perhaps more efficient that way).
* Move strto{u}[ql]() into their own libkern files.phk1999-11-034-0/+487
| | | | Urged by: bde
* $Id$ -> $FreeBSD$peter1999-08-2836-36/+36
|
* Use the latest version of these files from OpenBSD.imp1999-08-102-17/+22
| | | | | | | | | | 1) Safty change from casper dik was added to OpenBSD's sources since I grabbed them. milltert@openbsd.org 2) Split up strlcpy to improve efficiency of the common case. milltert@openbsd.org 3) Cleanup of cross references for man page. {alex,aaron}@openbsd.org Pointed out by: deraadt@openbsd.org
* Import strl{cat,cpy} from OpenBSD.imp1999-08-102-0/+134
| | | | Obtained from: OpenBSD
* Add a fast version of bcmp which compares longwords at a time.dfr1999-06-191-1/+93
| | | | Submitted by: Peter Jeremy <jeremyp@gsmx07.alcatel.com.au>
* Backed out the previous backout. We may as well have a version of ucmpdi2.cbde1999-06-021-2/+2
| | | | that actually compiles, and I use it for i386's with 64 bit longs.
* Nuke ucmpdi2.c from i386/libkern to serve as a reminder that switchgibbs1999-05-142-4/+3
| | | | | | statements on 64bit values generate poor code. Requested by: bde
* Add ucmpdi2.c to i386 libkern build. Its required for some quadgibbs1999-05-142-3/+4
| | | | manipulation in the aic7xxx driver.
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-282-4/+4
| | | | kernel compile
* - Fix modulo bug.nate1998-12-011-2/+2
| | | | Reminded by: bde
* Converted rcsid to $Id$ again. There shouldn't be any rcsids in the kernel.bde1998-08-171-8/+2
|
* Changed to the C9x draft spelling of the (unsigned) integral typebde1998-07-141-12/+12
| | | | | | | | suitable for holding object pointers (ptrint_t -> uintptr_t). Added corresponding signed type (intptr_t). Changed/added corresponding non-C9x types for function pointers to match. Don't use nonstandard types to implement these types, and don't comment on them in <machine/types.h>.
* #include sys/libkern.h instead of stdlib.h.phk1998-06-301-2/+2
| | | | | | PR: 7105 Reviewed by: phk Submitted by: Robert Watson <robert+freebsd@cyrus.watson.org>
* Add initial support for the FreeBSD/alpha kernel. This is very much adfr1998-06-106-0/+228
| | | | | | | | | | work in progress and has never booted a real machine. Initial development and testing was done using SimOS (see http://simos.stanford.edu for details). On the SimOS simulator, this port successfully reaches single-user mode and has been tested with loads as high as one copy of /bin/ls :-). Obtained from: partly from NetBSD/alpha
* Support compiling with `gcc -ansi'.bde1998-04-151-5/+5
|
* Make our v_usecount vnode reference count work identically to thedyson1998-01-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | original BSD code. The association between the vnode and the vm_object no longer includes reference counts. The major difference is that vm_object's are no longer freed gratuitiously from the vnode, and so once an object is created for the vnode, it will last as long as the vnode does. When a vnode object reference count is incremented, then the underlying vnode reference count is incremented also. The two "objects" are now more intimately related, and so the interactions are now much less complex. When vnodes are now normally placed onto the free queue with an object still attached. The rundown of the object happens at vnode rundown time, and happens with exactly the same filesystem semantics of the original VFS code. There is absolutely no need for vnode_pager_uncache and other travesties like that anymore. A side-effect of these changes is that SMP locking should be much simpler, the I/O copyin/copyout optimizations work, NFS should be more ponderable, and further work on layered filesystems should be less frustrating, because of the totally coherent management of the vnode objects and vnodes. Please be careful with your system while running this code, but I would greatly appreciate feedback as soon a reasonably possible.
* Rename some local variables to avoid shadowing other local variables.phk1997-11-071-4/+4
| | | | Found by: -Wshadow
* Removed unused #includes.bde1997-08-025-10/+5
|
* Style optimization in newly added POSIX range []] conformance, redoache1997-06-071-6/+6
| | | | 'for' loop as do...while and remove variable unneded now
* Add missing FNM_PERIOD check for '[' rangeache1997-06-061-4/+10
| | | | | Don't treat !^ as first characters in the range, just as negate sign [/] never match if FNM_PATHNAME
* 1) Now conforms POSIX.2 2.8.3.2 requirements about []] patternache1997-06-061-11/+35
| | | | 2) Treat unclosed [ range in pattern as regular characters (bash style)
* Fix a bug that caused some false mismatches when both FNM_PATHNAMEjdp1997-04-291-1/+2
| | | | | | and FNM_LEADING_DIR were specified and the pattern ended with "*". Example: pattern="src/usr.sbin/w*", string="src/usr.sbin/watch/watch.8,v". This should match, but did not.
* Eliminate some function calls when locale not usedache1997-04-041-6/+4
|
* Speedup in case locale not usedache1997-04-041-2/+6
|
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-2236-36/+36
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-1436-36/+36
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* collate_range_cmp -> __collate_range_cmpache1996-10-311-3/+4
|
OpenPOWER on IntegriCloud