From owner-p4-projects@FreeBSD.ORG Thu Apr 19 21:54:51 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8E17216A404; Thu, 19 Apr 2007 21:54:51 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A0B916A402 for ; Thu, 19 Apr 2007 21:54:51 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 3A66B13C483 for ; Thu, 19 Apr 2007 21:54:51 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l3JLspCI031664 for ; Thu, 19 Apr 2007 21:54:51 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l3JLsmHo031661 for perforce@freebsd.org; Thu, 19 Apr 2007 21:54:48 GMT (envelope-from scottl@freebsd.org) Date: Thu, 19 Apr 2007 21:54:48 GMT Message-Id: <200704192154.l3JLsmHo031661@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 118434 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2007 21:54:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=118434 Change 118434 by scottl@scottl-x64 on 2007/04/19 21:54:24 IFC Affected files ... .. //depot/projects/scottl-camlock/src/sys/amd64/amd64/busdma_machdep.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/amd64/linux32/linux32_dummy.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/amd64/linux32/linux32_machdep.c#11 integrate .. //depot/projects/scottl-camlock/src/sys/bsm/audit.h#8 integrate .. //depot/projects/scottl-camlock/src/sys/bsm/audit_internal.h#6 integrate .. //depot/projects/scottl-camlock/src/sys/bsm/audit_kevents.h#8 integrate .. //depot/projects/scottl-camlock/src/sys/bsm/audit_record.h#7 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_sim.c#11 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_sim.h#10 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#59 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_periph.h#10 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#33 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#24 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pt.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sa.c#14 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sg.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/compat/opensolaris/kern/opensolaris_vfs.c#2 integrate .. //depot/projects/scottl-camlock/src/sys/contrib/opensolaris/uts/common/fs/dnlc.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/contrib/opensolaris/uts/common/fs/zfs/spa.c#3 integrate .. //depot/projects/scottl-camlock/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#3 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7770.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.h#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#18 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.h#12 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_pci.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.h#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_inline.h#4 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#16 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.h#13 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_pci.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.h#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ath/if_ath.c#17 integrate .. //depot/projects/scottl-camlock/src/sys/dev/hwpmc/hwpmc_logging.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/dev/hwpmc/hwpmc_mod.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/hwpmc/hwpmc_piv.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/dev/isp/isp_freebsd.c#21 integrate .. //depot/projects/scottl-camlock/src/sys/dev/mpt/mpt_cam.c#24 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ral/rt2560.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/re/if_re.c#18 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/isa/ad1816.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/isa/ess.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/isa/mss.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/isa/sb16.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/isa/sb8.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/als4000.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/atiixp.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/au88x0.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/aureal.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/cmi.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/cs4281.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/csapcm.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/ds1.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/emu10k1.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/emu10kx-pcm.c#4 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/es137x.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/fm801.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/hda/hdac.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/ich.c#15 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/maestro3.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/solo.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/t4dwave.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/via8233.c#12 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/via82c686.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pci/vibes.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/ac97.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/ac97.h#5 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/ac97_patch.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/ac97_patch.h#6 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/buffer.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/buffer.h#7 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/pcm/sound.h#13 integrate .. //depot/projects/scottl-camlock/src/sys/dev/sound/sbus/cs4231.c#5 integrate .. //depot/projects/scottl-camlock/src/sys/dev/usb/if_ural.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/dev/wi/if_wi.c#12 integrate .. //depot/projects/scottl-camlock/src/sys/i386/i386/bios.c#5 integrate .. //depot/projects/scottl-camlock/src/sys/i386/i386/busdma_machdep.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/i386/i386/identcpu.c#14 integrate .. //depot/projects/scottl-camlock/src/sys/isa/isa_common.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/kern/kern_intr.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/kern/subr_witness.c#15 integrate .. //depot/projects/scottl-camlock/src/sys/kern/uipc_syscalls.c#18 integrate .. //depot/projects/scottl-camlock/src/sys/kern/vfs_mount.c#20 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/ip_fw2.c#18 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_indata.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_input.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_lock_bsd.h#4 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_output.c#7 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_pcb.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_structs.h#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_uio.h#7 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_usrreq.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctp_var.h#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctputil.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/sctputil.h#5 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp_subr.c#14 integrate .. //depot/projects/scottl-camlock/src/sys/netinet/tcp_syncache.c#17 integrate .. //depot/projects/scottl-camlock/src/sys/pci/if_rlreg.h#13 integrate .. //depot/projects/scottl-camlock/src/sys/pci/if_vr.c#9 integrate .. //depot/projects/scottl-camlock/src/sys/pci/if_vrreg.h#9 integrate .. //depot/projects/scottl-camlock/src/sys/pci/intpm.c#6 integrate .. //depot/projects/scottl-camlock/src/sys/security/audit/audit_bsm_token.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/sys/interrupt.h#9 integrate .. //depot/projects/scottl-camlock/src/sys/sys/mount.h#15 integrate .. //depot/projects/scottl-camlock/src/sys/sys/socket.h#9 integrate .. //depot/projects/scottl-camlock/src/sys/vm/vm_contig.c#12 integrate .. //depot/projects/scottl-camlock/src/sys/vm/vm_param.h#4 integrate Differences ... ==== //depot/projects/scottl-camlock/src/sys/amd64/amd64/busdma_machdep.c#10 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.79 2007/03/06 18:28:42 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.80 2007/04/17 21:05:34 jhb Exp $"); #include #include @@ -48,6 +48,7 @@ #include #include #include +#include #define MAX_BPAGES 8192 @@ -522,6 +523,9 @@ } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } + if (flags & BUS_DMA_NOCACHE) + pmap_change_attr((vm_offset_t)*vaddr, dmat->maxsize, + PAT_UNCACHEABLE); CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (0); @@ -540,6 +544,7 @@ */ if (map != NULL) panic("bus_dmamem_free: Invalid map freed\n"); + pmap_change_attr((vm_offset_t)vaddr, dmat->maxsize, PAT_WRITE_BACK); if ((dmat->maxsize <= PAGE_SIZE) && (dmat->alignment < dmat->maxsize) && dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) ==== //depot/projects/scottl-camlock/src/sys/amd64/linux32/linux32_dummy.c#8 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_dummy.c,v 1.8 2007/03/29 02:11:46 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_dummy.c,v 1.9 2007/04/18 18:08:12 jkim Exp $"); #include #include @@ -64,7 +64,6 @@ DUMMY(mincore); DUMMY(fadvise64); DUMMY(ptrace); -DUMMY(settimeofday); DUMMY(lookup_dcookie); DUMMY(epoll_create); DUMMY(epoll_ctl); ==== //depot/projects/scottl-camlock/src/sys/amd64/linux32/linux32_machdep.c#11 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.39 2007/03/30 17:27:13 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_machdep.c,v 1.42 2007/04/18 20:12:05 jkim Exp $"); #include #include @@ -252,7 +252,7 @@ if (iovcnt > UIO_MAXIOV) return (EINVAL); iovlen = iovcnt * sizeof(struct iovec); - uio = malloc(iovlen + sizeof *uio, M_IOV, M_WAITOK); + uio = malloc(iovlen + sizeof(*uio), M_IOV, M_WAITOK); iov = (struct iovec *)(uio + 1); for (i = 0; i < iovcnt; i++) { error = copyin(&iovp[i], &iov32, sizeof(struct iovec32)); @@ -526,7 +526,9 @@ td2 = FIRST_THREAD_IN_PROC(p2); - /* make it run */ + /* + * Make this runnable after we are finished with it. + */ mtx_lock_spin(&sched_lock); TD_SET_CAN_RUN(td2); sched_add(td2, SRQ_BORING); @@ -572,8 +574,8 @@ /* * XXX: In Linux, sharing of fs info (chroot/cwd/umask) * and open files is independant. In FreeBSD, its in one - * structure but in reality it does not make any problems - * because both of these flags are set at once usually. + * structure but in reality it does not cause any problems + * because both of these flags are usually set together. */ if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS))) ff |= RFFDG; @@ -660,15 +662,15 @@ if (args->flags & LINUX_CLONE_SETTLS) { struct user_segment_descriptor sd; struct l_user_desc info; - int a[2]; + int a[2]; - error = copyin((void *)td->td_frame->tf_rsi, &info, + error = copyin((void *)td->td_frame->tf_rsi, &info, sizeof(struct l_user_desc)); if (error) { printf(LMSG("copyin failed!")); } else { /* We might copy out the entry_number as GUGS32_SEL. */ - info.entry_number = GUGS32_SEL; + info.entry_number = GUGS32_SEL; error = copyout(&info, (void *)td->td_frame->tf_rsi, sizeof(struct l_user_desc)); if (error) @@ -871,7 +873,7 @@ * * Our mmap with MAP_STACK takes addr as the maximum * downsize limit on BOS, and as len the max size of - * the region. It them maps the top SGROWSIZ bytes, + * the region. It then maps the top SGROWSIZ bytes, * and auto grows the region down, up to the limit * in addr. * @@ -1167,17 +1169,44 @@ microtime(&atv); atv32.tv_sec = atv.tv_sec; atv32.tv_usec = atv.tv_usec; - error = copyout(&atv32, uap->tp, sizeof (atv32)); + error = copyout(&atv32, uap->tp, sizeof(atv32)); } if (error == 0 && uap->tzp != NULL) { rtz.tz_minuteswest = tz_minuteswest; rtz.tz_dsttime = tz_dsttime; - error = copyout(&rtz, uap->tzp, sizeof (rtz)); + error = copyout(&rtz, uap->tzp, sizeof(rtz)); } return (error); } int +linux_settimeofday(struct thread *td, struct linux_settimeofday_args *uap) +{ + l_timeval atv32; + struct timeval atv, *tvp; + struct timezone atz, *tzp; + int error; + + if (uap->tp) { + error = copyin(uap->tp, &atv32, sizeof(atv32)); + if (error) + return (error); + atv.tv_sec = atv32.tv_sec; + atv.tv_usec = atv32.tv_usec; + tvp = &atv; + } else + tvp = NULL; + if (uap->tzp) { + error = copyin(uap->tzp, &atz, sizeof(atz)); + if (error) + return (error); + tzp = &atz; + } else + tzp = NULL; + return (kern_settimeofday(td, tvp, tzp)); +} + +int linux_getrusage(struct thread *td, struct linux_getrusage_args *uap) { struct l_rusage s32; @@ -1242,7 +1271,7 @@ #ifdef DEBUG if (ldebug(set_thread_area)) - printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, " + printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, " "%i, %i, %i"), info.entry_number, info.base_addr, info.limit, info.seg_32bit, info.contents, info.read_exec_only, info.limit_in_pages, @@ -1261,9 +1290,10 @@ * The tls_array[] is used only in [gs]et_thread_area() syscalls and * for loading the GDT descriptors. We use just one GDT descriptor * for TLS, so we will load just one. - * XXX: This doesnt work when user-space process tries to use more + * + * XXX: This doesn't work when a user space process tries to use more * than one TLS segment. Comment in the Linux source says wine might - * do that. + * do this. */ /* @@ -1284,8 +1314,9 @@ /* * We have to copy out the GDT entry we use. - * XXX: What if userspace program does not check return value and - * tries to use 6, 7 or 8? + * + * XXX: What if a user space program does not check the return value + * and tries to use 6, 7 or 8? */ error = copyout(&info, args->desc, sizeof(struct l_user_desc)); if (error) ==== //depot/projects/scottl-camlock/src/sys/bsm/audit.h#8 (text+ko) ==== @@ -30,8 +30,8 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/scottl-camlock/src/sys/bsm/audit.h#7 $ - * $FreeBSD: src/sys/bsm/audit.h,v 1.6 2006/09/21 07:27:02 rwatson Exp $ + * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit.h#36 + * $FreeBSD: src/sys/bsm/audit.h,v 1.8 2007/04/17 12:27:08 rwatson Exp $ */ #ifndef _BSM_AUDIT_H ==== //depot/projects/scottl-camlock/src/sys/bsm/audit_internal.h#6 (text) ==== @@ -34,8 +34,8 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_internal.h#14 $ - * $FreeBSD: src/sys/bsm/audit_internal.h,v 1.5 2006/09/21 07:27:02 rwatson Exp $ + * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_internal.h#16 + * $FreeBSD: src/sys/bsm/audit_internal.h,v 1.7 2007/04/17 12:27:08 rwatson Exp $ */ #ifndef _AUDIT_INTERNAL_H ==== //depot/projects/scottl-camlock/src/sys/bsm/audit_kevents.h#8 (text+ko) ==== @@ -30,8 +30,8 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/scottl-camlock/src/sys/bsm/audit_kevents.h#7 $ - * $FreeBSD: src/sys/bsm/audit_kevents.h,v 1.9 2006/09/25 12:22:07 rwatson Exp $ + * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_kevents.h#32 + * $FreeBSD: src/sys/bsm/audit_kevents.h,v 1.11 2007/04/17 12:27:08 rwatson Exp $ */ #ifndef _BSM_AUDIT_KEVENTS_H_ @@ -475,6 +475,28 @@ #define AUE_READDIR 43118 /* Linux. */ #define AUE_IOPL 43119 /* Linux. */ #define AUE_VM86 43120 /* Linux. */ +#define AUE_MAC_GET_PROC 43121 /* FreeBSD. */ +#define AUE_MAC_SET_PROC 43122 /* FreeBSD. */ +#define AUE_MAC_GET_FD 43123 /* FreeBSD. */ +#define AUE_MAC_GET_FILE 43124 /* FreeBSD. */ +#define AUE_MAC_SET_FD 43125 /* FreeBSD. */ +#define AUE_MAC_SET_FILE 43126 /* FreeBSD. */ +#define AUE_MAC_SYSCALL 43127 /* FreeBSD. */ +#define AUE_MAC_GET_PID 43128 /* FreeBSD. */ +#define AUE_MAC_GET_LINK 43129 /* FreeBSD. */ +#define AUE_MAC_SET_LINK 43130 /* FreeBSD. */ +#define AUE_MAC_EXECVE 43131 /* FreeBSD. */ +#define AUE_GETPATH_FROMFD 43132 /* FreeBSD. */ +#define AUE_GETPATH_FROMADDR 43133 /* FreeBSD. */ +#define AUE_MQ_OPEN 43134 /* FreeBSD. */ +#define AUE_MQ_SETATTR 43135 /* FreeBSD. */ +#define AUE_MQ_TIMEDRECEIVE 43136 /* FreeBSD. */ +#define AUE_MQ_TIMEDSEND 43137 /* FreeBSD. */ +#define AUE_MQ_NOTIFY 43138 /* FreeBSD. */ +#define AUE_MQ_UNLINK 43139 /* FreeBSD. */ +#define AUE_LISTEN 43140 /* FreeBSD/Darwin/Linux. */ +#define AUE_MLOCKALL 43141 /* FreeBSD. */ +#define AUE_MUNLOCKALL 43142 /* FreeBSD. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the @@ -572,16 +594,13 @@ #define AUE_GETSOCKOPT AUE_NULL #define AUE_GTSOCKOPT AUE_GETSOCKOPT /* XXX: Typo in Darwin. */ #define AUE_ISSETUGID AUE_NULL -#define AUE_LISTEN AUE_NULL #define AUE_LSTATV AUE_NULL #define AUE_MADVISE AUE_NULL #define AUE_MINCORE AUE_NULL #define AUE_MKCOMPLEX AUE_NULL -#define AUE_MLOCKALL AUE_NULL #define AUE_MODWATCH AUE_NULL #define AUE_MSGCL AUE_NULL #define AUE_MSYNC AUE_NULL -#define AUE_MUNLOCKALL AUE_NULL #define AUE_PREAD AUE_NULL #define AUE_PWRITE AUE_NULL #define AUE_PREADV AUE_NULL ==== //depot/projects/scottl-camlock/src/sys/bsm/audit_record.h#7 (text) ==== @@ -30,8 +30,8 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_record.h#21 $ - * $FreeBSD: src/sys/bsm/audit_record.h,v 1.6 2006/09/21 07:27:02 rwatson Exp $ + * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_record.h#24 + * $FreeBSD: src/sys/bsm/audit_record.h,v 1.9 2007/04/17 12:27:08 rwatson Exp $ */ #ifndef _BSM_AUDIT_RECORD_H_ @@ -86,6 +86,7 @@ /* XXXRW: Additional X11 tokens not defined? */ #define AUT_CMD 0x51 #define AUT_EXIT 0x52 +#define AUT_ZONENAME 0x60 /* XXXRW: OpenBSM AUT_HOST 0x70? */ #define AUT_ARG64 0x71 #define AUT_RETURN64 0x72 @@ -247,6 +248,8 @@ token_t *au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, struct timeval tm); +token_t *au_to_header64_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, + struct timeval tm); #if !defined(KERNEL) && !defined(_KERNEL) token_t *au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod); token_t *au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod); @@ -329,6 +332,7 @@ token_t *au_to_text(char *text); token_t *au_to_kevent(struct kevent *kev); token_t *au_to_trailer(int rec_size); +token_t *au_to_zonename(char *zonename); __END_DECLS ==== //depot/projects/scottl-camlock/src/sys/cam/cam_sim.c#11 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/cam_sim.c,v 1.10 2007/04/15 08:49:09 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/cam_sim.c,v 1.11 2007/04/19 14:28:43 scottl Exp $"); #include #include @@ -95,6 +95,7 @@ } SLIST_INIT(&sim->ccb_freeq); + TAILQ_INIT(&sim->sim_doneq); return (sim); } ==== //depot/projects/scottl-camlock/src/sys/cam/cam_sim.h#10 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/cam_sim.h,v 1.7 2007/04/15 08:49:09 scottl Exp $ + * $FreeBSD: src/sys/cam/cam_sim.h,v 1.8 2007/04/19 14:28:43 scottl Exp $ */ #ifndef _CAM_CAM_SIM_H @@ -92,6 +92,8 @@ const char *sim_name; void *softc; struct mtx *mtx; + TAILQ_HEAD(, ccb_hdr) sim_doneq; + TAILQ_ENTRY(cam_sim) links; u_int32_t path_id;/* The Boot device may set this to 0? */ u_int32_t unit_number; u_int32_t bus_id; @@ -100,6 +102,7 @@ u_int32_t flags; #define CAM_SIM_REL_TIMEOUT_PENDING 0x01 #define CAM_SIM_MPSAFE 0x02 +#define CAM_SIM_ON_DONEQ 0x04 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#59 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.177 2007/04/16 19:55:36 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.180 2007/04/19 14:45:37 scottl Exp $"); #include #include @@ -665,8 +665,9 @@ /* Queues for our software interrupt handler */ typedef TAILQ_HEAD(cam_isrq, ccb_hdr) cam_isrq_t; -static cam_isrq_t cam_bioq; -static struct mtx cam_bioq_lock; +typedef TAILQ_HEAD(cam_simq, cam_sim) cam_simq_t; +static cam_simq_t cam_simq; +static struct mtx cam_simq_lock; /* Pointers to software interrupt handlers */ static void *cambio_ih; @@ -821,6 +822,7 @@ static void xptaction(struct cam_sim *sim, union ccb *work_ccb); static void xptpoll(struct cam_sim *sim); static void camisr(void *); +static void camisr_runqueue(void *); static dev_match_ret xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, struct cam_eb *bus); static dev_match_ret xptdevicematch(struct dev_match_pattern *patterns, @@ -1072,7 +1074,7 @@ case XPT_ENG_INQ: case XPT_SCAN_LUN: - ccb = xpt_alloc_ccb(bus->sim); + ccb = xpt_alloc_ccb(); CAM_SIM_LOCK(bus->sim); @@ -1472,12 +1474,12 @@ cam_status status; TAILQ_INIT(&xsoftc.xpt_busses); - TAILQ_INIT(&cam_bioq); + TAILQ_INIT(&cam_simq); TAILQ_INIT(&xsoftc.ccb_scanq); STAILQ_INIT(&xsoftc.highpowerq); xsoftc.num_highpower = CAM_MAX_HIGHPOWER; - mtx_init(&cam_bioq_lock, "CAM BIOQ lock", NULL, MTX_DEF); + mtx_init(&cam_simq_lock, "CAM SIMQ lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_topo_lock, "XPT topology lock", NULL, MTX_DEF); @@ -1551,7 +1553,7 @@ printf("xpt_init: failed to create rescan thread\n"); } /* Install our software interrupt handlers */ - swi_add(NULL, "cambio", camisr, &cam_bioq, SWI_CAMBIO, INTR_MPSAFE, &cambio_ih); + swi_add(NULL, "cambio", camisr, NULL, SWI_CAMBIO, INTR_MPSAFE, &cambio_ih); return (0); } @@ -3639,7 +3641,7 @@ dev->ccbq.dev_openings < 0) && (--timeout > 0)) { DELAY(1000); (*(sim->sim_poll))(sim); - camisr(&cam_bioq); + camisr_runqueue(&sim->sim_doneq); } dev->ccbq.devq_openings++; @@ -3649,7 +3651,7 @@ xpt_action(start_ccb); while(--timeout > 0) { (*(sim->sim_poll))(sim); - camisr(&cam_bioq); + camisr_runqueue(&sim->sim_doneq); if ((start_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) break; @@ -4490,6 +4492,7 @@ /* The SIM may be gone, so use a dummy SIM for any stray operations. */ devq = bus_path.bus->sim->devq; + ccbsim = bus_path.bus->sim; bus_path.bus->sim = &cam_dead_sim; /* Execute any pending operations now. */ @@ -4504,7 +4507,6 @@ devq->active_dev = device; cam_ccbq_remove_ccb(&device->ccbq, work_ccb); cam_ccbq_send_ccb(&device->ccbq, work_ccb); - ccbsim = work_ccb->ccb_h.path->bus->sim; (*(ccbsim->sim_action))(ccbsim, work_ccb); } @@ -4516,8 +4518,8 @@ } /* Make sure all completed CCBs are processed. */ - while (!TAILQ_EMPTY(&cam_bioq)) { - camisr(&cam_bioq); + while (!TAILQ_EMPTY(&ccbsim->sim_doneq)) { + camisr_runqueue(&ccbsim->sim_doneq); /* Repeat the async's for the benefit of any new devices. */ xpt_async(AC_LOST_DEVICE, &bus_path, NULL); @@ -4528,10 +4530,6 @@ xpt_release_bus(bus_path.bus); xpt_release_path(&bus_path); - /* Recheck for more completed CCBs. */ - while (!TAILQ_EMPTY(&cam_bioq)) - camisr(&cam_bioq); - return (CAM_REQ_CMP); } @@ -4949,6 +4947,7 @@ void xpt_done(union ccb *done_ccb) { + struct cam_sim *sim; int s; s = splcam(); @@ -4959,13 +4958,19 @@ * Queue up the request for handling by our SWI handler * any of the "non-immediate" type of ccbs. */ + sim = done_ccb->ccb_h.path->bus->sim; switch (done_ccb->ccb_h.path->periph->type) { case CAM_PERIPH_BIO: - mtx_lock(&cam_bioq_lock); - TAILQ_INSERT_TAIL(&cam_bioq, &done_ccb->ccb_h, + TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - mtx_unlock(&cam_bioq_lock); + if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) { + mtx_lock(&cam_simq_lock); + TAILQ_INSERT_TAIL(&cam_simq, sim, + links); + sim->flags |= CAM_SIM_ON_DONEQ; + mtx_unlock(&cam_simq_lock); + } if ((done_ccb->ccb_h.path->periph->flags & CAM_PERIPH_POLLED) == 0) swi_sched(cambio_ih, 0); @@ -4979,26 +4984,20 @@ } union ccb * -xpt_alloc_ccb(struct cam_sim *sim) +xpt_alloc_ccb() { union ccb *new_ccb; - new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_WAITOK); - if ((sim != NULL) && ((sim->flags & CAM_SIM_MPSAFE) == 0)) { - callout_handle_init(&new_ccb->ccb_h.timeout_ch); - } + new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_ZERO|M_WAITOK); return (new_ccb); } union ccb * -xpt_alloc_ccb_nowait(struct cam_sim *sim) +xpt_alloc_ccb_nowait() { union ccb *new_ccb; - new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_NOWAIT); - if ((sim != NULL) && ((sim->flags & CAM_SIM_MPSAFE) == 0)) { - callout_handle_init(&new_ccb->ccb_h.timeout_ch); - } + new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_ZERO|M_NOWAIT); return (new_ccb); } @@ -5029,11 +5028,13 @@ s = splsoftcam(); sim = device->sim; if ((new_ccb = (union ccb *)SLIST_FIRST(&sim->ccb_freeq)) == NULL) { - new_ccb = xpt_alloc_ccb_nowait(sim); + new_ccb = xpt_alloc_ccb_nowait(); if (new_ccb == NULL) { splx(s); return (NULL); } + if ((sim->flags & CAM_SIM_MPSAFE) == 0) + callout_handle_init(&new_ccb->ccb_h.timeout_ch); SLIST_INSERT_HEAD(&sim->ccb_freeq, &new_ccb->ccb_h, xpt_links.sle); sim->ccb_count++; @@ -5353,7 +5354,12 @@ u_int initiator_id; /* Find out the characteristics of the bus */ - work_ccb = xpt_alloc_ccb_nowait(periph->sim); + work_ccb = xpt_alloc_ccb_nowait(); + if (work_ccb == NULL) { + request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_done(request_ccb); + return; + } xpt_setup_ccb(&work_ccb->ccb_h, request_ccb->ccb_h.path, request_ccb->ccb_h.pinfo.priority); work_ccb->ccb_h.func_code = XPT_PATH_INQ; @@ -5418,7 +5424,14 @@ xpt_done(request_ccb); break; } - work_ccb = xpt_alloc_ccb_nowait(periph->sim); + work_ccb = xpt_alloc_ccb_nowait(); + if (work_ccb == NULL) { + free(scan_info, M_TEMP); + xpt_free_path(path); + request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_done(request_ccb); + break; + } xpt_setup_ccb(&work_ccb->ccb_h, path, request_ccb->ccb_h.pinfo.priority); work_ccb->ccb_h.func_code = XPT_SCAN_LUN; @@ -6970,7 +6983,12 @@ cam_status status; int can_negotiate; - work_ccb = xpt_alloc_ccb_nowait(bus->sim); + work_ccb = xpt_alloc_ccb_nowait(); + if (work_ccb == NULL) { + busses_to_config--; + xpt_finishconfig(xpt_periph, NULL); + return(0); + } if ((status = xpt_create_path(&path, xpt_periph, bus->path_id, CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD)) !=CAM_REQ_CMP){ @@ -7218,31 +7236,36 @@ } static void -camisr(void *V_queue) +camisr(void *dummy) { - cam_isrq_t *oqueue = V_queue; - cam_isrq_t queue; - int s; - struct ccb_hdr *ccb_h; - struct cam_sim *sim; + cam_simq_t queue; + struct cam_sim *sim; - /* - * Transfer the ccb_bioq list to a temporary list so we can operate - * on it without needing to lock/unlock on every loop. The concat - * function with re-init the real list for us. - */ - s = splcam(); - mtx_lock(&cam_bioq_lock); + mtx_lock(&cam_simq_lock); TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, oqueue, sim_links.tqe); - mtx_unlock(&cam_bioq_lock); + TAILQ_CONCAT(&queue, &cam_simq, links); + mtx_unlock(&cam_simq_lock); + + while ((sim = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, sim, links); + mtx_lock(sim->mtx); + sim->flags &= ~CAM_SIM_ON_DONEQ; + camisr_runqueue(&sim->sim_doneq); + mtx_unlock(sim->mtx); + } +} + +static void +camisr_runqueue(void *V_queue) +{ + cam_isrq_t *queue = V_queue; + struct ccb_hdr *ccb_h; - while ((ccb_h = TAILQ_FIRST(&queue)) != NULL) { + while ((ccb_h = TAILQ_FIRST(queue)) != NULL) { int runq; - TAILQ_REMOVE(&queue, ccb_h, sim_links.tqe); + TAILQ_REMOVE(queue, ccb_h, sim_links.tqe); ccb_h->pinfo.index = CAM_UNQUEUED_INDEX; - splx(s); CAM_DEBUG(ccb_h->path, CAM_DEBUG_TRACE, ("camisr\n")); @@ -7277,22 +7300,17 @@ mtx_unlock(&xsoftc.xpt_lock); } - sim = ccb_h->path->bus->sim; - mtx_lock(sim->mtx); - if ((ccb_h->func_code & XPT_FC_USER_CCB) == 0) { struct cam_ed *dev; dev = ccb_h->path->device; - s = splcam(); cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); if (!SIM_DEAD(ccb_h->path->bus->sim)) { ccb_h->path->bus->sim->devq->send_active--; ccb_h->path->bus->sim->devq->send_openings++; } - splx(s); if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ) @@ -7333,12 +7351,7 @@ /* Call the peripheral driver's callback */ (*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h); - - /* Raise IPL for while test */ - mtx_unlock(sim->mtx); - s = splcam(); } - splx(s); } static void ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_periph.h#10 (text+ko) ==== @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/cam_xpt_periph.h,v 1.6 2007/04/15 08:49:09 scottl Exp $ + * $FreeBSD: src/sys/cam/cam_xpt_periph.h,v 1.7 2007/04/18 04:58:52 scottl Exp $ */ #ifndef _CAM_CAM_XPT_PERIPH_H @@ -38,8 +38,8 @@ /* Functions accessed by the peripheral drivers */ #ifdef _KERNEL void xpt_polled_action(union ccb *ccb); -union ccb *xpt_alloc_ccb(struct cam_sim *sim); -union ccb *xpt_alloc_ccb_nowait(struct cam_sim *sim); +union ccb *xpt_alloc_ccb(void); +union ccb *xpt_alloc_ccb_nowait(void); void xpt_free_ccb(union ccb *free_ccb); void xpt_release_ccb(union ccb *released_ccb); void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority); ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#33 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.205 2007/04/16 19:41:14 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.206 2007/04/18 05:14:16 scottl Exp $"); #include @@ -775,10 +775,13 @@ if (periph == NULL) return (ENXIO); softc = (struct da_softc *)periph->softc; + cam_periph_lock(periph); secsize = softc->params.secsize; - if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) + if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { + cam_periph_unlock(periph); return (ENXIO); + } if (length > 0) { periph->flags |= CAM_PERIPH_POLLED; @@ -810,6 +813,7 @@ periph->flags |= CAM_PERIPH_POLLED; return(EIO); } + cam_periph_unlock(periph); return(0); } @@ -851,6 +855,7 @@ } } periph->flags &= ~CAM_PERIPH_POLLED; + cam_periph_unlock(periph); return (0); } @@ -1977,6 +1982,8 @@ TAILQ_FOREACH(periph, &dadriver.units, unit_links) { union ccb ccb; + + cam_periph_lock(periph); softc = (struct da_softc *)periph->softc; /* @@ -2027,7 +2034,7 @@ /*reduction*/0, /*timeout*/0, /*getcount_only*/0); - + cam_periph_unlock(periph); } } ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#13 (text+ko) ==== @@ -2,7 +2,7 @@ /* $NetBSD$ */ #include -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_low.c,v 1.27 2007/04/15 08:49:10 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_low.c,v 1.28 2007/04/18 04:58:52 scottl Exp $"); #define SCSI_LOW_STATICS #define SCSI_LOW_DEBUG @@ -966,7 +966,7 @@ struct scsi_low_softc *slp; { struct cam_path *path; - union ccb *ccb = xpt_alloc_ccb(NULL); + union ccb *ccb = xpt_alloc_ccb(); cam_status status; bzero(ccb, sizeof(union ccb)); ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#24 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.46 2007/04/15 08:49:10 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.47 2007/04/18 04:58:52 scottl Exp $"); #include #include @@ -490,7 +490,7 @@ inccb->ccb_h.pinfo.priority); ccb_malloced = 0; } else { - ccb = xpt_alloc_ccb_nowait(periph->sim); + ccb = xpt_alloc_ccb_nowait(); if (ccb != NULL) xpt_setup_ccb(&ccb->ccb_h, periph->path, ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pt.c#9 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.45 2007/04/15 08:49:10 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_pt.c,v 1.46 2007/04/19 18:14:33 scottl Exp $"); #include #include @@ -303,9 +303,11 @@ SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI, DEVSTAT_PRIORITY_OTHER); + cam_periph_unlock(periph); softc->dev = make_dev(&pt_cdevsw, periph->unit_number, UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); + cam_periph_lock(periph); softc->dev->si_drv1 = periph; /* ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sa.c#14 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.108 2007/04/15 08:49:10 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.109 2007/04/19 18:14:33 scottl Exp $"); #include #include @@ -1521,6 +1521,7 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<<