您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CTR4函数代码示例

51自学网 2021-06-01 20:06:46
  C++
这篇教程C++ CTR4函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CTR4函数的典型用法代码示例。如果您正苦于以下问题:C++ CTR4函数的具体用法?C++ CTR4怎么用?C++ CTR4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CTR4函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: c4iw_mmap

static int c4iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma){	int len = vma->vm_end - vma->vm_start;	u32 key = vma->vm_pgoff << PAGE_SHIFT;	struct c4iw_rdev *rdev;	int ret = 0;	struct c4iw_mm_entry *mm;	struct c4iw_ucontext *ucontext;	u64 addr, paddr;	u64 va_regs_res = 0, va_udbs_res = 0;	u64 len_regs_res = 0, len_udbs_res = 0;	CTR3(KTR_IW_CXGBE, "%s:1 ctx %p vma %p", __func__, context, vma);	CTR4(KTR_IW_CXGBE, "%s:1a pgoff 0x%lx key 0x%x len %d", __func__,	    vma->vm_pgoff, key, len);	if (vma->vm_start & (PAGE_SIZE-1)) {		CTR3(KTR_IW_CXGBE, "%s:2 unaligned vm_start %u vma %p",		    __func__, vma->vm_start, vma);		return -EINVAL;	}	rdev = &(to_c4iw_dev(context->device)->rdev);	ucontext = to_c4iw_ucontext(context);	mm = remove_mmap(ucontext, key, len);	if (!mm) {		CTR4(KTR_IW_CXGBE, "%s:3 ucontext %p key %u len %u", __func__,		    ucontext, key, len);		return -EINVAL;	}	addr = mm->addr;	kfree(mm);	va_regs_res = (u64)rman_get_virtual(rdev->adap->regs_res);	len_regs_res = (u64)rman_get_size(rdev->adap->regs_res);	va_udbs_res = (u64)rman_get_virtual(rdev->adap->udbs_res);	len_udbs_res = (u64)rman_get_size(rdev->adap->udbs_res);	CTR6(KTR_IW_CXGBE,	    "%s:4 addr %p, masync region %p:%p, udb region %p:%p", __func__,	    addr, va_regs_res, va_regs_res+len_regs_res, va_udbs_res,	    va_udbs_res+len_udbs_res);	if (addr >= va_regs_res && addr < va_regs_res + len_regs_res) {		CTR4(KTR_IW_CXGBE, "%s:5 MA_SYNC addr %p region %p, reglen %u",		    __func__, addr, va_regs_res, len_regs_res);		/*		 * MA_SYNC register...		 */		paddr = vtophys(addr);		vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);		ret = io_remap_pfn_range(vma, vma->vm_start,				paddr >> PAGE_SHIFT,				len, vma->vm_page_prot);	} else {
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:58,


示例2: pmap_kenter_attr

voidpmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t ma){	CTR4(KTR_PMAP, "%s(%#x, %#x, %#x)", __func__, va, pa, ma);	MMU_KENTER_ATTR(mmu_obj, va, pa, ma);}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例3: pmap_change_wiring

voidpmap_change_wiring(pmap_t pmap, vm_offset_t va, boolean_t wired){	CTR4(KTR_PMAP, "%s(%p, %#x, %u)", __func__, pmap, va, wired);	MMU_CHANGE_WIRING(mmu_obj, pmap, va, wired);}
开发者ID:rchander,项目名称:freebsd,代码行数:7,


示例4: pmap_dumpsys_map

vm_offset_tpmap_dumpsys_map(struct pmap_md *md, vm_size_t ofs, vm_size_t *sz){	CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, md, ofs, *sz);	return (MMU_DUMPSYS_MAP(mmu_obj, md, ofs, sz));}
开发者ID:JabirTech,项目名称:Source,代码行数:7,


示例5: pmap_dumpsys_unmap

voidpmap_dumpsys_unmap(struct pmap_md *md, vm_size_t ofs, vm_offset_t va){	CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, md, ofs, va);	return (MMU_DUMPSYS_UNMAP(mmu_obj, md, ofs, va));}
开发者ID:JabirTech,项目名称:Source,代码行数:7,


示例6: pmap_unwire

voidpmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end){	CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pmap, start, end);	MMU_UNWIRE(mmu_obj, pmap, start, end);}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例7: pmap_sync_icache

voidpmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz){ 	CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pm, va, sz);	return (MMU_SYNC_ICACHE(mmu_obj, pm, va, sz));}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例8: do_rx_iscsi_hdr

static intdo_rx_iscsi_hdr(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m){	struct adapter *sc = iq->adapter;	struct cpl_iscsi_hdr *cpl = mtod(m, struct cpl_iscsi_hdr *);	u_int tid = GET_TID(cpl);	struct toepcb *toep = lookup_tid(sc, tid);	struct icl_pdu *ip;	struct icl_cxgbei_pdu *icp;	M_ASSERTPKTHDR(m);	ip = icl_cxgbei_new_pdu(M_NOWAIT);	if (ip == NULL)		CXGBE_UNIMPLEMENTED("PDU allocation failure");	icp = ip_to_icp(ip);	bcopy(mtod(m, caddr_t) + sizeof(*cpl), icp->ip.ip_bhs, sizeof(struct	    iscsi_bhs));	icp->pdu_seq = ntohl(cpl->seq);	icp->pdu_flags = SBUF_ULP_FLAG_HDR_RCVD;	/* This is the start of a new PDU.  There should be no old state. */	MPASS(toep->ulpcb2 == NULL);	toep->ulpcb2 = icp;#if 0	CTR4(KTR_CXGBE, "%s: tid %u, cpl->len hlen %u, m->m_len hlen %u",	    __func__, tid, ntohs(cpl->len), m->m_len);#endif	m_freem(m);	return (0);}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:33,


示例9: do_rx_iscsi_data

static intdo_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m){	struct adapter *sc = iq->adapter;	struct cpl_iscsi_data *cpl =  mtod(m, struct cpl_iscsi_data *);	u_int tid = GET_TID(cpl);	struct toepcb *toep = lookup_tid(sc, tid);	struct icl_cxgbei_pdu *icp = toep->ulpcb2;	M_ASSERTPKTHDR(m);	/* Must already have received the header (but not the data). */	MPASS(icp != NULL);	MPASS(icp->pdu_flags == SBUF_ULP_FLAG_HDR_RCVD);	MPASS(icp->ip.ip_data_mbuf == NULL);	MPASS(icp->ip.ip_data_len == 0);	m_adj(m, sizeof(*cpl));	icp->pdu_flags |= SBUF_ULP_FLAG_DATA_RCVD;	icp->ip.ip_data_mbuf = m;	icp->ip.ip_data_len = m->m_pkthdr.len;#if 0	CTR4(KTR_CXGBE, "%s: tid %u, cpl->len dlen %u, m->m_len dlen %u",	    __func__, tid, ntohs(cpl->len), m->m_len);#endif	return (0);}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:30,


示例10: dumpsys_unmap_chunk

voiddumpsys_unmap_chunk(vm_paddr_t pa, size_t sz, void *va){	CTR4(KTR_PMAP, "%s(%#jx, %#zx, %p)", __func__, (uintmax_t)pa, sz, va);	return (MMU_DUMPSYS_UNMAP(mmu_obj, pa, sz, va));}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例11: pmap_zero_page_area

voidpmap_zero_page_area(vm_page_t m, int off, int size){	CTR4(KTR_PMAP, "%s(%p, %d, %d)", __func__, m, off, size);	MMU_ZERO_PAGE_AREA(mmu_obj, m, off, size);}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例12: pmap_mapdev_attr

void *pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t attr){	CTR4(KTR_PMAP, "%s(%#x, %#x, %#x)", __func__, pa, size, attr);	return (MMU_MAPDEV_ATTR(mmu_obj, pa, size, attr));}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例13: pmap_remove

voidpmap_remove(pmap_t pmap, vm_offset_t start, vm_offset_t end){	CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pmap, start, end);	MMU_REMOVE(mmu_obj, pmap, start, end);}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例14: pmap_qenter

voidpmap_qenter(vm_offset_t start, vm_page_t *m, int count){	CTR4(KTR_PMAP, "%s(%#x, %p, %d)", __func__, start, m, count);	MMU_QENTER(mmu_obj, start, m, count);}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例15: pmap_extract_and_hold

vm_page_tpmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot){	CTR4(KTR_PMAP, "%s(%p, %#x, %#x)", __func__, pmap, va, prot);	return (MMU_EXTRACT_AND_HOLD(mmu_obj, pmap, va, prot));}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,


示例16: cpu_set_fork_handler

/* * Intercept the return address from a freshly forked process that has NOT * been scheduled yet. * * This is needed to make kernel threads stay in kernel mode. */voidcpu_set_fork_handler(struct thread *td, void (*func)(void *), void *arg){	struct callframe *cf;	CTR4(KTR_PROC, "%s called with td=%p func=%p arg=%p",	    __func__, td, func, arg);	cf = (struct callframe *)td->td_pcb->pcb_sp;	cf->cf_func = (register_t)func;	cf->cf_arg0 = (register_t)arg;}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:19,


示例17: fork_exit

/* * Handle the return of a child process from fork1().  This function * is called from the MD fork_trampoline() entry point. */voidfork_exit(void (*callout)(void *, struct trapframe *), void *arg,    struct trapframe *frame){	struct proc *p;	struct thread *td;	struct thread *dtd;	td = curthread;	p = td->td_proc;	KASSERT(p->p_state == PRS_NORMAL, ("executing process is still new"));	CTR4(KTR_PROC, "fork_exit: new thread %p (td_sched %p, pid %d, %s)",	    td, td_get_sched(td), p->p_pid, td->td_name);	sched_fork_exit(td);	/*	* Processes normally resume in mi_switch() after being	* cpu_switch()'ed to, but when children start up they arrive here	* instead, so we must do much the same things as mi_switch() would.	*/	if ((dtd = PCPU_GET(deadthread))) {		PCPU_SET(deadthread, NULL);		thread_stash(dtd);	}	thread_unlock(td);	/*	 * cpu_fork_kthread_handler intercepts this function call to	 * have this call a non-return function to stay in kernel mode.	 * initproc has its own fork handler, but it does return.	 */	KASSERT(callout != NULL, ("NULL callout in fork_exit"));	callout(arg, frame);	/*	 * Check if a kernel thread misbehaved and returned from its main	 * function.	 */	if (p->p_flag & P_KPROC) {		printf("Kernel thread /"%s/" (pid %d) exited prematurely./n",		    td->td_name, p->p_pid);		kthread_exit();	}	mtx_assert(&Giant, MA_NOTOWNED);	if (p->p_sysent->sv_schedtail != NULL)		(p->p_sysent->sv_schedtail)(td);	td->td_pflags &= ~TDP_FORKING;}
开发者ID:mulichao,项目名称:freebsd,代码行数:54,


示例18: sema_init

voidsema_init(struct sema *sema, int value, const char *description){	KASSERT((value >= 0), ("%s(): negative value/n", __func__));	bzero(sema, sizeof(*sema));	mtx_init(&sema->sema_mtx, description, "sema backing lock",	    MTX_DEF | MTX_NOWITNESS | MTX_QUIET);	cv_init(&sema->sema_cv, description);	sema->sema_value = value;	CTR4(KTR_LOCK, "%s(%p, %d, /"%s/")", __func__, sema, value, description);}
开发者ID:MarginC,项目名称:kame,代码行数:14,


示例19: alloc_host_sq

static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq){	sq->queue = contigmalloc(sq->memsize, M_DEVBUF, M_NOWAIT, 0ul, ~0ul,	    4096, 0);	if (sq->queue)		sq->dma_addr = vtophys(sq->queue);	else		return -ENOMEM;	sq->phys_addr = vtophys(sq->queue);	pci_unmap_addr_set(sq, mapping, sq->dma_addr);	CTR4(KTR_IW_CXGBE, "%s sq %p dma_addr %p phys_addr %p", __func__,	    sq->queue, sq->dma_addr, sq->phys_addr);	return 0;}
开发者ID:Lxg1582,项目名称:freebsd,代码行数:15,


示例20: call_trapsignal

static __inline voidcall_trapsignal(struct thread *td, int sig, int code, vm_offset_t addr){	ksiginfo_t ksi;	CTR4(KTR_TRAP, "%s: addr: %#x, sig: %d, code: %d",	   __func__, addr, sig, code);	/*	 * TODO: some info would be nice to know	 * if we are serving data or prefetch abort.	 */	ksiginfo_init_trap(&ksi);	ksi.ksi_signo = sig;	ksi.ksi_code = code;	ksi.ksi_addr = (void *)addr;	trapsignal(td, &ksi);}
开发者ID:nbsoftwarecsjava,项目名称:embedded,代码行数:19,


示例21: post_qp_event

static void post_qp_event(struct c4iw_dev *dev, struct c4iw_cq *chp,			  struct c4iw_qp *qhp,			  struct t4_cqe *err_cqe,			  enum ib_event_type ib_event){	struct ib_event event;	struct c4iw_qp_attributes attrs;	unsigned long flag;	if ((qhp->attr.state == C4IW_QP_STATE_ERROR) ||	    (qhp->attr.state == C4IW_QP_STATE_TERMINATE)) {		CTR4(KTR_IW_CXGBE, "%s AE received after RTS - "		     "qp state %d qpid 0x%x status 0x%x", __func__,		     qhp->attr.state, qhp->wq.sq.qid, CQE_STATUS(err_cqe));		return;	}	printf("AE qpid 0x%x opcode %d status 0x%x "	       "type %d wrid.hi 0x%x wrid.lo 0x%x/n",	       CQE_QPID(err_cqe), CQE_OPCODE(err_cqe),	       CQE_STATUS(err_cqe), CQE_TYPE(err_cqe),	       CQE_WRID_HI(err_cqe), CQE_WRID_LOW(err_cqe));	if (qhp->attr.state == C4IW_QP_STATE_RTS) {		attrs.next_state = C4IW_QP_STATE_TERMINATE;		c4iw_modify_qp(qhp->rhp, qhp, C4IW_QP_ATTR_NEXT_STATE,			       &attrs, 0);	}	event.event = ib_event;	event.device = chp->ibcq.device;	if (ib_event == IB_EVENT_CQ_ERR)		event.element.cq = &chp->ibcq;	else		event.element.qp = &qhp->ibqp;	if (qhp->ibqp.event_handler)		(*qhp->ibqp.event_handler)(&event, qhp->ibqp.qp_context);	spin_lock_irqsave(&chp->comp_handler_lock, flag);	(*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context);	spin_unlock_irqrestore(&chp->comp_handler_lock, flag);}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:42,


示例22: assign_rxopt

/* * Called when a connection is established to translate the TCP options * reported by HW to FreeBSD's native format. */static voidassign_rxopt(struct tcpcb *tp, unsigned int opt){	struct toepcb *toep = tp->t_toe;	struct inpcb *inp = tp->t_inpcb;	struct adapter *sc = td_adapter(toep->td);	int n;	INP_LOCK_ASSERT(inp);	if (inp->inp_inc.inc_flags & INC_ISIPV6)		n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);	else		n = sizeof(struct ip) + sizeof(struct tcphdr);	tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;	CTR4(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u)", __func__, toep->tid,	    G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)]);	if (G_TCPOPT_TSTAMP(opt)) {		tp->t_flags |= TF_RCVD_TSTMP;	/* timestamps ok */		tp->ts_recent = 0;		/* hmmm */		tp->ts_recent_age = tcp_ts_getsbintime();		tp->t_maxseg -= TCPOLEN_TSTAMP_APPA;	}	if (G_TCPOPT_SACK(opt))		tp->t_flags |= TF_SACK_PERMIT;	/* should already be set */	else		tp->t_flags &= ~TF_SACK_PERMIT;	/* sack disallowed by peer */	if (G_TCPOPT_WSCALE_OK(opt))		tp->t_flags |= TF_RCVD_SCALE;	/* Doing window scaling? */	if ((tp->t_flags & (TF_RCVD_SCALE | TF_REQ_SCALE)) ==	    (TF_RCVD_SCALE | TF_REQ_SCALE)) {		tp->rcv_scale = tp->request_r_scale;		tp->snd_scale = G_TCPOPT_SND_WSCALE(opt);	}}
开发者ID:outbackdingo,项目名称:uBSD,代码行数:45,


示例23: t3_ddp_copy

intt3_ddp_copy(const struct mbuf *m, int offset, struct uio *uio, int len){	int resid_init, err;	struct ddp_gather_list *gl = (struct ddp_gather_list *)m->m_ddp_gl;		resid_init = uio->uio_resid;		if (!gl->dgl_pages)		panic("pages not set/n");	CTR4(KTR_TOM, "t3_ddp_copy: offset=%d dgl_offset=%d cur_offset=%d len=%d",	    offset, gl->dgl_offset, m->m_cur_offset, len);	offset += gl->dgl_offset + m->m_cur_offset;	KASSERT(len <= gl->dgl_length,	    ("len=%d > dgl_length=%d in ddp_copy/n", len, gl->dgl_length));	err = uiomove_fromphys(gl->dgl_pages, offset, len, uio);	return (err);}
开发者ID:syedzubairahmed,项目名称:FreeBSD-7.3-dyntick,代码行数:21,


示例24: cxio_dump_pbl

void cxio_dump_pbl(struct cxio_rdev *rdev, uint32_t pbl_addr, uint32_t len, u8 shift){	struct ch_mem_range *m;	u64 *data;	int rc;	int size, npages;	shift += 12;	npages = (len + (1ULL << shift) - 1) >> shift;	size = npages * sizeof(u64);	m = kmalloc(sizeof(*m) + size, M_NOWAIT);	if (!m) {		CTR1(KTR_IW_CXGB, "%s couldn't allocate memory.", __FUNCTION__);		return;	}	m->mem_id = MEM_PMRX;	m->addr = pbl_addr;	m->len = size;	CTR4(KTR_IW_CXGB, "%s PBL addr 0x%x len %d depth %d",		__FUNCTION__, m->addr, m->len, npages);	rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);	if (rc) {		CTR2(KTR_IW_CXGB, "%s toectl returned error %d", __FUNCTION__, rc);		free(m, M_DEVBUF);		return;	}	data = (u64 *)m->buf;	while (size > 0) {		CTR2(KTR_IW_CXGB, "PBL %08x: %016llx", m->addr, (unsigned long long) *data);		size -= 8;		data++;		m->addr += 8;	}	free(m, M_DEVBUF);}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:37,


示例25: _rw_runlock_cookie

void_rw_runlock_cookie(volatile uintptr_t *c, const char *file, int line){	struct rwlock *rw;	struct turnstile *ts;	uintptr_t x, v, queue;	if (SCHEDULER_STOPPED())		return;	rw = rwlock2rw(c);	KASSERT(rw->rw_lock != RW_DESTROYED,	    ("rw_runlock() of destroyed rwlock @ %s:%d", file, line));	__rw_assert(c, RA_RLOCKED, file, line);	WITNESS_UNLOCK(&rw->lock_object, 0, file, line);	LOCK_LOG_LOCK("RUNLOCK", &rw->lock_object, 0, 0, file, line);	/* TODO: drop "owner of record" here. */	for (;;) {		/*		 * See if there is more than one read lock held.  If so,		 * just drop one and return.		 */		x = rw->rw_lock;		if (RW_READERS(x) > 1) {			if (atomic_cmpset_rel_ptr(&rw->rw_lock, x,			    x - RW_ONE_READER)) {				if (LOCK_LOG_TEST(&rw->lock_object, 0))					CTR4(KTR_LOCK,					    "%s: %p succeeded %p -> %p",					    __func__, rw, (void *)x,					    (void *)(x - RW_ONE_READER));				break;			}			continue;		}		/*		 * If there aren't any waiters for a write lock, then try		 * to drop it quickly.		 */		if (!(x & RW_LOCK_WAITERS)) {			MPASS((x & ~RW_LOCK_WRITE_SPINNER) ==			    RW_READERS_LOCK(1));			if (atomic_cmpset_rel_ptr(&rw->rw_lock, x,			    RW_UNLOCKED)) {				if (LOCK_LOG_TEST(&rw->lock_object, 0))					CTR2(KTR_LOCK, "%s: %p last succeeded",					    __func__, rw);				break;			}			continue;		}		/*		 * Ok, we know we have waiters and we think we are the		 * last reader, so grab the turnstile lock.		 */		turnstile_chain_lock(&rw->lock_object);		v = rw->rw_lock & (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER);		MPASS(v & RW_LOCK_WAITERS);		/*		 * Try to drop our lock leaving the lock in a unlocked		 * state.		 *		 * If you wanted to do explicit lock handoff you'd have to		 * do it here.  You'd also want to use turnstile_signal()		 * and you'd have to handle the race where a higher		 * priority thread blocks on the write lock before the		 * thread you wakeup actually runs and have the new thread		 * "steal" the lock.  For now it's a lot simpler to just		 * wakeup all of the waiters.		 *		 * As above, if we fail, then another thread might have		 * acquired a read lock, so drop the turnstile lock and		 * restart.		 */		x = RW_UNLOCKED;		if (v & RW_LOCK_WRITE_WAITERS) {			queue = TS_EXCLUSIVE_QUEUE;			x |= (v & RW_LOCK_READ_WAITERS);		} else			queue = TS_SHARED_QUEUE;		if (!atomic_cmpset_rel_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | v,		    x)) {			turnstile_chain_unlock(&rw->lock_object);			continue;		}		if (LOCK_LOG_TEST(&rw->lock_object, 0))			CTR2(KTR_LOCK, "%s: %p last succeeded with waiters",			    __func__, rw);		/*		 * Ok.  The lock is released and all that's left is to		 * wake up the waiters.  Note that the lock might not be		 * free anymore, but in that case the writers will just		 * block again if they run before the new lock holder(s)		 * release the lock.		 *///.........这里部分代码省略.........
开发者ID:jmgurney,项目名称:freebsd,代码行数:101,


示例26: __rw_rlock

void__rw_rlock(volatile uintptr_t *c, const char *file, int line){	struct rwlock *rw;	struct turnstile *ts;#ifdef ADAPTIVE_RWLOCKS	volatile struct thread *owner;	int spintries = 0;	int i;#endif#ifdef LOCK_PROFILING	uint64_t waittime = 0;	int contested = 0;#endif	uintptr_t v;#ifdef KDTRACE_HOOKS	uintptr_t state;	uint64_t spin_cnt = 0;	uint64_t sleep_cnt = 0;	int64_t sleep_time = 0;	int64_t all_time = 0;#endif	if (SCHEDULER_STOPPED())		return;	rw = rwlock2rw(c);	KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread),	    ("rw_rlock() by idle thread %p on rwlock %s @ %s:%d",	    curthread, rw->lock_object.lo_name, file, line));	KASSERT(rw->rw_lock != RW_DESTROYED,	    ("rw_rlock() of destroyed rwlock @ %s:%d", file, line));	KASSERT(rw_wowner(rw) != curthread,	    ("rw_rlock: wlock already held for %s @ %s:%d",	    rw->lock_object.lo_name, file, line));	WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL);#ifdef KDTRACE_HOOKS	all_time -= lockstat_nsecs(&rw->lock_object);	state = rw->rw_lock;#endif	for (;;) {		/*		 * Handle the easy case.  If no other thread has a write		 * lock, then try to bump up the count of read locks.  Note		 * that we have to preserve the current state of the		 * RW_LOCK_WRITE_WAITERS flag.  If we fail to acquire a		 * read lock, then rw_lock must have changed, so restart		 * the loop.  Note that this handles the case of a		 * completely unlocked rwlock since such a lock is encoded		 * as a read lock with no waiters.		 */		v = rw->rw_lock;		if (RW_CAN_READ(v)) {			/*			 * The RW_LOCK_READ_WAITERS flag should only be set			 * if the lock has been unlocked and write waiters			 * were present.			 */			if (atomic_cmpset_acq_ptr(&rw->rw_lock, v,			    v + RW_ONE_READER)) {				if (LOCK_LOG_TEST(&rw->lock_object, 0))					CTR4(KTR_LOCK,					    "%s: %p succeed %p -> %p", __func__,					    rw, (void *)v,					    (void *)(v + RW_ONE_READER));				break;			}			continue;		}#ifdef KDTRACE_HOOKS		spin_cnt++;#endif#ifdef HWPMC_HOOKS		PMC_SOFT_CALL( , , lock, failed);#endif		lock_profile_obtain_lock_failed(&rw->lock_object,		    &contested, &waittime);#ifdef ADAPTIVE_RWLOCKS		/*		 * If the owner is running on another CPU, spin until		 * the owner stops running or the state of the lock		 * changes.		 */		if ((v & RW_LOCK_READ) == 0) {			owner = (struct thread *)RW_OWNER(v);			if (TD_IS_RUNNING(owner)) {				if (LOCK_LOG_TEST(&rw->lock_object, 0))					CTR3(KTR_LOCK,					    "%s: spinning on %p held by %p",					    __func__, rw, owner);				KTR_STATE1(KTR_SCHED, "thread",				    sched_tdname(curthread), "spinning",				    "lockname:/"%s/"", rw->lock_object.lo_name);				while ((struct thread*)RW_OWNER(rw->rw_lock) ==				    owner && TD_IS_RUNNING(owner)) {					cpu_spinwait();#ifdef KDTRACE_HOOKS//.........这里部分代码省略.........
开发者ID:jmgurney,项目名称:freebsd,代码行数:101,


示例27: do_rx_iscsi_ddp

static intdo_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m){	struct adapter *sc = iq->adapter;	struct cxgbei_data *ci = sc->iscsi_ulp_softc;	const struct cpl_rx_data_ddp *cpl = (const void *)(rss + 1);	u_int tid = GET_TID(cpl);	struct toepcb *toep = lookup_tid(sc, tid);	struct inpcb *inp = toep->inp;	struct socket *so;	struct sockbuf *sb;	struct tcpcb *tp;	struct icl_cxgbei_conn *icc;	struct icl_conn *ic;	struct icl_cxgbei_pdu *icp = toep->ulpcb2;	struct icl_pdu *ip;	u_int pdu_len, val;	MPASS(m == NULL);	/* Must already be assembling a PDU. */	MPASS(icp != NULL);	MPASS(icp->icp_flags & ICPF_RX_HDR);	/* Data is optional. */	MPASS((icp->icp_flags & ICPF_RX_STATUS) == 0);	pdu_len = be16toh(cpl->len);	/* includes everything. */	val = be32toh(cpl->ddpvld);#if 0	CTR5(KTR_CXGBE,	    "%s: tid %u, cpl->len %u, ddpvld 0x%08x, icp_flags 0x%08x",	    __func__, tid, pdu_len, val, icp->icp_flags);#endif	icp->icp_flags |= ICPF_RX_STATUS;	ip = &icp->ip;	if (val & F_DDP_PADDING_ERR)		icp->icp_flags |= ICPF_PAD_ERR;	if (val & F_DDP_HDRCRC_ERR)		icp->icp_flags |= ICPF_HCRC_ERR;	if (val & F_DDP_DATACRC_ERR)		icp->icp_flags |= ICPF_DCRC_ERR;	if (val & F_DDP_PDU && ip->ip_data_mbuf == NULL) {		MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0);		MPASS(ip->ip_data_len > 0);		icp->icp_flags |= ICPF_RX_DDP;		counter_u64_add(ci->ddp_pdus, 1);		counter_u64_add(ci->ddp_bytes, ip->ip_data_len);	}	INP_WLOCK(inp);	if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) {		CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x",		    __func__, tid, pdu_len, inp->inp_flags);		INP_WUNLOCK(inp);		icl_cxgbei_conn_pdu_free(NULL, ip);#ifdef INVARIANTS		toep->ulpcb2 = NULL;#endif		return (0);	}	tp = intotcpcb(inp);	MPASS(icp->icp_seq == tp->rcv_nxt);	MPASS(tp->rcv_wnd >= pdu_len);	tp->rcv_nxt += pdu_len;	tp->rcv_wnd -= pdu_len;	tp->t_rcvtime = ticks;	/* update rx credits */	toep->rx_credits += pdu_len;	t4_rcvd(&toep->td->tod, tp);	/* XXX: sc->tom_softc.tod */	so = inp->inp_socket;	sb = &so->so_rcv;	SOCKBUF_LOCK(sb);	icc = toep->ulpcb;	if (__predict_false(icc == NULL || sb->sb_state & SBS_CANTRCVMORE)) {		CTR5(KTR_CXGBE,		    "%s: tid %u, excess rx (%d bytes), icc %p, sb_state 0x%x",		    __func__, tid, pdu_len, icc, sb->sb_state);		SOCKBUF_UNLOCK(sb);		INP_WUNLOCK(inp);		INP_INFO_RLOCK(&V_tcbinfo);		INP_WLOCK(inp);		tp = tcp_drop(tp, ECONNRESET);		if (tp)			INP_WUNLOCK(inp);		INP_INFO_RUNLOCK(&V_tcbinfo);		icl_cxgbei_conn_pdu_free(NULL, ip);#ifdef INVARIANTS		toep->ulpcb2 = NULL;#endif		return (0);	}	MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE);	ic = &icc->ic;//.........这里部分代码省略.........
开发者ID:2trill2spill,项目名称:freebsd,代码行数:101,


示例28: sendsig

voidsendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask){	struct thread *td;	struct proc *p;	struct trapframe *tf;	struct sigframe *fp, frame;	struct sigacts *psp;	int code, onstack, sig;	td = curthread;	p = td->td_proc;	PROC_LOCK_ASSERT(p, MA_OWNED);	sig = ksi->ksi_signo;	code = ksi->ksi_code;	psp = p->p_sigacts;	mtx_assert(&psp->ps_mtx, MA_OWNED);	tf = td->td_frame;	onstack = sigonstack(tf->tf_sp);	CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm,	    catcher, sig);	/* Allocate and validate space for the signal handler context. */	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !onstack &&	    SIGISMEMBER(psp->ps_sigonstack, sig)) {		fp = (struct sigframe *)(td->td_sigstk.ss_sp +		    td->td_sigstk.ss_size);#if defined(COMPAT_43)		td->td_sigstk.ss_flags |= SS_ONSTACK;#endif	} else {		fp = (struct sigframe *)td->td_frame->tf_sp;	}	/* Make room, keeping the stack aligned */	fp--;	fp = (struct sigframe *)STACKALIGN(fp);	/* Fill in the frame to copy out */	get_mcontext(td, &frame.sf_uc.uc_mcontext, 0);	get_fpcontext(td, &frame.sf_uc.uc_mcontext);	frame.sf_si = ksi->ksi_info;	frame.sf_uc.uc_sigmask = *mask;	frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ?	    ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE;	frame.sf_uc.uc_stack = td->td_sigstk;	mtx_unlock(&psp->ps_mtx);	PROC_UNLOCK(td->td_proc);	/* Copy the sigframe out to the user's stack. */	if (copyout(&frame, fp, sizeof(*fp)) != 0) {		/* Process has trashed its stack. Kill it. */		CTR2(KTR_SIG, "sendsig: sigexit td=%p fp=%p", td, fp);		PROC_LOCK(p);		sigexit(td, SIGILL);	}	tf->tf_x[0]= sig;	tf->tf_x[1] = (register_t)&fp->sf_si;	tf->tf_x[2] = (register_t)&fp->sf_uc;	tf->tf_elr = (register_t)catcher;	tf->tf_sp = (register_t)fp;	tf->tf_lr = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode));	CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_elr,	    tf->tf_sp);	PROC_LOCK(p);	mtx_lock(&psp->ps_mtx);}
开发者ID:ralphost,项目名称:NextBSD,代码行数:74,



注:本文中的CTR4函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CTRACE函数代码示例
C++ CTR3函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。