diff -r f47e9457a7b8 src/lib/libgeom/geom_util.c --- a/src/lib/libgeom/geom_util.c Sun Apr 27 22:16:23 2008 +0200 +++ b/src/lib/libgeom/geom_util.c Thu May 29 18:31:44 2008 +0200 @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libgeom/geom_util.c,v 1.1 2007/05/06 01:17:46 pjd Exp $"); +__FBSDID("$FreeBSD: src/lib/libgeom/geom_util.c,v 1.2 2008/05/20 11:45:05 pjd Exp $"); #include #include @@ -46,25 +46,18 @@ * Open the given provider and at least check if this is a block device. */ int -g_open(const char *name, int write) +g_open(const char *name, int dowrite) { - char path[MAXPATHLEN]; + char *path; int fd; - if (name[0] == '/') - strlcpy(path, name, sizeof(path)); - else - snprintf(path, sizeof(path), "%s%s", _PATH_DEV, name); - - fd = open(path, write ? O_RDWR : O_RDONLY); + path = g_device_path(name); + if (path == NULL) + return (-1); + fd = open(path, dowrite ? O_RDWR : O_RDONLY); + free(path); if (fd == -1) return (-1); - /* Let try to get sectorsize, which will prove it is a GEOM provider. */ - if (g_sectorsize(fd) == -1) { - close(fd); - errno = EFTYPE; - return (-1); - } return (fd); } @@ -183,7 +176,7 @@ * Find provider name by the given ID. */ int -g_open_by_ident(const char *ident, int write, char *name, size_t size) +g_open_by_ident(const char *ident, int dowrite, char *name, size_t size) { char lident[DISK_IDENT_SIZE]; struct gmesh mesh; @@ -204,7 +197,7 @@ LIST_FOREACH(mp, &mesh.lg_class, lg_class) { LIST_FOREACH(gp, &mp->lg_geom, lg_geom) { LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { - fd = g_open(pp->lg_name, write); + fd = g_open(pp->lg_name, dowrite); if (fd == -1) continue; if (g_get_ident(fd, lident, @@ -234,3 +227,69 @@ } return (fd); } + +/* + * Return the device path device given a partial or full path to its node. + */ +char * +g_device_path(const char *devpath) +{ + char *path; + int fd; + + /* Use the device node if we're able to open it. */ + do { + fd = open(devpath, O_RDONLY); + if (fd == -1) + break; + /* Let try to get sectorsize, which will prove it is a GEOM provider. */ + if (g_sectorsize(fd) == -1) { + close(fd); + errno = EFTYPE; + return (NULL); + } + close(fd); + return (strdup(devpath)); + } while (0); + + /* If we're not given an absolute path, assume /dev/ prefix. */ + if (*devpath != '/') { + asprintf(&path, "%s%s", _PATH_DEV, devpath); + fd = open(path, O_RDONLY); + if (fd == -1) { + free(path); + return (NULL); + } + /* Let try to get sectorsize, which will prove it is a GEOM provider. */ + if (g_sectorsize(fd) == -1) { + free(path); + close(fd); + errno = EFTYPE; + return (NULL); + } + close(fd); + return (strdup(path)); + } + return (NULL); +} + +/* + * Return the provider name of a GEOM device. + */ +char * +g_provider_from_path(const char *devpath) +{ + char buffer[MAXPATHLEN]; + int fd; + + /* Compute the correct devpath for us. */ + fd = g_open(devpath, 0); + if (fd < 0) + return (NULL); + if (ioctl(fd, DIOCGPROVIDERNAME, buffer) < 0) { + close(fd); + return (NULL); + } + close(fd); + return (strdup(buffer)); +} diff -r f47e9457a7b8 src/lib/libgeom/libgeom.3 --- a/src/lib/libgeom/libgeom.3 Sun Apr 27 22:16:23 2008 +0200 +++ b/src/lib/libgeom/libgeom.3 Thu May 29 18:31:44 2008 +0200 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libgeom/libgeom.3,v 1.8 2007/05/06 01:17:46 pjd Exp $ +.\" $FreeBSD: src/lib/libgeom/libgeom.3,v 1.9 2008/05/20 11:45:05 pjd Exp $ .\" .Dd May 6, 2007 .Dt LIBGEOM 3 @@ -92,7 +92,7 @@ .Fn gctl_dump "struct gctl_req *req" "FILE *f" .Ss "Utility Functions" .Ft int -.Fn g_open "const char *name" "int write" +.Fn g_open "const char *name" "int dowrite" .Ft int .Fn g_close "int fd" .Ft off_t @@ -108,7 +108,7 @@ .Ft int .Fn g_get_name "const char *ident" "char *name" "size_t size" .Ft int -.Fn g_open_by_ident "const char *ident" "int write" "char *name" "size_t size" +.Fn g_open_by_ident "const char *ident" "int dowrite" "char *name" "size_t size" .Sh DESCRIPTION The .Nm geom @@ -271,7 +271,7 @@ function opens the given provider and returns file descriptor number, which can be used with other functions. The -.Fa write +.Fa dowrite argument indicates if operations that modify the provider (like .Fn g_flush or diff -r f47e9457a7b8 src/lib/libgeom/libgeom.h --- a/src/lib/libgeom/libgeom.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/lib/libgeom/libgeom.h Thu May 29 18:31:44 2008 +0200 @@ -154,6 +154,8 @@ int g_get_ident(int, char *, size_t); int g_get_name(const char *, char *, size_t); int g_open_by_ident(const char *, int, char *, size_t); +char *g_device_path(const char *); +char *g_provider_from_path(const char *); __END_DECLS diff -r f47e9457a7b8 src/sys/geom/geom_dev.c --- a/src/sys/geom/geom_dev.c Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/geom/geom_dev.c Thu May 29 18:31:44 2008 +0200 @@ -244,6 +244,7 @@ { struct g_geom *gp; struct g_consumer *cp; + struct g_provider *pp; struct g_kerneldump kd; off_t offset, length, chunk; int i, error; @@ -251,6 +252,7 @@ gp = dev->si_drv1; cp = dev->si_drv2; + pp = cp->provider; error = 0; KASSERT(cp->acr || cp->acw, @@ -328,6 +330,12 @@ break; case DIOCGIDENT: error = g_io_getattr("GEOM::ident", cp, &i, data); + break; + case DIOCGPROVIDERNAME: + if (pp == NULL) + return (ENOENT); + + copyout(pp->name, data, strlen(pp->name) + 1); break; default: diff -r f47e9457a7b8 src/sys/sys/_lock.h --- a/src/sys/sys/_lock.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/_lock.h Thu May 29 18:31:44 2008 +0200 @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/_lock.h,v 1.15 2007/12/15 23:13:31 jeff Exp $ + * $FreeBSD: src/sys/sys/_lock.h,v 1.16 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS__LOCK_H_ @@ -33,12 +33,9 @@ struct lock_object { const char *lo_name; /* Individual lock name. */ - const char *lo_type; /* General lock type. */ u_int lo_flags; - union { /* Data for witness. */ - STAILQ_ENTRY(lock_object) lod_list; - struct witness *lod_witness; - } lo_witness_data; + u_int lo_data; /* General class specific data. */ + struct witness *lo_witness; /* Data for witness. */ }; #endif /* !_SYS__LOCK_H_ */ diff -r f47e9457a7b8 src/sys/sys/_lockmgr.h --- a/src/sys/sys/_lockmgr.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/_lockmgr.h Thu May 29 18:31:44 2008 +0200 @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * - * $FreeBSD: src/sys/sys/_lockmgr.h,v 1.1 2008/04/06 20:08:50 attilio Exp $ + * $FreeBSD: src/sys/sys/_lockmgr.h,v 1.2 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS__LOCKMGR_H_ @@ -38,7 +38,6 @@ struct lock { struct lock_object lock_object; volatile uintptr_t lk_lock; - volatile unsigned lk_recurse; int lk_timo; int lk_pri; #ifdef DEBUG_LOCKS diff -r f47e9457a7b8 src/sys/sys/_mutex.h --- a/src/sys/sys/_mutex.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/_mutex.h Thu May 29 18:31:44 2008 +0200 @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/_mutex.h,v 1.13 2007/03/21 21:20:51 jhb Exp $ + * $FreeBSD: src/sys/sys/_mutex.h,v 1.14 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS__MUTEX_H_ @@ -37,7 +37,6 @@ struct mtx { struct lock_object lock_object; /* Common lock properties. */ volatile uintptr_t mtx_lock; /* Owner and flags. */ - volatile u_int mtx_recurse; /* Number of recursive holds. */ }; #endif /* !_SYS__MUTEX_H_ */ diff -r f47e9457a7b8 src/sys/sys/_rwlock.h --- a/src/sys/sys/_rwlock.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/_rwlock.h Thu May 29 18:31:44 2008 +0200 @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/_rwlock.h,v 1.4 2007/06/26 21:31:56 attilio Exp $ + * $FreeBSD: src/sys/sys/_rwlock.h,v 1.5 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS__RWLOCK_H_ @@ -38,7 +38,6 @@ struct rwlock { struct lock_object lock_object; volatile uintptr_t rw_lock; - volatile unsigned rw_recurse; }; #endif /* !_SYS__RWLOCK_H_ */ diff -r f47e9457a7b8 src/sys/sys/_sx.h --- a/src/sys/sys/_sx.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/_sx.h Thu May 29 18:31:44 2008 +0200 @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * - * $FreeBSD: src/sys/sys/_sx.h,v 1.1 2007/03/31 23:23:42 jhb Exp $ + * $FreeBSD: src/sys/sys/_sx.h,v 1.2 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS__SX_H_ @@ -37,7 +37,6 @@ struct sx { struct lock_object lock_object; volatile uintptr_t sx_lock; - volatile unsigned sx_recurse; }; #endif /* !_SYS__SX_H_ */ diff -r f47e9457a7b8 src/sys/sys/blist.h --- a/src/sys/sys/blist.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/blist.h Thu May 29 18:31:44 2008 +0200 @@ -29,12 +29,12 @@ * Implements bitmap resource lists. * * Usage: - * blist = blist_create(blocks) + * blist = blist_create(blocks, flags) * (void) blist_destroy(blist) * blkno = blist_alloc(blist, count) * (void) blist_free(blist, blkno, count) * nblks = blist_fill(blist, blkno, count) - * (void) blist_resize(&blist, count, freeextra) + * (void) blist_resize(&blist, count, freeextra, flags) * * * Notes: @@ -49,7 +49,8 @@ * that. Managing something like 512MB worth of 4K blocks * eats around 32 KBytes of memory. * - * $FreeBSD: src/sys/sys/blist.h,v 1.9 2005/01/07 02:29:23 imp Exp $ + * $FreeBSD: src/sys/sys/blist.h,v 1.10 2008/05/05 19:48:54 kmacy Exp $ + */ #ifndef _SYS_BLIST_H_ @@ -91,13 +92,13 @@ #define BLIST_MAX_ALLOC BLIST_BMAP_RADIX -extern blist_t blist_create(daddr_t blocks); +extern blist_t blist_create(daddr_t blocks, int flags); extern void blist_destroy(blist_t blist); extern daddr_t blist_alloc(blist_t blist, daddr_t count); extern void blist_free(blist_t blist, daddr_t blkno, daddr_t count); extern int blist_fill(blist_t bl, daddr_t blkno, daddr_t count); extern void blist_print(blist_t blist); -extern void blist_resize(blist_t *pblist, daddr_t count, int freenew); +extern void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags); #endif /* _SYS_BLIST_H_ */ diff -r f47e9457a7b8 src/sys/sys/clist.h --- a/src/sys/sys/clist.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/clist.h Thu May 29 18:31:44 2008 +0200 @@ -27,11 +27,26 @@ * SUCH DAMAGE. * * @(#)clist.h 8.1 (Berkeley) 6/4/93 - * $FreeBSD: src/sys/sys/clist.h,v 1.11 2004/04/07 04:19:49 imp Exp $ + * $FreeBSD: src/sys/sys/clist.h,v 1.13 2008/05/23 18:34:33 ed Exp $ */ #ifndef _SYS_CLIST_H_ #define _SYS_CLIST_H_ + +#include + +/* + * Clists are character lists, which is a variable length linked list + * of cblocks, with a count of the number of characters in the list. + */ +struct clist { + int c_cc; /* Number of characters in the clist. */ + int c_cbcount; /* Number of cblocks. */ + int c_cbmax; /* Max # cblocks allowed for this clist. */ + int c_cbreserved; /* # cblocks reserved for this clist. */ + char *c_cf; /* Pointer to the first cblock. */ + char *c_cl; /* Pointer to the last cblock. */ +}; struct cblock { struct cblock *c_next; /* next cblock in queue */ @@ -40,8 +55,18 @@ }; #ifdef _KERNEL -extern struct cblock *cfree; extern int cfreecount; + +int b_to_q(char *cp, int cc, struct clist *q); +void catq(struct clist *from, struct clist *to); +void clist_alloc_cblocks(struct clist *q, int ccmax, int ccres); +void clist_free_cblocks(struct clist *q); +int getc(struct clist *q); +void ndflush(struct clist *q, int cc); +char *nextc(struct clist *q, char *cp, int *c); +int putc(int c, struct clist *q); +int q_to_b(struct clist *q, char *cp, int cc); +int unputc(struct clist *q); #endif #endif diff -r f47e9457a7b8 src/sys/sys/conf.h --- a/src/sys/sys/conf.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/conf.h Thu May 29 18:31:44 2008 +0200 @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.5 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/sys/conf.h,v 1.236 2008/03/17 13:17:10 kib Exp $ + * $FreeBSD: src/sys/sys/conf.h,v 1.238 2008/05/22 13:46:41 ed Exp $ */ #ifndef _SYS_CONF_H_ @@ -281,12 +281,19 @@ u_int minor2unit(u_int _minor); void setconf(void); +typedef void (*cdevpriv_dtr_t)(void *data); +int devfs_get_cdevpriv(void **datap); +int devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr); +void devfs_clear_cdevpriv(void); +void devfs_fpdrop(struct file *fp); /* XXX This is not public KPI */ + #define UID_ROOT 0 #define UID_BIN 3 #define UID_UUCP 66 #define GID_WHEEL 0 #define GID_KMEM 2 +#define GID_TTY 4 #define GID_OPERATOR 5 #define GID_BIN 7 #define GID_GAMES 13 diff -r f47e9457a7b8 src/sys/sys/cons.h --- a/src/sys/sys/cons.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/cons.h Thu May 29 18:31:44 2008 +0200 @@ -32,13 +32,15 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $FreeBSD: src/sys/sys/cons.h,v 1.40 2006/11/01 04:54:51 jb Exp $ + * $FreeBSD: src/sys/sys/cons.h,v 1.41 2008/05/23 16:06:35 ed Exp $ */ #ifndef _MACHINE_CONS_H_ #define _MACHINE_CONS_H_ struct consdev; +struct tty; + typedef void cn_probe_t(struct consdev *); typedef void cn_init_t(struct consdev *); typedef void cn_term_t(struct consdev *); @@ -80,6 +82,9 @@ #ifdef _KERNEL +extern struct msgbuf consmsgbuf; /* Message buffer for constty. */ +extern struct tty *constty; /* Temporary virtual console. */ + #define CONS_DRIVER(name, probe, init, term, getc, checkc, putc, dbctl) \ static struct consdev name##_consdev = { \ probe, init, term, getc, checkc, putc \ @@ -108,6 +113,8 @@ void cnputc(int); void cnputs(char *); int cnunavailable(void); +void constty_set(struct tty *tp); +void constty_clear(void); #endif /* _KERNEL */ diff -r f47e9457a7b8 src/sys/sys/disk.h --- a/src/sys/sys/disk.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/disk.h Thu May 29 18:31:44 2008 +0200 @@ -98,4 +98,10 @@ * - ident is optional and applications can't relay on its presence. */ +#define DIOCGPROVIDERNAME _IOR('d', 138, char *) + /*- + * Store the provider name, given a device path, in a buffer. The buffer + * must be at least MAXPATHLEN bytes long. + */ + #endif /* _SYS_DISK_H_ */ diff -r f47e9457a7b8 src/sys/sys/domain.h --- a/src/sys/sys/domain.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/domain.h Thu May 29 18:31:44 2008 +0200 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)domain.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/sys/sys/domain.h,v 1.22 2006/08/07 12:02:43 rwatson Exp $ + * $FreeBSD: src/sys/sys/domain.h,v 1.23 2008/05/09 23:02:59 julian Exp $ */ #ifndef _SYS_DOMAIN_H_ @@ -57,6 +57,12 @@ int (*dom_rtattach) /* initialize routing table */ (void **, int); int dom_rtoffset; /* an arg to rtattach, in bits */ + /* XXX MRT. + * rtoffset May be 0 if the domain supplies its own rtattach(), + * in which case, a 0 indicates it's being called from + * vfs_export.c (HACK) Only for AF_INET{,6} at this time. + * Temporary ABI compat hack.. fix post RELENG_7 + */ int dom_maxrtkey; /* for routing layer */ void *(*dom_ifattach)(struct ifnet *); void (*dom_ifdetach)(struct ifnet *, void *); diff -r f47e9457a7b8 src/sys/sys/dtrace_bsd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sys/sys/dtrace_bsd.h Thu May 29 18:31:44 2008 +0200 @@ -0,0 +1,111 @@ +/*- + * Copyright (c) 2007-2008 John Birrell (jb@freebsd.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/dtrace_bsd.h,v 1.1 2008/05/17 02:16:58 jb Exp $ + * + * This file contains BSD shims for Sun's DTrace code. + */ + +#ifndef _SYS_DTRACE_BSD_H +#define _SYS_DTRACE_BSD_H + +/* Forward definitions: */ +struct trapframe; +struct thread; + +/* + * Cyclic clock function type definition used to hook the cyclic + * subsystem into the appropriate timer interrupt. + */ +typedef void (*cyclic_clock_func_t)(struct trapframe *); + +/* + * These external variables are actually machine-dependent, so + * they might not actually exist. + * + * Defining them here avoids a proliferation of header files. + */ +extern cyclic_clock_func_t lapic_cyclic_clock_func[]; + +/* + * The dtrace module handles traps that occur during a DTrace probe. + * This type definition is used in the trap handler to provide a + * hook for the dtrace module to register it's handler with. + */ +typedef int (*dtrace_trap_func_t)(struct trapframe *, u_int); + +int dtrace_trap(struct trapframe *, u_int); + +extern dtrace_trap_func_t dtrace_trap_func; + +/* Used by the machine dependent trap() code. */ +typedef int (*dtrace_invop_func_t)(uintptr_t, uintptr_t *, uintptr_t); +typedef void (*dtrace_doubletrap_func_t)(void); + +/* Global variables in trap.c */ +extern dtrace_invop_func_t dtrace_invop_func; +extern dtrace_doubletrap_func_t dtrace_doubletrap_func; + +/* Virtual time hook function type. */ +typedef void (*dtrace_vtime_switch_func_t)(struct thread *); + +extern int dtrace_vtime_active; +extern dtrace_vtime_switch_func_t dtrace_vtime_switch_func; + +/* The fasttrap module hooks into the fork, exit and exit. */ +typedef void (*dtrace_fork_func_t)(struct proc *, struct proc *); +typedef void (*dtrace_execexit_func_t)(struct proc *); + +/* Global variable in kern_fork.c */ +extern dtrace_fork_func_t dtrace_fasttrap_fork; + +/* Global variable in kern_exec.c */ +extern dtrace_execexit_func_t dtrace_fasttrap_exec; + +/* Global variable in kern_exit.c */ +extern dtrace_execexit_func_t dtrace_fasttrap_exit; + +/* The dtmalloc provider hooks into malloc. */ +typedef void (*dtrace_malloc_probe_func_t)(u_int32_t, uintptr_t arg0, + uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4); + +extern dtrace_malloc_probe_func_t dtrace_malloc_probe; + +/* + * Functions which allow the dtrace module to check that the kernel + * hooks have been compiled with sufficient space for it's private + * structures. + */ +size_t kdtrace_proc_size(void); +size_t kdtrace_thread_size(void); + +/* + * OpenSolaris compatible time functions returning nanoseconds. + * On OpenSolaris these return hrtime_t which we define as uint64_t. + */ +uint64_t dtrace_gethrtime(void); +uint64_t dtrace_gethrestime(void); + +#endif /* _SYS_DTRACE_BSD_H */ diff -r f47e9457a7b8 src/sys/sys/file.h --- a/src/sys/sys/file.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/file.h Thu May 29 18:31:44 2008 +0200 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)file.h 8.3 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/sys/file.h,v 1.76 2008/01/08 21:58:16 jhb Exp $ + * $FreeBSD: src/sys/sys/file.h,v 1.79 2008/05/26 15:12:47 pjd Exp $ */ #ifndef _SYS_FILE_H_ @@ -39,6 +39,7 @@ #include #else #include +#include #include #include @@ -96,7 +97,9 @@ #define DFLAG_PASSABLE 0x01 /* may be passed via unix sockets. */ #define DFLAG_SEEKABLE 0x02 /* seekable / nonsequential */ +#endif /* _KERNEL */ +#if defined(_KERNEL) || defined(_WANT_FILE) /* * Kernel descriptor table. * One entry for each open kernel vnode and socket. @@ -104,6 +107,7 @@ * Below is the list of locks that protects members in struct file. * * (f) protected with mtx_lock(mtx_pool_find(fp)) + * (d) cdevpriv_mtx * none not locked */ @@ -115,12 +119,13 @@ short f_type; /* descriptor type */ short f_vnread_flags; /* (f) Sleep lock for f_offset */ volatile u_int f_flag; /* see fcntl.h */ - volatile int f_count; /* reference count */ + volatile u_int f_count; /* reference count */ /* * DTYPE_VNODE specific fields. */ int f_seqcount; /* Count of sequential accesses. */ off_t f_nextoff; /* next expected read/write offset. */ + struct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */ /* * DFLAG_SEEKABLE specific fields */ @@ -134,7 +139,7 @@ #define FOFFSET_LOCKED 0x1 #define FOFFSET_LOCK_WAITING 0x2 -#endif /* _KERNEL */ +#endif /* _KERNEL || _WANT_FILE */ /* * Userland version of struct file, for sysctl @@ -194,9 +199,10 @@ int fgetsock(struct thread *td, int fd, struct socket **spp, u_int *fflagp); void fputsock(struct socket *sp); -#define fhold(fp) atomic_add_int(&(fp)->f_count, 1) +#define fhold(fp) \ + (refcount_acquire(&(fp)->f_count)) #define fdrop(fp, td) \ - (atomic_fetchadd_int(&(fp)->f_count, -1) <= 1 ? _fdrop((fp), (td)) : 0) + (refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : 0) static __inline fo_rdwr_t fo_read; static __inline fo_rdwr_t fo_write; diff -r f47e9457a7b8 src/sys/sys/kdb.h --- a/src/sys/sys/kdb.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/kdb.h Thu May 29 18:31:44 2008 +0200 @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/kdb.h,v 1.6 2007/12/25 17:52:02 rwatson Exp $ + * $FreeBSD: src/sys/sys/kdb.h,v 1.8 2008/05/23 04:00:44 jb Exp $ */ #ifndef _SYS_KDB_H_ @@ -69,6 +69,8 @@ void kdb_enter(const char *, const char *); void kdb_init(void); void * kdb_jmpbuf(jmp_buf); +void kdb_panic(const char *); +void kdb_reboot(void); void kdb_reenter(void); struct pcb *kdb_thr_ctx(struct thread *); struct thread *kdb_thr_first(void); @@ -104,5 +106,11 @@ #define KDB_WHY_MAC "mac" /* MAC Framework. */ #define KDB_WHY_POWERPC "powerpc" /* Unhandled powerpc intr. */ #define KDB_WHY_UNIONFS "unionfs" /* Unionfs bug. */ +#define KDB_WHY_DTRACE "dtrace" /* DTrace action entered debugger. */ + +/* Return values for kdb_alt_break */ +#define KDB_REQ_DEBUGGER 1 /* User requested Debugger */ +#define KDB_REQ_PANIC 2 /* User requested a panic */ +#define KDB_REQ_REBOOT 3 /* User requested a clean reboot */ #endif /* !_SYS_KDB_H_ */ diff -r f47e9457a7b8 src/sys/sys/kernel.h --- a/src/sys/sys/kernel.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/kernel.h Thu May 29 18:31:44 2008 +0200 @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/sys/kernel.h,v 1.140 2008/04/08 17:53:33 sam Exp $ + * $FreeBSD: src/sys/sys/kernel.h,v 1.141 2008/05/18 22:10:10 jb Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -113,6 +113,7 @@ SI_SUB_EVENTHANDLER = 0x1C00000, /* eventhandler init */ SI_SUB_KLD = 0x2000000, /* KLD and module setup */ SI_SUB_CPU = 0x2100000, /* CPU resource(s)*/ + SI_SUB_KDTRACE = 0x2140000, /* Kernel dtrace hooks */ SI_SUB_MAC = 0x2180000, /* TrustedBSD MAC subsystem */ SI_SUB_MAC_POLICY = 0x21C0000, /* TrustedBSD MAC policies */ SI_SUB_MAC_LATE = 0x21D0000, /* TrustedBSD MAC subsystem */ @@ -121,6 +122,8 @@ SI_SUB_DDB_SERVICES = 0x2380000, /* capture, scripting, etc. */ SI_SUB_RUN_QUEUE = 0x2400000, /* set up run queue*/ SI_SUB_KTRACE = 0x2480000, /* ktrace */ + SI_SUB_OPENSOLARIS = 0x2490000, /* OpenSolaris compatibility */ + SI_SUB_CYCLIC = 0x24A0000, /* Cyclic timers */ SI_SUB_AUDIT = 0x24C0000, /* audit */ SI_SUB_CREATE_INIT = 0x2500000, /* create init process*/ SI_SUB_SCHED_IDLE = 0x2600000, /* required idle procs */ @@ -131,6 +134,9 @@ SI_SUB_DEVFS = 0x2F00000, /* devfs ready for devices */ SI_SUB_INIT_IF = 0x3000000, /* prep for net interfaces */ SI_SUB_NETGRAPH = 0x3010000, /* Let Netgraph initialize */ + SI_SUB_DTRACE = 0x3020000, /* DTrace subsystem */ + SI_SUB_DTRACE_PROVIDER = 0x3048000, /* DTrace providers */ + SI_SUB_DTRACE_ANON = 0x308C000, /* DTrace anon enabling */ SI_SUB_DRIVERS = 0x3100000, /* Let Drivers initialize */ SI_SUB_CONFIGURE = 0x3800000, /* Configure devices */ SI_SUB_VFS = 0x4000000, /* virtual filesystem*/ diff -r f47e9457a7b8 src/sys/sys/linker.h --- a/src/sys/sys/linker.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/linker.h Thu May 29 18:31:44 2008 +0200 @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/linker.h,v 1.50 2007/12/01 19:24:28 rwatson Exp $ + * $FreeBSD: src/sys/sys/linker.h,v 1.51 2008/05/23 00:49:38 jb Exp $ */ #ifndef _SYS_LINKER_H_ @@ -59,7 +59,7 @@ size_t size; } linker_symval_t; -typedef int (*linker_function_nameval_callback_t)(linker_file_t, linker_symval_t *, void *); +typedef int (*linker_function_nameval_callback_t)(linker_file_t, int, linker_symval_t *, void *); struct common_symbol { STAILQ_ENTRY(common_symbol) link; @@ -158,8 +158,8 @@ /* * List all functions in a file. */ -int linker_file_function_listall(linker_file_t, int (*)(linker_file_t, - linker_symval_t *, void *), void *); +int linker_file_function_listall(linker_file_t, + linker_function_nameval_callback_t, void *); /* * Functions soley for use by the linker class handlers. @@ -267,6 +267,20 @@ const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size _symidx); const char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx); +typedef struct linker_ctf { + const uint8_t *ctftab; /* Decompressed CTF data. */ + int ctfcnt; /* Number of CTF data bytes. */ + const Elf_Sym *symtab; /* Ptr to the symbol table. */ + int nsym; /* Number of symbols. */ + const char *strtab; /* Ptr to the string table. */ + int strcnt; /* Number of string bytes. */ + uint32_t **ctfoffp; /* Ptr to array of obj/fnc offsets. */ + uint32_t **typoffp; /* Ptr to array of type offsets. */ + long *typlenp; /* Ptr to number of type data entries. */ +} linker_ctf_t; + +int linker_ctf_get(linker_file_t, linker_ctf_t *); + int elf_cpu_load_file(linker_file_t); int elf_cpu_unload_file(linker_file_t); diff -r f47e9457a7b8 src/sys/sys/lock.h --- a/src/sys/sys/lock.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/lock.h Thu May 29 18:31:44 2008 +0200 @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $ - * $FreeBSD: src/sys/sys/lock.h,v 1.72 2008/04/13 01:20:47 attilio Exp $ + * $FreeBSD: src/sys/sys/lock.h,v 1.73 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS_LOCK_H_ @@ -78,7 +78,6 @@ #define LO_SLEEPABLE 0x00100000 /* Lock may be held while sleeping. */ #define LO_UPGRADABLE 0x00200000 /* Lock may be upgraded/downgraded. */ #define LO_DUPOK 0x00400000 /* Don't check for duplicate acquires */ -#define LO_ENROLLPEND 0x00800000 /* On the pending enroll list. */ #define LO_CLASSMASK 0x0f000000 /* Class index bitmask. */ #define LO_NOPROFILE 0x10000000 /* Don't profile this lock */ @@ -201,7 +200,7 @@ void lock_destroy(struct lock_object *); void spinlock_enter(void); void spinlock_exit(void); -void witness_init(struct lock_object *); +void witness_init(struct lock_object *, const char *); void witness_destroy(struct lock_object *); int witness_defineorder(struct lock_object *, struct lock_object *); void witness_checkorder(struct lock_object *, int, const char *, int); @@ -225,8 +224,8 @@ #define WARN_PANIC 0x02 /* Panic if check fails. */ #define WARN_SLEEPOK 0x04 /* Sleepable locks are exempt from check. */ -#define WITNESS_INIT(lock) \ - witness_init((lock)) +#define WITNESS_INIT(lock, type) \ + witness_init((lock), (type)) #define WITNESS_DESTROY(lock) \ witness_destroy(lock) @@ -273,7 +272,7 @@ witness_line(lock) #else /* WITNESS */ -#define WITNESS_INIT(lock) +#define WITNESS_INIT(lock, type) #define WITNESS_DESTROY(lock) #define WITNESS_DEFINEORDER(lock1, lock2) 0 #define WITNESS_CHECKORDER(lock, flags, file, line) diff -r f47e9457a7b8 src/sys/sys/lockmgr.h --- a/src/sys/sys/lockmgr.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/lockmgr.h Thu May 29 18:31:44 2008 +0200 @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * - * $FreeBSD: src/sys/sys/lockmgr.h,v 1.69 2008/04/07 14:46:38 attilio Exp $ + * $FreeBSD: src/sys/sys/lockmgr.h,v 1.70 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS_LOCKMGR_H_ @@ -59,6 +59,7 @@ #endif struct thread; +#define lk_recurse lock_object.lo_data /* * Function prototipes. Routines that start with an underscore are not part diff -r f47e9457a7b8 src/sys/sys/malloc.h --- a/src/sys/sys/malloc.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/malloc.h Thu May 29 18:31:44 2008 +0200 @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 - * $FreeBSD: src/sys/sys/malloc.h,v 1.84 2007/11/10 19:11:51 alc Exp $ + * $FreeBSD: src/sys/sys/malloc.h,v 1.85 2008/05/23 00:43:35 jb Exp $ */ #ifndef _SYS_MALLOC_H_ @@ -80,7 +80,16 @@ uint64_t _mts_reserved3; /* Reserved field. */ }; +/* + * Index definitions for the mti_probes[] array. + */ +#define DTMALLOC_PROBE_MALLOC 0 +#define DTMALLOC_PROBE_FREE 1 +#define DTMALLOC_PROBE_MAX 2 + struct malloc_type_internal { + uint32_t mti_probes[DTMALLOC_PROBE_MAX]; + /* DTrace probe ID array. */ struct malloc_type_stats mti_stats[MAXCPU]; }; @@ -173,6 +182,11 @@ extern struct mtx malloc_mtx; +/* + * Function type used when iterating over the list of malloc types. + */ +typedef void malloc_type_list_func_t(struct malloc_type *, void *); + void contigfree(void *addr, unsigned long size, struct malloc_type *type); void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, @@ -183,6 +197,7 @@ int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); void malloc_type_freed(struct malloc_type *type, unsigned long size); +void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); void *realloc(void *addr, unsigned long size, struct malloc_type *type, int flags); diff -r f47e9457a7b8 src/sys/sys/mbuf.h --- a/src/sys/sys/mbuf.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/mbuf.h Thu May 29 18:31:44 2008 +0200 @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 - * $FreeBSD: src/sys/sys/mbuf.h,v 1.224 2008/03/25 09:39:02 ru Exp $ + * $FreeBSD: src/sys/sys/mbuf.h,v 1.226 2008/05/09 23:02:59 julian Exp $ */ #ifndef _SYS_MBUF_H_ @@ -192,6 +192,11 @@ #define M_PROTO6 0x00080000 /* protocol-specific */ #define M_PROTO7 0x00100000 /* protocol-specific */ #define M_PROTO8 0x00200000 /* protocol-specific */ +/* + * For RELENG_{6,7} steal these flags for limited multiple routing table + * support. In RELENG_8 and beyond, use just one flag and a tag. + */ +#define M_FIB 0xF0000000 /* steal some bits to store fib number. */ #define M_NOTIFICATION M_PROTO5 /* SCTP notification */ @@ -206,7 +211,7 @@ */ #define M_COPYFLAGS \ (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\ - M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC) + M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_FIB) /* * External buffer types: identify ext_buf type. @@ -277,7 +282,7 @@ u_long m_mlen; /* length of data in an mbuf */ u_long m_mhlen; /* length of data in a header mbuf */ - /* Number of mbtypes (gives # elems in mbtypes[] array: */ + /* Number of mbtypes (gives # elems in mbtypes[] array) */ short m_numtypes; /* XXX: Sendfile stats should eventually move to their own struct */ @@ -957,6 +962,27 @@ m_tag_locate(m, MTAG_ABI_COMPAT, type, start)); } +/* XXX temporary FIB methods probably eventually use tags.*/ +#define M_FIBSHIFT 28 +#define M_FIBMASK 0x0F + +/* get the fib from an mbuf and if it is not set, return the default */ +#define M_GETFIB(_m) \ + ((((_m)->m_flags & M_FIB) >> M_FIBSHIFT) & M_FIBMASK) + +#define M_SETFIB(_m, _fib) do { \ + _m->m_flags &= ~M_FIB; \ + _m->m_flags |= (((_fib) << M_FIBSHIFT) & M_FIB); \ +} while (0) + #endif /* _KERNEL */ +#ifdef MBUF_PROFILING + void m_profile(struct mbuf *m); + #define M_PROFILE(m) m_profile(m) +#else + #define M_PROFILE(m) +#endif + + #endif /* !_SYS_MBUF_H_ */ diff -r f47e9457a7b8 src/sys/sys/mpt_ioctl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sys/sys/mpt_ioctl.h Thu May 29 18:31:44 2008 +0200 @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2008 Yahoo!, Inc. + * All rights reserved. + * Written by: John Baldwin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * LSI MPT-Fusion Host Adapter FreeBSD userland interface + * + * $FreeBSD: src/sys/sys/mpt_ioctl.h,v 1.1 2008/05/06 20:49:52 jhb Exp $ + */ + +#ifndef _MPT_IOCTL_H_ +#define _MPT_IOCTL_H_ + +#include +#include +#include + +/* + * For the read header requests, the header should include the page + * type or extended page type, page number, and page version. The + * buffer and length are unused. The completed header is returned in + * the 'header' member. + * + * For the read page and write page requests, 'buf' should point to a + * buffer of 'len' bytes which holds the entire page (including the + * header). + * + * All requests specify the page address in 'page_address'. + */ +struct mpt_cfg_page_req { + CONFIG_PAGE_HEADER header; + uint32_t page_address; + void *buf; + int len; + uint16_t ioc_status; +}; + +struct mpt_ext_cfg_page_req { + CONFIG_EXTENDED_PAGE_HEADER header; + uint32_t page_address; + void *buf; + int len; + uint16_t ioc_status; +}; + +struct mpt_raid_action { + uint8_t action; + uint8_t volume_bus; + uint8_t volume_id; + uint8_t phys_disk_num; + uint32_t action_data_word; + void *buf; + int len; + uint32_t volume_status; + uint32_t action_data[4]; + uint16_t action_status; + uint16_t ioc_status; + uint8_t write; +}; + +#define MPTIO_READ_CFG_HEADER _IOWR('M', 100, struct mpt_cfg_page_req) +#define MPTIO_READ_CFG_PAGE _IOWR('M', 101, struct mpt_cfg_page_req) +#define MPTIO_READ_EXT_CFG_HEADER _IOWR('M', 102, struct mpt_ext_cfg_page_req) +#define MPTIO_READ_EXT_CFG_PAGE _IOWR('M', 103, struct mpt_ext_cfg_page_req) +#define MPTIO_WRITE_CFG_PAGE _IOWR('M', 104, struct mpt_cfg_page_req) +#define MPTIO_RAID_ACTION _IOWR('M', 105, struct mpt_raid_action) + +#if defined(__amd64__) +struct mpt_cfg_page_req32 { + CONFIG_PAGE_HEADER header; + uint32_t page_address; + uint32_t buf; + int len; + uint16_t ioc_status; +}; + +struct mpt_ext_cfg_page_req32 { + CONFIG_EXTENDED_PAGE_HEADER header; + uint32_t page_address; + uint32_t buf; + int len; + uint16_t ioc_status; +}; + +struct mpt_raid_action32 { + uint8_t action; + uint8_t volume_bus; + uint8_t volume_id; + uint8_t phys_disk_num; + uint32_t action_data_word; + uint32_t buf; + int len; + uint32_t volume_status; + uint32_t action_data[4]; + uint16_t action_status; + uint16_t ioc_status; + uint8_t write; +}; + +#define MPTIO_READ_CFG_HEADER32 _IOWR('M', 100, struct mpt_cfg_page_req32) +#define MPTIO_READ_CFG_PAGE32 _IOWR('M', 101, struct mpt_cfg_page_req32) +#define MPTIO_READ_EXT_CFG_HEADER32 _IOWR('M', 102, struct mpt_ext_cfg_page_req32) +#define MPTIO_READ_EXT_CFG_PAGE32 _IOWR('M', 103, struct mpt_ext_cfg_page_req32) +#define MPTIO_WRITE_CFG_PAGE32 _IOWR('M', 104, struct mpt_cfg_page_req32) +#define MPTIO_RAID_ACTION32 _IOWR('M', 105, struct mpt_raid_action32) +#endif + +#endif /* !_MPT_IOCTL_H_ */ diff -r f47e9457a7b8 src/sys/sys/mutex.h --- a/src/sys/sys/mutex.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/mutex.h Thu May 29 18:31:44 2008 +0200 @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $ - * $FreeBSD: src/sys/sys/mutex.h,v 1.102 2007/11/19 23:36:47 attilio Exp $ + * $FreeBSD: src/sys/sys/mutex.h,v 1.103 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS_MUTEX_H_ @@ -133,6 +133,8 @@ _thread_lock_flags((tdp), (opt), __FILE__, __LINE__) #define thread_unlock(tdp) \ mtx_unlock_spin((tdp)->td_lock) + +#define mtx_recurse lock_object.lo_data /* * We define our machine-independent (unoptimized) mutex micro-operations diff -r f47e9457a7b8 src/sys/sys/param.h --- a/src/sys/sys/param.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/param.h Thu May 29 18:31:44 2008 +0200 @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)param.h 8.3 (Berkeley) 4/4/95 - * $FreeBSD: src/sys/sys/param.h,v 1.352 2008/04/20 21:25:37 sam Exp $ + * $FreeBSD: src/sys/sys/param.h,v 1.355 2008/05/26 10:45:11 bz Exp $ */ #ifndef _SYS_PARAM_H_ @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800036 /* Master, propagated to newvers */ +#define __FreeBSD_version 800038 /* Master, propagated to newvers */ #ifndef LOCORE #include diff -r f47e9457a7b8 src/sys/sys/pipe.h --- a/src/sys/sys/pipe.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/pipe.h Thu May 29 18:31:44 2008 +0200 @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $FreeBSD: src/sys/sys/pipe.h,v 1.29 2005/01/07 02:29:23 imp Exp $ + * $FreeBSD: src/sys/sys/pipe.h,v 1.30 2008/05/23 11:14:03 kib Exp $ */ #ifndef _SYS_PIPE_H_ @@ -115,6 +115,13 @@ }; /* + * Values for the pipe_present. + */ +#define PIPE_ACTIVE 1 +#define PIPE_CLOSING 2 +#define PIPE_FINALIZED 3 + +/* * Container structure to hold the two pipe endpoints, mutex, and label * pointer. */ diff -r f47e9457a7b8 src/sys/sys/proc.h --- a/src/sys/sys/proc.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/proc.h Thu May 29 18:31:44 2008 +0200 @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.512 2008/04/25 05:18:50 jeff Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.515 2008/05/21 09:31:44 kib Exp $ */ #ifndef _SYS_PROC_H_ @@ -163,6 +163,8 @@ struct trapframe; struct turnstile; struct mqueue_notifier; +struct kdtrace_proc; +struct kdtrace_thread; struct cpuset; /* @@ -229,6 +231,7 @@ u_long td_profil_addr; /* (k) Temporary addr until AST. */ u_int td_profil_ticks; /* (k) Temporary ticks until AST. */ char td_name[MAXCOMLEN + 1]; /* (*) Thread name. */ + struct file *td_fpop; /* (k) file referencing cdev under op */ #define td_endzero td_base_pri /* Copied during fork1() or thread_sched_upcall(). */ @@ -268,6 +271,8 @@ struct kaudit_record *td_ar; /* (k) Active audit record, if any. */ int td_syscalls; /* per-thread syscall count (used by NFS :)) */ struct lpohead td_lprof[2]; /* (a) lock profiling objects. */ + struct kdtrace_thread *td_dtrace; /* (*) DTrace-specific data. */ + int td_errno; /* Error returned by last syscall. */ }; struct mtx *thread_lock_block(struct thread *); @@ -509,6 +514,7 @@ struct pargs *p_args; /* (c) Process arguments. */ rlim_t p_cpulimit; /* (c) Current CPU limit in seconds. */ signed char p_nice; /* (c) Process "nice" value. */ + int p_fibnum; /* in this routing domain XXX MRT */ /* End area that is copied on creation. */ #define p_endcopy p_xstat @@ -525,6 +531,7 @@ struct p_sched *p_sched; /* (*) Scheduler-specific data. */ STAILQ_HEAD(, ktr_request) p_ktr; /* (o) KTR event queue. */ LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/ + struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */ }; #define p_session p_pgrp->pg_session diff -r f47e9457a7b8 src/sys/sys/queue.h --- a/src/sys/sys/queue.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/queue.h Thu May 29 18:31:44 2008 +0200 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 - * $FreeBSD: src/sys/sys/queue.h,v 1.68 2006/10/24 11:20:29 ru Exp $ + * $FreeBSD: src/sys/sys/queue.h,v 1.69 2008/05/22 14:40:03 ed Exp $ */ #ifndef _SYS_QUEUE_H_ @@ -97,6 +97,7 @@ * _INSERT_TAIL - - + + * _CONCAT - - + + * _REMOVE_HEAD + - + - + * _REMOVE_NEXT + - + - * _REMOVE + + + + * */ @@ -195,10 +196,14 @@ struct type *curelm = SLIST_FIRST((head)); \ while (SLIST_NEXT(curelm, field) != (elm)) \ curelm = SLIST_NEXT(curelm, field); \ - SLIST_NEXT(curelm, field) = \ - SLIST_NEXT(SLIST_NEXT(curelm, field), field); \ + SLIST_REMOVE_NEXT(head, curelm, field); \ } \ TRASHIT((elm)->field.sle_next); \ +} while (0) + +#define SLIST_REMOVE_NEXT(head, elm, field) do { \ + SLIST_NEXT(elm, field) = \ + SLIST_NEXT(SLIST_NEXT(elm, field), field); \ } while (0) #define SLIST_REMOVE_HEAD(head, field) do { \ @@ -287,9 +292,7 @@ struct type *curelm = STAILQ_FIRST((head)); \ while (STAILQ_NEXT(curelm, field) != (elm)) \ curelm = STAILQ_NEXT(curelm, field); \ - if ((STAILQ_NEXT(curelm, field) = \ - STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\ - (head)->stqh_last = &STAILQ_NEXT((curelm), field);\ + STAILQ_REMOVE_NEXT(head, curelm, field); \ } \ TRASHIT((elm)->field.stqe_next); \ } while (0) @@ -298,6 +301,12 @@ if ((STAILQ_FIRST((head)) = \ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + +#define STAILQ_REMOVE_NEXT(head, elm, field) do { \ + if ((STAILQ_NEXT(elm, field) = \ + STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) /* diff -r f47e9457a7b8 src/sys/sys/rwlock.h --- a/src/sys/sys/rwlock.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/rwlock.h Thu May 29 18:31:44 2008 +0200 @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/rwlock.h,v 1.18 2008/04/12 12:17:49 kris Exp $ + * $FreeBSD: src/sys/sys/rwlock.h,v 1.19 2008/05/15 20:10:06 attilio Exp $ */ #ifndef _SYS_RWLOCK_H_ @@ -82,6 +82,8 @@ #define RW_DESTROYED (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS) #ifdef _KERNEL + +#define rw_recurse lock_object.lo_data /* Very simple operations on rw_lock. */ diff -r f47e9457a7b8 src/sys/sys/sdt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sys/sys/sdt.h Thu May 29 18:31:44 2008 +0200 @@ -0,0 +1,179 @@ +/*- + * Copyright 2006-2008 John Birrell + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/sdt.h,v 1.1 2008/05/17 02:14:19 jb Exp $ + * + * Statically Defined Tracing (SDT) definitions. + * + */ + +#ifndef _SYS_SDT_H +#define _SYS_SDT_H + +/* Stub these for the time being. */ +#define DTRACE_PROBE(name) +#define DTRACE_PROBE1(name, type1, arg1) +#define DTRACE_PROBE2(name, type1, arg1, type2, arg2) +#define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) +#define DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) + +#ifndef _KERNEL + +/* The promise of things to come. Worlds to explore. People to meet. Things to do. */ + +#else + +#ifndef KDTRACE_HOOKS + +#define SDT_PROVIDER_DEFINE(prov) +#define SDT_PROVIDER_DECLARE(prov) +#define SDT_PROBE_DEFINE(prov, mod, func, name) +#define SDT_PROBE_DECLARE(prov, mod, func, name) +#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) +#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) + +#else + +/* + * This type definition must match that of dtrace_probe. It is defined this + * way to avoid having to rely on CDDL code. + */ +typedef void (*sdt_probe_func_t)(u_int32_t, uintptr_t arg0, uintptr_t arg1, + uintptr_t arg2, uintptr_t arg3, uintptr_t arg4); + +/* + * The hook for the probe function. See kern_sdt.c which defaults this to + * it's own stub. The 'sdt' provider will set it to dtrace_probe when it + * loads. + */ +extern sdt_probe_func_t sdt_probe_func; + +typedef enum { + SDT_UNINIT = 1, + SDT_INIT, +} sdt_state_t; + +struct sdt_probe; +struct sdt_provider; + +struct sdt_argtype { + int ndx; /* Argument index. */ + const char *type; /* Argument type string. */ + TAILQ_ENTRY(sdt_argtype) + argtype_entry; /* Argument type list entry. */ + struct sdt_probe + *probe; /* Ptr to the probe structure. */ +}; + +struct sdt_probe { + int version; /* Set to sizeof(struct sdt_ref). */ + sdt_state_t state; + struct sdt_provider + *prov; /* Ptr to the provider structure. */ + TAILQ_ENTRY(sdt_probe) + probe_entry; /* SDT probe list entry. */ + TAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list; + const char *mod; + const char *func; + const char *name; + id_t id; /* DTrace probe ID. */ + int n_args; /* Number of arguments. */ +}; + +struct sdt_provider { + const char *name; /* Provider name. */ + TAILQ_ENTRY(sdt_provider) + prov_entry; /* SDT provider list entry. */ + TAILQ_HEAD(probe_list_head, sdt_probe) probe_list; + uintptr_t id; /* DTrace provider ID. */ +}; + +#define SDT_PROVIDER_DEFINE(prov) \ + struct sdt_provider sdt_provider_##prov[1] = { \ + { #prov, { NULL, NULL }, { NULL, NULL } } \ + }; \ + SYSINIT(sdt_provider_##prov##_init, SI_SUB_KDTRACE, \ + SI_ORDER_SECOND, sdt_provider_register, \ + sdt_provider_##prov ); \ + SYSUNINIT(sdt_provider_##prov##_uninit, SI_SUB_KDTRACE, \ + SI_ORDER_SECOND, sdt_provider_deregister, \ + sdt_provider_##prov ) + +#define SDT_PROVIDER_DECLARE(prov) \ + extern struct sdt_provider sdt_provider_##prov[1] + +#define SDT_PROBE_DEFINE(prov, mod, func, name) \ + struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = { \ + { sizeof(struct sdt_probe), 0, sdt_provider_##prov, \ + { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0 } \ + }; \ + SYSINIT(sdt_##prov##_##mod##_##func##_##name##_init, SI_SUB_KDTRACE, \ + SI_ORDER_SECOND + 1, sdt_probe_register, \ + sdt_##prov##_##mod##_##func##_##name ); \ + SYSUNINIT(sdt_##prov##_##mod##_##func##_##name##_uninit, \ + SI_SUB_KDTRACE, SI_ORDER_SECOND + 1, sdt_probe_deregister, \ + sdt_##prov##_##mod##_##func##_##name ) + +#define SDT_PROBE_DECLARE(prov, mod, func, name) \ + extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] + +#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ + if (sdt_##prov##_##mod##_##func##_##name->id) \ + (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ + (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ + (uintptr_t) arg3, (uintptr_t) arg4) + +#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) \ + struct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1] \ + = { { num, type, { NULL, NULL }, \ + sdt_##prov##_##mod##_##func##_##name } \ + }; \ + SYSINIT(sdt_##prov##_##mod##_##func##_##name##num##_init, \ + SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_register, \ + sdt_##prov##_##mod##_##func##_##name##num ); \ + SYSUNINIT(sdt_##prov##_##mod##_##func##_##name##num##_uninit, \ + SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister, \ + sdt_##prov##_##mod##_##func##_##name##num ) + +typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); +typedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *); +typedef int (*sdt_provider_listall_func_t)(struct sdt_provider *, void *); + +void sdt_argtype_deregister(void *); +void sdt_argtype_register(void *); +void sdt_probe_deregister(void *); +void sdt_probe_register(void *); +void sdt_provider_deregister(void *); +void sdt_provider_register(void *); +void sdt_probe_stub(u_int32_t, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, + uintptr_t arg3, uintptr_t arg4); +int sdt_argtype_listall(struct sdt_probe *, sdt_argtype_listall_func_t, void *); +int sdt_probe_listall(struct sdt_provider *, sdt_probe_listall_func_t, void *); +int sdt_provider_listall(sdt_provider_listall_func_t,void *); + +#endif /* KDTRACE_HOOKS */ + +#endif /* _KERNEL */ + +#endif /* _SYS_SDT_H */ diff -r f47e9457a7b8 src/sys/sys/smp.h --- a/src/sys/sys/smp.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/smp.h Thu May 29 18:31:44 2008 +0200 @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $FreeBSD: src/sys/sys/smp.h,v 1.87 2008/03/02 07:58:42 jeff Exp $ + * $FreeBSD: src/sys/sys/smp.h,v 1.88 2008/05/23 04:05:26 jb Exp $ */ #ifndef _SYS_SMP_H_ @@ -123,11 +123,16 @@ int restart_cpus(cpumask_t); int stop_cpus(cpumask_t); void smp_rendezvous_action(void); -void smp_no_rendevous_barrier(void *); extern struct mtx smp_ipi_mtx; #endif /* SMP */ +void smp_no_rendevous_barrier(void *); void smp_rendezvous(void (*)(void *), + void (*)(void *), + void (*)(void *), + void *arg); +void smp_rendezvous_cpus(cpumask_t, + void (*)(void *), void (*)(void *), void (*)(void *), void *arg); diff -r f47e9457a7b8 src/sys/sys/socket.h --- a/src/sys/sys/socket.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/socket.h Thu May 29 18:31:44 2008 +0200 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)socket.h 8.4 (Berkeley) 2/21/94 - * $FreeBSD: src/sys/sys/socket.h,v 1.99 2008/04/14 18:06:04 rrs Exp $ + * $FreeBSD: src/sys/sys/socket.h,v 1.100 2008/05/09 23:02:59 julian Exp $ */ #ifndef _SYS_SOCKET_H_ @@ -138,6 +138,7 @@ #define SO_LISTENQLIMIT 0x1011 /* socket's backlog limit */ #define SO_LISTENQLEN 0x1012 /* socket's complete queue length */ #define SO_LISTENINCQLEN 0x1013 /* socket's incomplete queue length */ +#define SO_SETFIB 0x1014 /* use this FIB to route */ #endif /* diff -r f47e9457a7b8 src/sys/sys/socketvar.h --- a/src/sys/sys/socketvar.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/socketvar.h Thu May 29 18:31:44 2008 +0200 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 - * $FreeBSD: src/sys/sys/socketvar.h,v 1.162 2008/02/04 12:25:13 rwatson Exp $ + * $FreeBSD: src/sys/sys/socketvar.h,v 1.164 2008/05/15 20:18:44 gnn Exp $ */ #ifndef _SYS_SOCKETVAR_H_ @@ -110,6 +110,8 @@ u_int sb_cc; /* (c/d) actual chars in buffer */ u_int sb_hiwat; /* (c/d) max actual char count */ u_int sb_mbcnt; /* (c/d) chars of mbufs used */ + u_int sb_mcnt; /* (c/d) number of mbufs in buffer */ + u_int sb_ccnt; /* (c/d) number of clusters in buffer */ u_int sb_mbmax; /* (c/d) max chars of mbufs to use */ u_int sb_ctl; /* (c/d) non-data chars in buffer */ int sb_lowat; /* (c/d) low water mark */ @@ -146,6 +148,7 @@ void *so_accept_filter_arg; /* saved filter args */ char *so_accept_filter_str; /* saved user args */ } *so_accf; + int so_fibnum; /* routing domain for this socket */ }; #define SB_EMPTY_FIXUP(sb) do { \ @@ -258,6 +261,8 @@ u_int sb_cc; u_int sb_hiwat; u_int sb_mbcnt; + u_int sb_mcnt; + u_int sb_ccnt; u_int sb_mbmax; int sb_lowat; int sb_timeo; @@ -319,8 +324,11 @@ if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \ (sb)->sb_ctl += (m)->m_len; \ (sb)->sb_mbcnt += MSIZE; \ - if ((m)->m_flags & M_EXT) \ + (sb)->sb_mcnt += 1; \ + if ((m)->m_flags & M_EXT) { \ (sb)->sb_mbcnt += (m)->m_ext.ext_size; \ + (sb)->sb_ccnt += 1; \ + } \ } /* adjust counters in sb reflecting freeing of m */ @@ -329,8 +337,11 @@ if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \ (sb)->sb_ctl -= (m)->m_len; \ (sb)->sb_mbcnt -= MSIZE; \ - if ((m)->m_flags & M_EXT) \ + (sb)->sb_mcnt -= 1; \ + if ((m)->m_flags & M_EXT) { \ (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \ + (sb)->sb_ccnt -= 1; \ + } \ if ((sb)->sb_sndptr == (m)) { \ (sb)->sb_sndptr = NULL; \ (sb)->sb_sndptroff = 0; \ diff -r f47e9457a7b8 src/sys/sys/syscall.h --- a/src/sys/sys/syscall.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/syscall.h Thu May 29 18:31:44 2008 +0200 @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.220 2008/03/31 12:11:00 kib Exp $ + * $FreeBSD: src/sys/sys/syscall.h,v 1.221 2008/05/09 23:02:59 julian Exp $ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.242 2008/03/31 12:06:55 kib Exp */ @@ -171,6 +171,7 @@ #define SYS_shmsys 171 #define SYS_freebsd6_pread 173 #define SYS_freebsd6_pwrite 174 +#define SYS_setfib 175 #define SYS_ntp_adjtime 176 #define SYS_setgid 181 #define SYS_setegid 182 diff -r f47e9457a7b8 src/sys/sys/syscall.mk --- a/src/sys/sys/syscall.mk Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/syscall.mk Thu May 29 18:31:44 2008 +0200 @@ -1,6 +1,6 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.175 2008/03/31 12:11:00 kib Exp $ +# $FreeBSD: src/sys/sys/syscall.mk,v 1.176 2008/05/09 23:02:59 julian Exp $ # created from FreeBSD: src/sys/kern/syscalls.master,v 1.242 2008/03/31 12:06:55 kib Exp MIASM = \ syscall.o \ @@ -123,6 +123,7 @@ shmsys.o \ freebsd6_pread.o \ freebsd6_pwrite.o \ + setfib.o \ ntp_adjtime.o \ setgid.o \ setegid.o \ diff -r f47e9457a7b8 src/sys/sys/sysproto.h --- a/src/sys/sys/sysproto.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/sysproto.h Thu May 29 18:31:44 2008 +0200 @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/sysproto.h,v 1.224 2008/03/31 12:11:01 kib Exp $ + * $FreeBSD: src/sys/sys/sysproto.h,v 1.225 2008/05/09 23:03:00 julian Exp $ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.242 2008/03/31 12:06:55 kib Exp */ @@ -554,6 +554,9 @@ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct setfib_args { + char fibnum_l_[PADL_(int)]; int fibnum; char fibnum_r_[PADR_(int)]; }; struct ntp_adjtime_args { char tp_l_[PADL_(struct timex *)]; struct timex * tp; char tp_r_[PADR_(struct timex *)]; @@ -1744,6 +1747,7 @@ int shmsys(struct thread *, struct shmsys_args *); int freebsd6_pread(struct thread *, struct freebsd6_pread_args *); int freebsd6_pwrite(struct thread *, struct freebsd6_pwrite_args *); +int setfib(struct thread *, struct setfib_args *); int ntp_adjtime(struct thread *, struct ntp_adjtime_args *); int setgid(struct thread *, struct setgid_args *); int setegid(struct thread *, struct setegid_args *); @@ -2325,6 +2329,7 @@ #define SYS_AUE_shmsys AUE_SHMSYS #define SYS_AUE_freebsd6_pread AUE_PREAD #define SYS_AUE_freebsd6_pwrite AUE_PWRITE +#define SYS_AUE_setfib AUE_NULL #define SYS_AUE_ntp_adjtime AUE_NTP_ADJTIME #define SYS_AUE_setgid AUE_SETGID #define SYS_AUE_setegid AUE_SETEGID diff -r f47e9457a7b8 src/sys/sys/systm.h --- a/src/sys/sys/systm.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/systm.h Thu May 29 18:31:44 2008 +0200 @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)systm.h 8.7 (Berkeley) 3/29/95 - * $FreeBSD: src/sys/sys/systm.h,v 1.265 2008/03/26 20:09:21 phk Exp $ + * $FreeBSD: src/sys/sys/systm.h,v 1.266 2008/05/18 22:11:47 jb Exp $ */ #ifndef _SYS_SYSTM_H_ @@ -214,12 +214,6 @@ int sysbeep(int hertz, int period); -/* - * Cyclic clock function type definition used to hook the cyclic - * subsystem into the appropriate timer interrupt. - */ -typedef void (*cyclic_clock_func_t)(void); - void hardclock(int usermode, uintfptr_t pc); void hardclock_cpu(int usermode); void softclock(void *); diff -r f47e9457a7b8 src/sys/sys/time.h --- a/src/sys/sys/time.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/time.h Thu May 29 18:31:44 2008 +0200 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 - * $FreeBSD: src/sys/sys/time.h,v 1.77 2008/04/22 19:38:30 phk Exp $ + * $FreeBSD: src/sys/sys/time.h,v 1.78 2008/05/18 22:11:47 jb Exp $ */ #ifndef _SYS_TIME_H_ @@ -312,8 +312,6 @@ void timevaladd(struct timeval *t1, const struct timeval *t2); void timevalsub(struct timeval *t1, const struct timeval *t2); int tvtohz(struct timeval *tv); -uint64_t dtrace_gethrtime(void); -uint64_t dtrace_gethrestime(void); #else /* !_KERNEL */ #include diff -r f47e9457a7b8 src/sys/sys/tty.h --- a/src/sys/sys/tty.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/tty.h Thu May 29 18:31:44 2008 +0200 @@ -40,30 +40,18 @@ * SUCH DAMAGE. * * @(#)tty.h 8.6 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/sys/tty.h,v 1.102 2007/12/16 06:12:53 jeff Exp $ + * $FreeBSD: src/sys/sys/tty.h,v 1.103 2008/05/23 16:06:35 ed Exp $ */ #ifndef _SYS_TTY_H_ #define _SYS_TTY_H_ +#include #include #include #include #include #include - -/* - * Clists are character lists, which is a variable length linked list - * of cblocks, with a count of the number of characters in the list. - */ -struct clist { - int c_cc; /* Number of characters in the clist. */ - int c_cbcount; /* Number of cblocks. */ - int c_cbmax; /* Max # cblocks allowed for this clist. */ - int c_cbreserved; /* # cblocks reserved for this clist. */ - char *c_cf; /* Pointer to the first cblock. */ - char *c_cl; /* Pointer to the last cblock. */ -}; struct tty; struct pps_state; @@ -313,25 +301,12 @@ #define ISINIT(dev) (minor(dev) & MINOR_INIT) #define ISLOCK(dev) (minor(dev) & MINOR_LOCK) -extern struct msgbuf consmsgbuf; /* Message buffer for constty. */ -extern struct tty *constty; /* Temporary virtual console. */ extern long tk_cancc; extern long tk_nin; extern long tk_nout; extern long tk_rawcc; -int b_to_q(char *cp, int cc, struct clist *q); -void catq(struct clist *from, struct clist *to); -void clist_alloc_cblocks(struct clist *q, int ccmax, int ccres); -void clist_free_cblocks(struct clist *q); -void constty_set(struct tty *tp); -void constty_clear(void); -int getc(struct clist *q); -void ndflush(struct clist *q, int cc); -char *nextc(struct clist *q, char *cp, int *c); void nottystop(struct tty *tp, int rw); -int putc(int c, struct clist *q); -int q_to_b(struct clist *q, char *cp, int cc); void termioschars(struct termios *t); int tputchar(int c, struct tty *tp); int ttcompat(struct tty *tp, u_long com, caddr_t data, int flag); @@ -367,7 +342,6 @@ int ttyrel(struct tty *tp); int ttysleep(struct tty *tp, void *chan, int pri, char *wmesg, int timo); int ttywait(struct tty *tp); -int unputc(struct clist *q); static __inline int tt_open(struct tty *t, struct cdev *c) diff -r f47e9457a7b8 src/sys/sys/umtx.h --- a/src/sys/sys/umtx.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/umtx.h Thu May 29 18:31:44 2008 +0200 @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/umtx.h,v 1.31 2008/04/02 04:08:36 davidxu Exp $ + * $FreeBSD: src/sys/sys/umtx.h,v 1.32 2008/04/29 03:48:48 davidxu Exp $ * */ @@ -99,7 +99,9 @@ #define UMTX_OP_RW_RDLOCK 12 #define UMTX_OP_RW_WRLOCK 13 #define UMTX_OP_RW_UNLOCK 14 -#define UMTX_OP_MAX 15 +#define UMTX_OP_WAIT_UINT_PRIVATE 15 +#define UMTX_OP_WAKE_PRIVATE 16 +#define UMTX_OP_MAX 17 /* flags for UMTX_OP_CV_WAIT */ #define UMTX_CHECK_UNPARKING 0x01 @@ -190,11 +192,11 @@ struct umtx_q *umtxq_alloc(void); void umtxq_free(struct umtx_q *); -int kern_umtx_wake(struct thread *td, void *uaddr, int n_wake); -void umtx_pi_adjust(struct thread *td, u_char oldpri); -void umtx_thread_init(struct thread *td); -void umtx_thread_fini(struct thread *td); -void umtx_thread_alloc(struct thread *td); -void umtx_thread_exit(struct thread *td); +int kern_umtx_wake(struct thread *, void *, int, int); +void umtx_pi_adjust(struct thread *, u_char); +void umtx_thread_init(struct thread *); +void umtx_thread_fini(struct thread *); +void umtx_thread_alloc(struct thread *); +void umtx_thread_exit(struct thread *); #endif /* !_KERNEL */ #endif /* !_SYS_UMTX_H_ */ diff -r f47e9457a7b8 src/sys/sys/user.h --- a/src/sys/sys/user.h Sun Apr 27 22:16:23 2008 +0200 +++ b/src/sys/sys/user.h Thu May 29 18:31:44 2008 +0200 @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * @(#)user.h 8.2 (Berkeley) 9/23/93 - * $FreeBSD: src/sys/sys/user.h,v 1.74 2008/02/09 05:16:25 marcus Exp $ + * $FreeBSD: src/sys/sys/user.h,v 1.75 2008/04/29 11:17:45 gonzo Exp $ */ #ifndef _SYS_USER_H_ @@ -98,6 +98,9 @@ #endif #ifdef __i386__ #define KINFO_PROC_SIZE 768 +#endif +#ifdef __mips__ +#define KINFO_PROC_SIZE 816 #endif #ifdef __powerpc__ #define KINFO_PROC_SIZE 768