本文整理汇总了C++中qreply函数的典型用法代码示例。如果您正苦于以下问题:C++ qreply函数的具体用法?C++ qreply怎么用?C++ qreply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qreply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_dump
void handle_dump(queue_t *q, mblk_t *mp)
{
struct ctrl_args *ctrl_args;
struct ctrl_device *ctrlfd;
minor_t minor;
int sum;
unsigned char *buf;
if ((mp->b_cont = allocb(MAXPRINTBUF, BPRI_MED)) == NULL) {
printf("handle_ctrl: out of message blocks\n");
qreply(q, mp);
return;
}
buf = DB_BASE(mp->b_cont);
sum = rpc_dump(buf, buf + MAXPRINTBUF);
sum += port_dump(buf + sum, buf + MAXPRINTBUF);
sum += kid_dump(buf + sum, buf + MAXPRINTBUF);
sum += flip_netdump(buf + sum, buf + MAXPRINTBUF);
sum += int_dump(buf + sum, buf + MAXPRINTBUF);
sum += adr_dump(buf + sum, buf + MAXPRINTBUF);
sum += ff_dump(buf + sum, buf + MAXPRINTBUF);
mp->b_cont->b_rptr = DB_BASE(mp->b_cont);
mp->b_cont->b_wptr = mp->b_cont->b_rptr + sum;
ctrl_args = (struct ctrl_args *) DB_BASE(mp);
ctrl_args->ctrl_status = sum;
mp->b_rptr = DB_BASE(mp);
mp->b_wptr = mp->b_rptr + sizeof(struct ctrl_args);
DB_TYPE(mp) = M_PROTO;
qreply(q, mp);
}
示例2: logi_wput
static int
logi_wput(queue_t *q, mblk_t *mp)
{
struct iocblk *iocbp;
struct strmseinfo *logiptr;
#ifdef LOGI_DEBUG
if (logi_debug)
printf("logi_wput:entered\n");
#endif
logiptr = q->q_ptr;
if (logiptr == 0) {
freemsg(mp);
#ifdef LOGI_DEBUG
if (logi_debug)
printf("logi_wput:logiptr == NULL\n");
#endif
return (0);
}
iocbp = (struct iocblk *)mp->b_rptr;
switch (mp->b_datap->db_type) {
case M_FLUSH:
#ifdef LOGI_DEBUG
if (logi_debug)
printf("logi_wput:M_FLUSH\n");
#endif
if (*mp->b_rptr & FLUSHW)
flushq(q, FLUSHDATA);
qreply(q, mp);
break;
case M_IOCTL:
#ifdef LOGI_DEBUG
if (logi_debug)
printf("logi_wput:M_IOCTL\n");
#endif
mp->b_datap->db_type = M_IOCNAK;
iocbp->ioc_rval = 0;
iocbp->ioc_error = EINVAL;
qreply(q, mp);
break;
case M_IOCDATA:
#ifdef LOGI_DEBUG
if (logi_debug)
printf("logi_wput:M_IOCDATA\n");
#endif
mp->b_datap->db_type = M_IOCNAK;
iocbp->ioc_rval = 0;
iocbp->ioc_error = EINVAL;
qreply(q, mp);
break;
default:
freemsg(mp);
break;
}
#ifdef LOGI_DEBUG
if (logi_debug)
printf("logi_wput:leaving\n");
#endif
return (0);
}
示例3: getfields
/*
* generic query lookup. The query is of one of the following
* forms:
*
* attr1=val1 attr2=val2 attr3=val3 ...
*
* returns the matching tuple
*
* ipinfo attr=val attr1 attr2 attr3 ...
*
* is like ipinfo and returns the attr{1-n}
* associated with the ip address.
*/
static char *genquery(struct mfile *mf, char *query)
{
int i, n;
char *p;
char *attr[Maxattr];
char *val[Maxattr];
struct ndbtuple *t;
struct ndbs s;
n = getfields(query, attr, COUNT_OF(attr), 1, " ");
if (n == 0)
return "bad query";
if (strcmp(attr[0], "ipinfo") == 0)
return ipinfoquery(mf, attr, n);
/* parse pairs */
for (i = 0; i < n; i++) {
p = strchr(attr[i], '=');
if (p == 0)
return "bad query";
*p++ = 0;
val[i] = p;
}
/* give dns a chance */
if ((strcmp(attr[0], "dom") == 0 || strcmp(attr[0], "ip") == 0)
&& val[0]) {
t = dnsiplookup(val[0], &s);
if (t) {
if (qmatch(t, attr, val, n)) {
qreply(mf, t);
ndbfree(t);
return 0;
}
ndbfree(t);
}
}
/* first pair is always the key. It can't be a '*' */
t = ndbsearch(db, &s, attr[0], val[0]);
/* search is the and of all the pairs */
while (t) {
if (qmatch(t, attr, val, n)) {
qreply(mf, t);
ndbfree(t);
return 0;
}
ndbfree(t);
t = ndbsnext(&s, attr[0], val[0]);
}
return "no match";
}
示例4: oplmsu_rcmn_flush_hndl
/*
* Flush handle for read side stream
*
* Requires lock ( M: mandatory P: prohibited A: allowed
* -. uinst_t->lock : M [RW_READER]
* -. uinst_t->u_lock : P
* -. uinst_t->l_lock : P
* -. uinst_t->c_lock : P
*/
void
oplmsu_rcmn_flush_hndl(queue_t *q, mblk_t *mp)
{
queue_t *dst_queue = NULL;
ctrl_t *ctrl;
ASSERT(RW_READ_HELD(&oplmsu_uinst->lock));
if (*mp->b_rptr & FLUSHR) {
/* Remove only data messages from read queue */
flushq(q, FLUSHDATA);
}
mutex_enter(&oplmsu_uinst->c_lock);
if ((ctrl = oplmsu_uinst->user_ctrl) != NULL) {
dst_queue = RD(ctrl->queue);
mutex_exit(&oplmsu_uinst->c_lock);
if (dst_queue != NULL) {
putq(dst_queue, mp);
} else {
if (*mp->b_rptr & FLUSHW) {
flushq(WR(q), FLUSHDATA);
*mp->b_rptr &= ~FLUSHR;
rw_exit(&oplmsu_uinst->lock);
OPLMSU_TRACE(q, mp, MSU_TRC_LO);
qreply(q, mp);
rw_enter(&oplmsu_uinst->lock, RW_READER);
} else {
freemsg(mp);
}
}
} else {
mutex_exit(&oplmsu_uinst->c_lock);
if (*mp->b_rptr & FLUSHW) {
flushq(WR(q), FLUSHDATA);
*mp->b_rptr &= ~FLUSHR;
rw_exit(&oplmsu_uinst->lock);
OPLMSU_TRACE(q, mp, MSU_TRC_LO);
qreply(q, mp);
rw_enter(&oplmsu_uinst->lock, RW_READER);
} else {
freemsg(mp);
}
}
}
示例5: oplmsu_wcmn_flush_hndl
/*
* Flush handle for write side stream
*
* Requires Lock (( M: Mandatory, P: Prohibited, A: Allowed ))
* -. uinst_t->lock : M [RW_READER or RW_WRITER]
* -. uinst_t->u_lock : P
* -. uinst_t->l_lock : P
* -. uinst_t->c_lock : P
*/
void
oplmsu_wcmn_flush_hndl(queue_t *q, mblk_t *mp, krw_t rw)
{
queue_t *dst_queue = NULL;
ASSERT(RW_LOCK_HELD(&oplmsu_uinst->lock));
if (*mp->b_rptr & FLUSHW) { /* Write side */
flushq(q, FLUSHDATA);
}
dst_queue = oplmsu_uinst->lower_queue;
if (dst_queue == NULL) {
if (*mp->b_rptr & FLUSHR) {
flushq(RD(q), FLUSHDATA);
*mp->b_rptr &= ~FLUSHW;
rw_exit(&oplmsu_uinst->lock);
OPLMSU_TRACE(q, mp, MSU_TRC_UO);
qreply(q, mp);
rw_enter(&oplmsu_uinst->lock, rw);
} else {
freemsg(mp);
}
} else {
putq(WR(dst_queue), mp);
}
}
示例6: sscop_w_flush
/*
* -------------------------------------------------------------------------
*
* M_FLUSH Handling
*
* -------------------------------------------------------------------------
*/
STATIC inline void
sscop_w_flush(queue_t *q, mblk_t *mp)
{
if (*mp->b_rptr & FLUSHW) {
if (*mp->b_rptr & FLUSHBAND)
flushband(q, mp->b_rptr[1], FLUSHDATA);
else
flushq(q, FLUSHDATA);
if (q - q_next) {
putnext(q, mp);
return;
}
*mp->b_rptr &= ~FLUSHW;
}
if (*mp->b_rptr & FLUSHR) {
if (*mp->b_rptr & FLUSHBAND)
flushband(RD(q), mp->b_rptr[1], FLUSHDATA);
else
flushq(RD(q), FLUSHDATA);
qreply(q, mp);
return;
}
if (q->q_next) {
putnext(q, mp);
return;
}
}
示例7: n_data_ind
/*
* N_DATA_IND
* -------------------------------------------------------------------------
* This is translated into SUA messages and fed to the state machines.
*/
static int
n_data_ind(queue_t *q, mblk_t *pdu)
{
int err;
mblk_t *mp;
N_data_ind_t *p;
p = (N_data_ind_t *) pdu->b_rptr;
if (p->DATA_xfer_flags & N_MORE_DATA_FLAG) {
/* aaargh! */
/* give it to management */
if ((err = lm_event_ind(q, pdu)))
return (err);
if ((err = m3ua_sp_down(q)))
return (err);
qdisable(q);
return (0);
}
if (p->DATA_xfer_flags & N_RC_FLAG) {
/* need to send receipt confirmation */
if (!(mp = n_datack_ind()))
return (-ENOBUFS);
qreply(q, mp);
}
/* only need the M_DATA block */
mp = pdu->b_cont;
mp->b_band = 0;
freeb(pdu);
if ((err = m3ua_recv_msg(q, mp)))
return (err);
return (0);
}
示例8: lmi_info_ack
/*
* LMI_INFO_ACK
* -----------------------------------
*/
STATIC INLINE int
lmi_info_ack(queue_t *q, long state, caddr_t ppa_ptr, size_t ppa_len)
{
mblk_t *mp;
lmi_info_ack_t *p;
if ((mp = ss7_allocb(q, sizeof(*p) + ppa_len, BPRI_MED))) {
mp->b_datap->db_type = M_PCPROTO;
p = (typeof(p)) mp->b_wptr;
p->lmi_primitive = LMI_INFO_ACK;
p->lmi_version = 1;
p->lmi_state = state;
p->lmi_max_sdu = 8;
p->lmi_min_sdu = 8;
p->lmi_header_len = 0;
p->lmi_ppa_style = LMI_STYLE1;
p->lmi_ppa_length = ppa_len;
p->lmi_ppa_offset = sizeof(*p);
p->lmi_prov_state = SDL_CONNECTED;
p->lmi_prov_flags = SDL_RX_DIRECTION | SDL_TX_DIRECTION;
mp->b_wptr += sizeof(*p);
bcopy(ppa_ptr, mp->b_wptr, ppa_len);
mp->b_wptr += ppa_len;
qreply(q, mp);
return (QR_DONE);
}
rare();
return (-ENOBUFS);
}
示例9: mouse8042_process_msg
static int
mouse8042_process_msg(queue_t *q, mblk_t *mp, struct mouse_state *state)
{
struct iocblk *iocbp;
int rv = 0;
iocbp = (struct iocblk *)mp->b_rptr;
switch (mp->b_datap->db_type) {
case M_FLUSH:
if (*mp->b_rptr & FLUSHW) {
flushq(q, FLUSHDATA);
*mp->b_rptr &= ~FLUSHW;
}
if (*mp->b_rptr & FLUSHR) {
qreply(q, mp);
} else
freemsg(mp);
break;
case M_IOCTL:
mouse8042_iocnack(q, mp, iocbp, EINVAL, 0);
break;
case M_IOCDATA:
mouse8042_iocnack(q, mp, iocbp, EINVAL, 0);
break;
case M_DATA:
rv = mouse8042_process_data_msg(q, mp, state);
break;
default:
freemsg(mp);
break;
}
return (rv);
}
示例10: miocnak
void miocnak(queue_t *pWriteQueue, mblk_t *pMBlk, int cbData, int iErr)
{
struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr;
pMBlk->b_datap->db_type = M_IOCNAK;
pIOCBlk->ioc_count = cbData;
pIOCBlk->ioc_error = iErr ? iErr : EINVAL;
pIOCBlk->ioc_rval = 0;
qreply(pWriteQueue, pMBlk);
}
示例11: miocack
void miocack(queue_t *pWriteQueue, mblk_t *pMBlk, int cbData, int rc)
{
struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr;
pMBlk->b_datap->db_type = M_IOCACK;
pIOCBlk->ioc_count = cbData;
pIOCBlk->ioc_rval = rc;
pIOCBlk->ioc_error = 0;
qreply(pWriteQueue, pMBlk);
}
示例12: vml_iocdata
/*
* vml_iocdata() -
* Handle the M_IOCDATA messages associated with
* a request to validate a module list.
*/
static void
vml_iocdata(
queue_t *qp, /* pointer to write queue */
mblk_t *mp) /* message pointer */
{
long i;
int nmods;
struct copyresp *csp;
struct str_mlist *lp;
STRUCT_HANDLE(str_list, slp);
struct saddev *sadp;
csp = (struct copyresp *)mp->b_rptr;
if (csp->cp_rval) { /* if there was an error */
freemsg(mp);
return;
}
ASSERT(csp->cp_cmd == SAD_VML);
sadp = (struct saddev *)qp->q_ptr;
switch ((long)csp->cp_private) {
case GETSTRUCT:
STRUCT_SET_HANDLE(slp, csp->cp_flag,
(struct str_list *)mp->b_cont->b_rptr);
nmods = STRUCT_FGET(slp, sl_nmods);
if (nmods <= 0) {
miocnak(qp, mp, 0, EINVAL);
break;
}
sadp->sa_addr = (caddr_t)(uintptr_t)nmods;
mcopyin(mp, (void *)GETLIST, nmods * sizeof (struct str_mlist),
STRUCT_FGETP(slp, sl_modlist));
qreply(qp, mp);
break;
case GETLIST:
lp = (struct str_mlist *)mp->b_cont->b_rptr;
for (i = 0; i < (long)sadp->sa_addr; i++, lp++) {
lp->l_name[FMNAMESZ] = '\0';
if (fmodsw_find(lp->l_name, FMODSW_LOAD) == NULL) {
miocack(qp, mp, 0, 1);
return;
}
}
miocack(qp, mp, 0, 0);
break;
default:
cmn_err(CE_WARN, "vml_iocdata: invalid cp_private value: %p",
(void *)csp->cp_private);
freemsg(mp);
break;
} /* switch (cp_private) */
}
示例13: ss7_error_reply
/*
* =========================================================================
*
* SCCP-User --> SUA (ASP) Downstream Primitives
*
* =========================================================================
*/
static inline
ss7_error_reply(queue_t *q, mblk_t *pdu, int prim, int err)
{
mblk_t *mp;
if ((mp = sccp_error_ack(prim, err))) {
freemsg(pdu);
qreply(q, mp);
return (0);
}
return (-ENOBUFS);
}
示例14: mouse8042_iocnack
static void
mouse8042_iocnack(
queue_t *qp,
mblk_t *mp,
struct iocblk *iocp,
int error,
int rval)
{
mp->b_datap->db_type = M_IOCNAK;
iocp->ioc_rval = rval;
iocp->ioc_error = error;
qreply(qp, mp);
}
示例15: m_error
STATIC int
m_error(queue_t *q, int err)
{
mblk_t *mp;
if ((mp = ss7_allocb(q, 2, BPRI_MED))) {
mp->b_datap->db_type = M_ERROR;
*(mp->b_wptr)++ = err < 0 ? -err : err;
*(mp->b_wptr)++ = err < 0 ? -err : err;
qreply(q, mp);
return (QR_DONE);
}
rare();
return (-ENOBUFS);
}