summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2007-08-08 21:44:58 +0000
committerJoshua Colp <jcolp@digium.com>2007-08-08 21:44:58 +0000
commit22114b509dc93cd3f19610362bf3757db2c04787 (patch)
treed42170fbe8a83884d32f1ed09f238da151554071 /channels
parent063c747f3a7120dca404ca845877019dc8c2a62d (diff)
Add support for using epoll instead of poll. This should increase scalability and is done in such a way that we should be able to add support for other poll() replacements.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c4
-rw-r--r--channels/chan_alsa.c2
-rw-r--r--channels/chan_features.c8
-rw-r--r--channels/chan_gtalk.c8
-rw-r--r--channels/chan_h323.c18
-rw-r--r--channels/chan_jingle.c8
-rw-r--r--channels/chan_mgcp.c4
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_nbs.c2
-rw-r--r--channels/chan_oss.c4
-rw-r--r--channels/chan_phone.c2
-rw-r--r--channels/chan_sip.c12
-rw-r--r--channels/chan_skinny.c10
-rw-r--r--channels/chan_zap.c10
14 files changed, 47 insertions, 47 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 21b82b8de..880501ac9 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -207,9 +207,9 @@ static AST_LIST_HEAD_STATIC(agents, agent_pvt); /*!< Holds the list of agents (l
if (p->chan) { \
for (x=0;x<AST_MAX_FDS;x++) {\
if (x != AST_TIMING_FD) \
- ast->fds[x] = p->chan->fds[x]; \
+ ast_channel_set_fd(ast, x, p->chan->fds[x]); \
} \
- ast->fds[AST_AGENT_FD] = p->chan->fds[AST_TIMING_FD]; \
+ ast_channel_set_fd(ast, AST_AGENT_FD, p->chan->fds[AST_TIMING_FD]); \
} \
} while(0)
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index d3decea05..a2a10e85f 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -789,7 +789,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
return NULL;
tmp->tech = &alsa_tech;
- tmp->fds[0] = readdev;
+ ast_channel_set_fd(tmp, 0, readdev);
tmp->nativeformats = AST_FORMAT_SLINEAR;
tmp->readformat = AST_FORMAT_SLINEAR;
tmp->writeformat = AST_FORMAT_SLINEAR;
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 3d199c36f..aa893de38 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -171,8 +171,8 @@ static void restore_channel(struct feature_pvt *p, int index)
p->subs[index].owner->timingfd = p->subs[index].timingfdbackup;
p->subs[index].owner->alertpipe[0] = p->subs[index].alertpipebackup[0];
p->subs[index].owner->alertpipe[1] = p->subs[index].alertpipebackup[1];
- p->subs[index].owner->fds[AST_ALERT_FD] = p->subs[index].alertpipebackup[0];
- p->subs[index].owner->fds[AST_TIMING_FD] = p->subs[index].timingfdbackup;
+ ast_channel_set_fd(p->subs[index].owner, AST_ALERT_FD, p->subs[index].alertpipebackup[0]);
+ ast_channel_set_fd(p->subs[index].owner, AST_TIMING_FD, p->subs[index].timingfdbackup);
}
static void update_features(struct feature_pvt *p, int index)
@@ -181,9 +181,9 @@ static void update_features(struct feature_pvt *p, int index)
if (p->subs[index].owner) {
for (x=0; x<AST_MAX_FDS; x++) {
if (index)
- p->subs[index].owner->fds[x] = -1;
+ ast_channel_set_fd(p->subs[index].owner, x, -1);
else
- p->subs[index].owner->fds[x] = p->subchan->fds[x];
+ ast_channel_set_fd(p->subs[index].owner, x, p->subchan->fds[x]);
}
if (!index) {
/* Copy timings from master channel */
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index bd53d7ae0..cbdaa076f 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -934,13 +934,13 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i,
if (i->rtp) {
ast_rtp_setstun(i->rtp, 1);
- tmp->fds[0] = ast_rtp_fd(i->rtp);
- tmp->fds[1] = ast_rtcp_fd(i->rtp);
+ ast_channel_set_fd(tmp, 0, ast_rtp_fd(i->rtp));
+ ast_channel_set_fd(tmp, 1, ast_rtcp_fd(i->rtp));
}
if (i->vrtp) {
ast_rtp_setstun(i->rtp, 1);
- tmp->fds[2] = ast_rtp_fd(i->vrtp);
- tmp->fds[3] = ast_rtcp_fd(i->vrtp);
+ ast_channel_set_fd(tmp, 2, ast_rtp_fd(i->vrtp));
+ ast_channel_set_fd(tmp, 3, ast_rtcp_fd(i->vrtp));
}
if (state == AST_STATE_RING)
tmp->rings = 1;
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 4e38a4eb5..434d210d2 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -396,8 +396,8 @@ static void __oh323_update_info(struct ast_channel *c, struct oh323_pvt *pvt)
if (pvt->update_rtp_info > 0) {
if (pvt->rtp) {
ast_jb_configure(c, &global_jbconf);
- c->fds[0] = ast_rtp_fd(pvt->rtp);
- c->fds[1] = ast_rtcp_fd(pvt->rtp);
+ ast_channel_set_fd(c, 0, ast_rtp_fd(pvt->rtp));
+ ast_channel_set_fd(c, 1, ast_rtcp_fd(pvt->rtp));
ast_queue_frame(pvt->owner, &ast_null_frame); /* Tell Asterisk to apply changes */
}
pvt->update_rtp_info = -1;
@@ -995,8 +995,8 @@ static int __oh323_rtp_create(struct oh323_pvt *pvt)
if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
ast_jb_configure(pvt->owner, &global_jbconf);
- pvt->owner->fds[0] = ast_rtp_fd(pvt->rtp);
- pvt->owner->fds[1] = ast_rtcp_fd(pvt->rtp);
+ ast_channel_set_fd(pvt->owner, 0, ast_rtp_fd(pvt->rtp));
+ ast_channel_set_fd(pvt->owner, 1, ast_rtcp_fd(pvt->rtp));
ast_queue_frame(pvt->owner, &ast_null_frame); /* Tell Asterisk to apply changes */
ast_channel_unlock(pvt->owner);
} else
@@ -1040,18 +1040,18 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
ch->readformat = fmt;
ch->rawreadformat = fmt;
#if 0
- ch->fds[0] = ast_rtp_fd(pvt->rtp);
- ch->fds[1] = ast_rtcp_fd(pvt->rtp);
+ ast_channel_set_fd(ch, 0, ast_rtp_fd(pvt->rtp));
+ ast_channel_set_fd(ch, 1, ast_rtcp_fd(pvt->rtp));
#endif
#ifdef VIDEO_SUPPORT
if (pvt->vrtp) {
- ch->fds[2] = ast_rtp_fd(pvt->vrtp);
- ch->fds[3] = ast_rtcp_fd(pvt->vrtp);
+ ast_channel_set_fd(ch, 2, ast_rtp_fd(pvt->vrtp));
+ ast_channel_set_fd(ch, 3, ast_rtcp_fd(pvt->vrtp));
}
#endif
#ifdef T38_SUPPORT
if (pvt->udptl) {
- ch->fds[4] = ast_udptl_fd(pvt->udptl);
+ ast_channel_set_fd(ch, 4, ast_udptl_fd(pvt->udptl));
}
#endif
if (state == AST_STATE_RING) {
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index 089797315..e45724f04 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -795,12 +795,12 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
fmt = ast_best_codec(tmp->nativeformats);
if (i->rtp) {
- tmp->fds[0] = ast_rtp_fd(i->rtp);
- tmp->fds[1] = ast_rtcp_fd(i->rtp);
+ ast_channel_set_fd(tmp, 0, ast_rtp_fd(i->rtp));
+ ast_channel_set_fd(tmp, 1, ast_rtcp_fd(i->rtp));
}
if (i->vrtp) {
- tmp->fds[2] = ast_rtp_fd(i->vrtp);
- tmp->fds[3] = ast_rtcp_fd(i->vrtp);
+ ast_channel_set_fd(tmp, 2, ast_rtp_fd(i->vrtp));
+ ast_channel_set_fd(tmp, 3, ast_rtcp_fd(i->vrtp));
}
if (state == AST_STATE_RING)
tmp->rings = 1;
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index ddb811ed3..198c964ad 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1456,7 +1456,7 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
fmt = ast_best_codec(tmp->nativeformats);
ast_string_field_build(tmp, name, "MGCP/%s@%s-%d", i->name, i->parent->name, sub->id);
if (sub->rtp)
- tmp->fds[0] = ast_rtp_fd(sub->rtp);
+ ast_channel_set_fd(tmp, 0, ast_rtp_fd(sub->rtp));
if (i->dtmfmode & (MGCP_DTMF_INBAND | MGCP_DTMF_HYBRID)) {
i->dsp = ast_dsp_new();
ast_dsp_set_features(i->dsp,DSP_FEATURE_DTMF_DETECT);
@@ -2588,7 +2588,7 @@ static void start_rtp(struct mgcp_subchannel *sub)
/* Allocate the RTP now */
sub->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
if (sub->rtp && sub->owner)
- sub->owner->fds[0] = ast_rtp_fd(sub->rtp);
+ ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp));
if (sub->rtp)
ast_rtp_setnat(sub->rtp, sub->nat);
#if 0
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 61a4198b1..ad4d5a5a9 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -3220,7 +3220,7 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
if (pipe(chlist->pipe) < 0)
ast_log(LOG_ERROR, "Pipe failed\n");
- tmp->fds[0] = chlist->pipe[0];
+ ast_channel_set_fd(tmp, 0, chlist->pipe[0]);
if (state == AST_STATE_RING)
tmp->rings = 1;
diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c
index 1c342c6fd..d2718b3de 100644
--- a/channels/chan_nbs.c
+++ b/channels/chan_nbs.c
@@ -232,7 +232,7 @@ static struct ast_channel *nbs_new(struct nbs_pvt *i, int state)
tmp = ast_channel_alloc(1, state, 0, 0, "", "s", context, 0, "NBS/%s", i->stream);
if (tmp) {
tmp->tech = &nbs_tech;
- tmp->fds[0] = nbs_fd(i->nbs);
+ ast_channel_set_fd(tmp, 0, nbs_fd(i->nbs));
tmp->nativeformats = prefformat;
tmp->rawreadformat = prefformat;
tmp->rawwriteformat = prefformat;
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 9dc2fca86..317873759 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -692,7 +692,7 @@ static int setformat(struct chan_oss_pvt *o, int mode)
return -1;
}
if (o->owner)
- o->owner->fds[0] = fd;
+ ast_channel_set_fd(o->owner, 0, fd);
#if __BYTE_ORDER == __LITTLE_ENDIAN
fmt = AFMT_S16_LE;
@@ -1026,7 +1026,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx,
c->tech = &oss_tech;
if (o->sounddev < 0)
setformat(o, O_RDWR);
- c->fds[0] = o->sounddev; /* -1 if device closed, override later */
+ ast_channel_set_fd(c, 0, o->sounddev); /* -1 if device closed, override later */
c->nativeformats = AST_FORMAT_SLINEAR;
c->readformat = AST_FORMAT_SLINEAR;
c->writeformat = AST_FORMAT_SLINEAR;
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index a3f82bb5b..6a51b6dd6 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -855,7 +855,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", i->ext, i->context, 0, "Phone/%s", i->dev + 5);
if (tmp) {
tmp->tech = cur_tech;
- tmp->fds[0] = i->fd;
+ ast_channel_set_fd(tmp, 0, i->fd);
/* XXX Switching formats silently causes kernel panics XXX */
if (i->mode == MODE_FXS &&
ioctl(i->fd, PHONE_QUERY_CODEC, &codec) == 0) {
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f6681709e..8800a60ba 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4553,18 +4553,18 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
ast_dsp_digitmode(i->vad, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF);
}
if (i->rtp) {
- tmp->fds[0] = ast_rtp_fd(i->rtp);
- tmp->fds[1] = ast_rtcp_fd(i->rtp);
+ ast_channel_set_fd(tmp, 0, ast_rtp_fd(i->rtp));
+ ast_channel_set_fd(tmp, 1, ast_rtcp_fd(i->rtp));
}
if (needvideo && i->vrtp) {
- tmp->fds[2] = ast_rtp_fd(i->vrtp);
- tmp->fds[3] = ast_rtcp_fd(i->vrtp);
+ ast_channel_set_fd(tmp, 2, ast_rtp_fd(i->vrtp));
+ ast_channel_set_fd(tmp, 3, ast_rtcp_fd(i->vrtp));
}
if (needtext && i->trtp) {
- tmp->fds[4] = ast_rtp_fd(i->trtp);
+ ast_channel_set_fd(tmp, 4, ast_rtp_fd(i->trtp));
}
if (i->udptl) {
- tmp->fds[5] = ast_udptl_fd(i->udptl);
+ ast_channel_set_fd(tmp, 5, ast_udptl_fd(i->udptl));
}
if (state == AST_STATE_RING)
tmp->rings = 1;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index bc1e73322..c11643805 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -2515,12 +2515,12 @@ static void start_rtp(struct skinny_subchannel *sub)
sub->vrtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
if (sub->rtp && sub->owner) {
- sub->owner->fds[0] = ast_rtp_fd(sub->rtp);
- sub->owner->fds[1] = ast_rtcp_fd(sub->rtp);
+ ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp));
+ ast_channel_set_fd(sub->owner, 1, ast_rtcp_fd(sub->rtp));
}
if (hasvideo && sub->vrtp && sub->owner) {
- sub->owner->fds[2] = ast_rtp_fd(sub->vrtp);
- sub->owner->fds[3] = ast_rtcp_fd(sub->vrtp);
+ ast_channel_set_fd(sub->owner, 2, ast_rtp_fd(sub->vrtp));
+ ast_channel_set_fd(sub->owner, 3, ast_rtcp_fd(sub->vrtp));
}
if (sub->rtp) {
ast_rtp_setnat(sub->rtp, l->nat);
@@ -3070,7 +3070,7 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state)
if (skinnydebug)
ast_verbose("skinny_new: tmp->nativeformats=%d fmt=%d\n", tmp->nativeformats, fmt);
if (sub->rtp) {
- tmp->fds[0] = ast_rtp_fd(sub->rtp);
+ ast_channel_set_fd(tmp, 0, ast_rtp_fd(sub->rtp));
}
if (state == AST_STATE_RING) {
tmp->rings = 1;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index fbad1ac90..1426f456a 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -1013,9 +1013,9 @@ static void swap_subs(struct zt_pvt *p, int a, int b)
p->subs[b].inthreeway = tinthreeway;
if (p->subs[a].owner)
- p->subs[a].owner->fds[0] = p->subs[a].zfd;
+ ast_channel_set_fd(p->subs[a].owner, 0, p->subs[a].zfd);
if (p->subs[b].owner)
- p->subs[b].owner->fds[0] = p->subs[b].zfd;
+ ast_channel_set_fd(p->subs[b].owner, 0, p->subs[b].zfd);
wakeup_sub(p, a, NULL);
wakeup_sub(p, b, NULL);
}
@@ -2595,7 +2595,7 @@ static int pri_assign_bearer(struct zt_pvt *crv, struct zt_pri *pri, struct zt_p
bearer->realcall = crv;
crv->subs[SUB_REAL].zfd = bearer->subs[SUB_REAL].zfd;
if (crv->subs[SUB_REAL].owner)
- crv->subs[SUB_REAL].owner->fds[0] = crv->subs[SUB_REAL].zfd;
+ ast_channel_set_fd(crv->subs[SUB_REAL].owner, 0, crv->subs[SUB_REAL].zfd);
crv->bearer = bearer;
crv->call = bearer->call;
crv->pri = pri;
@@ -5515,7 +5515,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
else
deflaw = AST_FORMAT_ULAW;
}
- tmp->fds[0] = i->subs[index].zfd;
+ ast_channel_set_fd(tmp, 0, i->subs[index].zfd);
tmp->nativeformats = AST_FORMAT_SLINEAR | deflaw;
/* Start out assuming ulaw since it's smaller :) */
tmp->rawreadformat = deflaw;
@@ -8977,7 +8977,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
"Zap/%d:%d-%d", pri->trunkgroup,
pri->pvts[principle]->channel, 1);
pri->pvts[principle]->owner->tech_pvt = pri->pvts[principle];
- pri->pvts[principle]->owner->fds[0] = pri->pvts[principle]->subs[SUB_REAL].zfd;
+ ast_channel_set_fd(pri->pvts[principle]->owner, 0, pri->pvts[principle]->subs[SUB_REAL].zfd);
pri->pvts[principle]->subs[SUB_REAL].owner = pri->pvts[x]->subs[SUB_REAL].owner;
} else
ast_log(LOG_WARNING, "Whoa, there's no owner, and we're having to fix up channel %d to channel %d\n", pri->pvts[x]->channel, pri->pvts[principle]->channel);