mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
creds: Rename pa_ancil to pa_cmsg_ancil_data
Makes the purpose of the structure clearear.
This commit is contained in:
parent
72e5671ece
commit
8718496d14
12 changed files with 82 additions and 82 deletions
|
|
@ -1780,14 +1780,14 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
|
|||
}
|
||||
|
||||
/* Called from main context */
|
||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
|
||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
|
||||
struct userdata *u = userdata;
|
||||
|
||||
pa_assert(p);
|
||||
pa_assert(packet);
|
||||
pa_assert(u);
|
||||
|
||||
if (pa_pdispatch_run(u->pdispatch, packet, ancil, u) < 0) {
|
||||
if (pa_pdispatch_run(u->pdispatch, packet, ancil_data, u) < 0) {
|
||||
pa_log("Invalid packet");
|
||||
pa_module_unload_request(u->module, true);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
|
|||
pa_context_fail(c, PA_ERR_CONNECTIONTERMINATED);
|
||||
}
|
||||
|
||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
|
||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
|
||||
pa_context *c = userdata;
|
||||
|
||||
pa_assert(p);
|
||||
|
|
@ -337,7 +337,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_a
|
|||
|
||||
pa_context_ref(c);
|
||||
|
||||
if (pa_pdispatch_run(c->pdispatch, packet, ancil, c) < 0)
|
||||
if (pa_pdispatch_run(c->pdispatch, packet, ancil_data, c) < 0)
|
||||
pa_context_fail(c, PA_ERR_PROTOCOL);
|
||||
|
||||
pa_context_unref(c);
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@
|
|||
#include <pulsecore/socket.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MAX_ANCIL_FDS 2
|
||||
#define MAX_ANCIL_DATA_FDS 2
|
||||
|
||||
typedef struct pa_creds pa_creds;
|
||||
typedef struct pa_ancil pa_ancil;
|
||||
typedef struct pa_cmsg_ancil_data pa_cmsg_ancil_data;
|
||||
|
||||
#if defined(SCM_CREDENTIALS)
|
||||
|
||||
|
|
@ -46,12 +46,12 @@ struct pa_creds {
|
|||
};
|
||||
|
||||
/* Struct for handling ancillary data, i e, extra data that can be sent together with a message
|
||||
over unix pipes. Supports sending and receiving credentials and file descriptors. */
|
||||
struct pa_ancil {
|
||||
* over unix pipes. Supports sending and receiving credentials and file descriptors. */
|
||||
struct pa_cmsg_ancil_data {
|
||||
pa_creds creds;
|
||||
bool creds_valid;
|
||||
int nfd;
|
||||
int fds[MAX_ANCIL_FDS];
|
||||
int fds[MAX_ANCIL_DATA_FDS];
|
||||
};
|
||||
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
|
|||
struct iovec iov;
|
||||
union {
|
||||
struct cmsghdr hdr;
|
||||
uint8_t data[CMSG_SPACE(sizeof(int) * MAX_ANCIL_FDS)];
|
||||
uint8_t data[CMSG_SPACE(sizeof(int) * MAX_ANCIL_DATA_FDS)];
|
||||
} cmsg;
|
||||
|
||||
pa_assert(io);
|
||||
|
|
@ -364,7 +364,7 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
|
|||
pa_assert(io->ofd >= 0);
|
||||
pa_assert(fds);
|
||||
pa_assert(nfd > 0);
|
||||
pa_assert(nfd <= MAX_ANCIL_FDS);
|
||||
pa_assert(nfd <= MAX_ANCIL_DATA_FDS);
|
||||
|
||||
pa_zero(iov);
|
||||
iov.iov_base = (void*) data;
|
||||
|
|
@ -391,24 +391,24 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
|
|||
return r;
|
||||
}
|
||||
|
||||
ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_ancil *ancil) {
|
||||
ssize_t pa_iochannel_read_with_ancil_data(pa_iochannel*io, void*data, size_t l, pa_cmsg_ancil_data *ancil_data) {
|
||||
ssize_t r;
|
||||
struct msghdr mh;
|
||||
struct iovec iov;
|
||||
union {
|
||||
struct cmsghdr hdr;
|
||||
uint8_t data[CMSG_SPACE(sizeof(struct ucred)) + CMSG_SPACE(sizeof(int) * MAX_ANCIL_FDS)];
|
||||
uint8_t data[CMSG_SPACE(sizeof(struct ucred)) + CMSG_SPACE(sizeof(int) * MAX_ANCIL_DATA_FDS)];
|
||||
} cmsg;
|
||||
|
||||
pa_assert(io);
|
||||
pa_assert(data);
|
||||
pa_assert(l);
|
||||
pa_assert(io->ifd >= 0);
|
||||
pa_assert(ancil);
|
||||
pa_assert(ancil_data);
|
||||
|
||||
if (io->ifd_type > 0) {
|
||||
ancil->creds_valid = false;
|
||||
ancil->nfd = 0;
|
||||
ancil_data->creds_valid = false;
|
||||
ancil_data->nfd = 0;
|
||||
return pa_iochannel_read(io, data, l);
|
||||
}
|
||||
|
||||
|
|
@ -426,8 +426,8 @@ ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_an
|
|||
if ((r = recvmsg(io->ifd, &mh, 0)) >= 0) {
|
||||
struct cmsghdr *cmh;
|
||||
|
||||
ancil->creds_valid = false;
|
||||
ancil->nfd = 0;
|
||||
ancil_data->creds_valid = false;
|
||||
ancil_data->nfd = 0;
|
||||
|
||||
for (cmh = CMSG_FIRSTHDR(&mh); cmh; cmh = CMSG_NXTHDR(&mh, cmh)) {
|
||||
|
||||
|
|
@ -439,21 +439,21 @@ ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_an
|
|||
pa_assert(cmh->cmsg_len == CMSG_LEN(sizeof(struct ucred)));
|
||||
memcpy(&u, CMSG_DATA(cmh), sizeof(struct ucred));
|
||||
|
||||
ancil->creds.gid = u.gid;
|
||||
ancil->creds.uid = u.uid;
|
||||
ancil->creds_valid = true;
|
||||
ancil_data->creds.gid = u.gid;
|
||||
ancil_data->creds.uid = u.uid;
|
||||
ancil_data->creds_valid = true;
|
||||
}
|
||||
else if (cmh->cmsg_type == SCM_RIGHTS) {
|
||||
int nfd = (cmh->cmsg_len - CMSG_LEN(0)) / sizeof(int);
|
||||
if (nfd > MAX_ANCIL_FDS) {
|
||||
if (nfd > MAX_ANCIL_DATA_FDS) {
|
||||
int i;
|
||||
pa_log("Trying to receive too many file descriptors!");
|
||||
for (i = 0; i < nfd; i++)
|
||||
pa_close(((int*) CMSG_DATA(cmh))[i]);
|
||||
continue;
|
||||
}
|
||||
memcpy(ancil->fds, CMSG_DATA(cmh), nfd * sizeof(int));
|
||||
ancil->nfd = nfd;
|
||||
memcpy(ancil_data->fds, CMSG_DATA(cmh), nfd * sizeof(int));
|
||||
ancil_data->nfd = nfd;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_an
|
|||
|
||||
if (r == -1 && errno == ENOTSOCK) {
|
||||
io->ifd_type = 1;
|
||||
return pa_iochannel_read_with_ancil(io, data, l, ancil);
|
||||
return pa_iochannel_read_with_ancil_data(io, data, l, ancil_data);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ int pa_iochannel_creds_enable(pa_iochannel *io);
|
|||
|
||||
ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l, int nfd, const int *fds);
|
||||
ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l, const pa_creds *ucred);
|
||||
ssize_t pa_iochannel_read_with_ancil(pa_iochannel*io, void*data, size_t l, pa_ancil *ancil);
|
||||
ssize_t pa_iochannel_read_with_ancil_data(pa_iochannel*io, void*data, size_t l, pa_cmsg_ancil_data *ancil_data);
|
||||
#endif
|
||||
|
||||
bool pa_iochannel_is_readable(pa_iochannel*io);
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ struct pa_pdispatch {
|
|||
PA_LLIST_HEAD(struct reply_info, replies);
|
||||
pa_pdispatch_drain_cb_t drain_callback;
|
||||
void *drain_userdata;
|
||||
const pa_ancil *ancil;
|
||||
const pa_cmsg_ancil_data *ancil_data;
|
||||
bool use_rtclock;
|
||||
};
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ static void run_action(pa_pdispatch *pd, struct reply_info *r, uint32_t command,
|
|||
pa_pdispatch_unref(pd);
|
||||
}
|
||||
|
||||
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_ancil *ancil, void *userdata) {
|
||||
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
|
||||
uint32_t tag, command;
|
||||
pa_tagstruct *ts = NULL;
|
||||
int ret = -1;
|
||||
|
|
@ -325,7 +325,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_ancil *ancil,
|
|||
}
|
||||
#endif
|
||||
|
||||
pd->ancil = ancil;
|
||||
pd->ancil_data = ancil_data;
|
||||
|
||||
if (command == PA_COMMAND_ERROR || command == PA_COMMAND_REPLY) {
|
||||
struct reply_info *r;
|
||||
|
|
@ -349,7 +349,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_ancil *ancil,
|
|||
ret = 0;
|
||||
|
||||
finish:
|
||||
pd->ancil = NULL;
|
||||
pd->ancil_data = NULL;
|
||||
|
||||
if (ts)
|
||||
pa_tagstruct_free(ts);
|
||||
|
|
@ -444,8 +444,8 @@ const pa_creds * pa_pdispatch_creds(pa_pdispatch *pd) {
|
|||
pa_assert(pd);
|
||||
pa_assert(PA_REFCNT_VALUE(pd) >= 1);
|
||||
|
||||
if (pd->ancil && pd->ancil->creds_valid)
|
||||
return &pd->ancil->creds;
|
||||
if (pd->ancil_data && pd->ancil_data->creds_valid)
|
||||
return &pd->ancil_data->creds;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -454,9 +454,9 @@ const int * pa_pdispatch_fds(pa_pdispatch *pd, int *nfd) {
|
|||
pa_assert(PA_REFCNT_VALUE(pd) >= 1);
|
||||
pa_assert(nfd);
|
||||
|
||||
if (pd->ancil) {
|
||||
*nfd = pd->ancil->nfd;
|
||||
return pd->ancil->fds;
|
||||
if (pd->ancil_data) {
|
||||
*nfd = pd->ancil_data->nfd;
|
||||
return pd->ancil_data->fds;
|
||||
}
|
||||
|
||||
*nfd = 0;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, bool use_rtclock, const pa_pd
|
|||
void pa_pdispatch_unref(pa_pdispatch *pd);
|
||||
pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd);
|
||||
|
||||
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*p, const pa_ancil *ancil, void *userdata);
|
||||
int pa_pdispatch_run(pa_pdispatch *pd, pa_packet *p, const pa_cmsg_ancil_data *ancil_data, void *userdata);
|
||||
|
||||
void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t callback, void *userdata, pa_free_cb_t free_cb);
|
||||
|
||||
|
|
|
|||
|
|
@ -4888,14 +4888,14 @@ static void command_set_port_latency_offset(pa_pdispatch *pd, uint32_t command,
|
|||
|
||||
/*** pstream callbacks ***/
|
||||
|
||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
|
||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
|
||||
pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
|
||||
|
||||
pa_assert(p);
|
||||
pa_assert(packet);
|
||||
pa_native_connection_assert_ref(c);
|
||||
|
||||
if (pa_pdispatch_run(c->pdispatch, packet, ancil, c) < 0) {
|
||||
if (pa_pdispatch_run(c->pdispatch, packet, ancil_data, c) < 0) {
|
||||
pa_log("invalid packet.");
|
||||
native_connection_unlink(c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "pstream-util.h"
|
||||
|
||||
static void pa_pstream_send_tagstruct_with_ancil(pa_pstream *p, pa_tagstruct *t, const pa_ancil *ancil) {
|
||||
static void pa_pstream_send_tagstruct_with_ancil_data(pa_pstream *p, pa_tagstruct *t, const pa_cmsg_ancil_data *ancil_data) {
|
||||
size_t length;
|
||||
uint8_t *data;
|
||||
pa_packet *packet;
|
||||
|
|
@ -38,7 +38,7 @@ static void pa_pstream_send_tagstruct_with_ancil(pa_pstream *p, pa_tagstruct *t,
|
|||
|
||||
pa_assert_se(data = pa_tagstruct_free_data(t, &length));
|
||||
pa_assert_se(packet = pa_packet_new_dynamic(data, length));
|
||||
pa_pstream_send_packet(p, packet, ancil);
|
||||
pa_pstream_send_packet(p, packet, ancil_data);
|
||||
pa_packet_unref(packet);
|
||||
}
|
||||
|
||||
|
|
@ -46,35 +46,35 @@ static void pa_pstream_send_tagstruct_with_ancil(pa_pstream *p, pa_tagstruct *t,
|
|||
|
||||
void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) {
|
||||
if (creds) {
|
||||
pa_ancil a;
|
||||
pa_cmsg_ancil_data a;
|
||||
|
||||
a.nfd = 0;
|
||||
a.creds_valid = true;
|
||||
a.creds = *creds;
|
||||
pa_pstream_send_tagstruct_with_ancil(p, t, &a);
|
||||
pa_pstream_send_tagstruct_with_ancil_data(p, t, &a);
|
||||
}
|
||||
else
|
||||
pa_pstream_send_tagstruct_with_ancil(p, t, NULL);
|
||||
pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
|
||||
}
|
||||
|
||||
void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) {
|
||||
if (nfd > 0) {
|
||||
pa_ancil a;
|
||||
pa_cmsg_ancil_data a;
|
||||
|
||||
a.nfd = nfd;
|
||||
a.creds_valid = false;
|
||||
pa_assert(nfd <= MAX_ANCIL_FDS);
|
||||
pa_assert(nfd <= MAX_ANCIL_DATA_FDS);
|
||||
memcpy(a.fds, fds, sizeof(int) * nfd);
|
||||
pa_pstream_send_tagstruct_with_ancil(p, t, &a);
|
||||
pa_pstream_send_tagstruct_with_ancil_data(p, t, &a);
|
||||
}
|
||||
else
|
||||
pa_pstream_send_tagstruct_with_ancil(p, t, NULL);
|
||||
pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) {
|
||||
pa_pstream_send_tagstruct_with_ancil(p, t, NULL);
|
||||
pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
|
||||
}
|
||||
|
||||
void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) {
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ struct item_info {
|
|||
/* packet info */
|
||||
pa_packet *packet;
|
||||
#ifdef HAVE_CREDS
|
||||
bool with_ancil;
|
||||
pa_ancil ancil;
|
||||
bool with_ancil_data;
|
||||
pa_cmsg_ancil_data ancil_data;
|
||||
#endif
|
||||
|
||||
/* memblock info */
|
||||
|
|
@ -170,8 +170,8 @@ struct pa_pstream {
|
|||
pa_mempool *mempool;
|
||||
|
||||
#ifdef HAVE_CREDS
|
||||
pa_ancil read_ancil, write_ancil;
|
||||
bool send_ancil_now;
|
||||
pa_cmsg_ancil_data read_ancil_data, write_ancil_data;
|
||||
bool send_ancil_data_now;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ static void pstream_free(pa_pstream *p) {
|
|||
pa_xfree(p);
|
||||
}
|
||||
|
||||
void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_ancil *ancil) {
|
||||
void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data) {
|
||||
struct item_info *i;
|
||||
|
||||
pa_assert(p);
|
||||
|
|
@ -341,12 +341,12 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_ancil *anc
|
|||
i->packet = pa_packet_ref(packet);
|
||||
|
||||
#ifdef HAVE_CREDS
|
||||
if ((i->with_ancil = !!ancil)) {
|
||||
i->ancil = *ancil;
|
||||
if (ancil->creds_valid)
|
||||
pa_assert(ancil->nfd == 0);
|
||||
if ((i->with_ancil_data = !!ancil_data)) {
|
||||
i->ancil_data = *ancil_data;
|
||||
if (ancil_data->creds_valid)
|
||||
pa_assert(ancil_data->nfd == 0);
|
||||
else
|
||||
pa_assert(ancil->nfd > 0);
|
||||
pa_assert(ancil_data->nfd > 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa
|
|||
i->offset = offset;
|
||||
i->seek_mode = seek_mode;
|
||||
#ifdef HAVE_CREDS
|
||||
i->with_ancil = false;
|
||||
i->with_ancil_data = false;
|
||||
#endif
|
||||
|
||||
pa_queue_push(p->send_queue, i);
|
||||
|
|
@ -416,7 +416,7 @@ void pa_pstream_send_release(pa_pstream *p, uint32_t block_id) {
|
|||
item->type = PA_PSTREAM_ITEM_SHMRELEASE;
|
||||
item->block_id = block_id;
|
||||
#ifdef HAVE_CREDS
|
||||
item->with_ancil = false;
|
||||
item->with_ancil_data = false;
|
||||
#endif
|
||||
|
||||
pa_queue_push(p->send_queue, item);
|
||||
|
|
@ -453,7 +453,7 @@ void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id) {
|
|||
item->type = PA_PSTREAM_ITEM_SHMREVOKE;
|
||||
item->block_id = block_id;
|
||||
#ifdef HAVE_CREDS
|
||||
item->with_ancil = false;
|
||||
item->with_ancil_data = false;
|
||||
#endif
|
||||
|
||||
pa_queue_push(p->send_queue, item);
|
||||
|
|
@ -577,8 +577,8 @@ static void prepare_next_write_item(pa_pstream *p) {
|
|||
}
|
||||
|
||||
#ifdef HAVE_CREDS
|
||||
if ((p->send_ancil_now = p->write.current->with_ancil))
|
||||
p->write_ancil = p->write.current->ancil;
|
||||
if ((p->send_ancil_data_now = p->write.current->with_ancil_data))
|
||||
p->write_ancil_data = p->write.current->ancil_data;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -637,16 +637,16 @@ static int do_write(pa_pstream *p) {
|
|||
pa_assert(l > 0);
|
||||
|
||||
#ifdef HAVE_CREDS
|
||||
if (p->send_ancil_now) {
|
||||
if (p->write_ancil.creds_valid) {
|
||||
pa_assert(p->write_ancil.nfd == 0);
|
||||
if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_ancil.creds)) < 0)
|
||||
if (p->send_ancil_data_now) {
|
||||
if (p->write_ancil_data.creds_valid) {
|
||||
pa_assert(p->write_ancil_data.nfd == 0);
|
||||
if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_ancil_data.creds)) < 0)
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
if ((r = pa_iochannel_write_with_fds(p->io, d, l, p->write_ancil.nfd, p->write_ancil.fds)) < 0)
|
||||
if ((r = pa_iochannel_write_with_fds(p->io, d, l, p->write_ancil_data.nfd, p->write_ancil_data.fds)) < 0)
|
||||
goto fail;
|
||||
p->send_ancil_now = false;
|
||||
p->send_ancil_data_now = false;
|
||||
} else
|
||||
#endif
|
||||
if (p->srb)
|
||||
|
|
@ -719,19 +719,19 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
|
|||
else
|
||||
#ifdef HAVE_CREDS
|
||||
{
|
||||
pa_ancil b;
|
||||
pa_cmsg_ancil_data b;
|
||||
|
||||
if ((r = pa_iochannel_read_with_ancil(p->io, d, l, &b)) <= 0)
|
||||
if ((r = pa_iochannel_read_with_ancil_data(p->io, d, l, &b)) <= 0)
|
||||
goto fail;
|
||||
|
||||
if (b.creds_valid) {
|
||||
p->read_ancil.creds_valid = true;
|
||||
p->read_ancil.creds = b.creds;
|
||||
p->read_ancil_data.creds_valid = true;
|
||||
p->read_ancil_data.creds = b.creds;
|
||||
}
|
||||
if (b.nfd > 0) {
|
||||
pa_assert(b.nfd <= MAX_ANCIL_FDS);
|
||||
p->read_ancil.nfd = b.nfd;
|
||||
memcpy(p->read_ancil.fds, b.fds, sizeof(int) * b.nfd);
|
||||
pa_assert(b.nfd <= MAX_ANCIL_DATA_FDS);
|
||||
p->read_ancil_data.nfd = b.nfd;
|
||||
memcpy(p->read_ancil_data.fds, b.fds, sizeof(int) * b.nfd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
@ -880,7 +880,7 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
|
|||
|
||||
if (p->receive_packet_callback)
|
||||
#ifdef HAVE_CREDS
|
||||
p->receive_packet_callback(p, re->packet, &p->read_ancil, p->receive_packet_callback_userdata);
|
||||
p->receive_packet_callback(p, re->packet, &p->read_ancil_data, p->receive_packet_callback_userdata);
|
||||
#else
|
||||
p->receive_packet_callback(p, re->packet, NULL, p->receive_packet_callback_userdata);
|
||||
#endif
|
||||
|
|
@ -942,8 +942,8 @@ frame_done:
|
|||
re->data = NULL;
|
||||
|
||||
#ifdef HAVE_CREDS
|
||||
p->read_ancil.creds_valid = false;
|
||||
p->read_ancil.nfd = 0;
|
||||
p->read_ancil_data.creds_valid = false;
|
||||
p->read_ancil_data.nfd = 0;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
typedef struct pa_pstream pa_pstream;
|
||||
|
||||
typedef void (*pa_pstream_packet_cb_t)(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata);
|
||||
typedef void (*pa_pstream_packet_cb_t)(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata);
|
||||
typedef void (*pa_pstream_memblock_cb_t)(pa_pstream *p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk, void *userdata);
|
||||
typedef void (*pa_pstream_notify_cb_t)(pa_pstream *p, void *userdata);
|
||||
typedef void (*pa_pstream_block_id_cb_t)(pa_pstream *p, uint32_t block_id, void *userdata);
|
||||
|
|
@ -50,7 +50,7 @@ void pa_pstream_unref(pa_pstream*p);
|
|||
|
||||
void pa_pstream_unlink(pa_pstream *p);
|
||||
|
||||
void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_ancil *ancil);
|
||||
void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data);
|
||||
void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk);
|
||||
void pa_pstream_send_release(pa_pstream *p, uint32_t block_id);
|
||||
void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static unsigned packets_received;
|
|||
static unsigned packets_checksum;
|
||||
static size_t packets_length;
|
||||
|
||||
static void packet_received(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
|
||||
static void packet_received(pa_pstream *p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data, void *userdata) {
|
||||
unsigned i;
|
||||
fail_unless(packets_length == packet->length);
|
||||
packets_received++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue