It would be useful to add an error string pointer to struct tevent_req

Jeremy Allison jra at samba.org
Tue Apr 30 14:04:42 MDT 2013


On Tue, Apr 30, 2013 at 12:44:47PM -0700, Richard Sharpe wrote:
> On Tue, Apr 30, 2013 at 11:55 AM, Jeremy Allison <jra at samba.org> wrote:
> > On Tue, Apr 30, 2013 at 11:33:25AM -0700, Richard Sharpe wrote:
> >> Hi folks,
> >>
> >> Because it can be hard to figure out where, say EINVAL, is coming
> >> from, it would be useful to have a pointer to an error string where we
> >> can talloc up, in the error path, something that tells you the
> >> function and line number an error is coming from.
> >>
> >> Then when you have several sets of tevents along the way, you get a
> >> better idea of why an error has really occurred.
> >
> > Do you have a more formal proposal of how we'd do this ?
> > We can always reference a talloc'ed string on an 'error'
> > context - problem is when to set it (not all code paths
> > do or would) vs. just adding a specific debug where you
> > suspect it.
> 
> I am trying to determine if EINVAL is coming from the writev in static
> void tstream_bsd_writev_handler(void *private_data) or from here:
> 
>         if (to_write == 0) {
>                 tevent_req_error(req, EINVAL);
>                 goto post;
>         }
> 
> 
> in tstream_writev_send.
> 
> At this level, I am not sure we can use DEBUG and friends.

Well tevent_req_error() is a wrapper for :

bool _tevent_req_error(struct tevent_req *req,
                       uint64_t error,
                       const char *location)

which already stores the location in
req->internal.finish_location

Jeremy.


More information about the samba-technical mailing list