[PATCH 4/7] Add support for receiving fds in replies
Julien Cristau
jcristau at debian.org
Thu Nov 7 08:40:56 PST 2013
On Thu, Nov 7, 2013 at 15:11:30 +0100, Daniel Martin wrote:
> Just a nitpick:
>
> On 6 November 2013 01:41, Keith Packard <keithp at keithp.com> wrote:
> > Requests signal which replies will have fds, and the replies report
> > how many fds they expect in byte 1.
> >
> > Signed-off-by: Keith Packard <keithp at keithp.com>
> > ---
> > src/c_client.py | 65 ++++++++++++++++++++++++++++++++++++++++++++----
> > src/xcb_in.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
> > src/xcbext.h | 4 ++-
> > src/xcbint.h | 8 +++---
> > 4 files changed, 141 insertions(+), 12 deletions(-)
> >
> > diff --git a/src/c_client.py b/src/c_client.py
> > index ed92185..4c5da0a 100644
> > --- a/src/c_client.py
> > +++ b/src/c_client.py
> > @@ -303,6 +303,7 @@ def _c_type_setup(self, name, postfix):
> > self.c_reply_name = _n(name + ('reply',))
> > self.c_reply_type = _t(name + ('reply',))
> > self.c_cookie_type = _t(name + ('cookie',))
> > + self.c_reply_fds_name = _n(name + ('reply_fds',))
> >
> > self.need_aux = False
> > self.need_serialize = False
> > @@ -1835,7 +1836,7 @@ def c_union(self, name):
> > _c_complex(self)
> > _c_iterator(self, name)
> >
> > -def _c_request_helper(self, name, cookie_type, void, regular, aux=False):
> > +def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_fds=False):
> > '''
> > Declares a request function.
> > '''
> > @@ -1864,6 +1865,12 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False):
> > # What flag is passed to xcb_request
> > func_flags = '0' if (void and regular) or (not void and not regular) else 'XCB_REQUEST_CHECKED'
> >
> > + if reply_fds:
> > + if func_flags == '0':
> > + func_flags = 'XCB_REQUEST_REPLY_FDS'
> > + else:
> > + func_flags = func_flags + '|XCB_REQUEST_REPLY_FDS'
> > +
> > # Global extension id variable or NULL for xproto
> > func_ext_global = '&' + _ns.c_ext_global_name if _ns.is_ext else '0'
> >
> > @@ -2256,6 +2263,51 @@ def _c_reply(self, name):
> >
> > _c('}')
> >
> > +def _c_reply_has_fds(self):
> > + for field in self.fields:
> > + if field.isfd:
> > + return True
> > + return False
>
> This could be more pythonic:
>
> return any([field.isfd for field in self.fields])
>
better even without the []
Cheers,
Julien
More information about the xorg-devel
mailing list