exterror(9): add two helpers
The exterr_set_from() function sets current thread extended error from the pre-filled struct kexterr. The exterr_clear() function clears some struct kexterr. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D53351
This commit is contained in:
@@ -2345,3 +2345,22 @@ exterr_set(int eerror, int category, const char *mmsg, uintptr_t pp1,
|
||||
}
|
||||
return (eerror);
|
||||
}
|
||||
|
||||
int
|
||||
exterr_set_from(const struct kexterr *ke)
|
||||
{
|
||||
struct thread *td;
|
||||
|
||||
td = curthread;
|
||||
if ((td->td_pflags2 & TDP2_UEXTERR) != 0) {
|
||||
td->td_pflags2 |= TDP2_EXTERR;
|
||||
td->td_kexterr = *ke;
|
||||
}
|
||||
return (td->td_kexterr.error);
|
||||
}
|
||||
|
||||
void
|
||||
exterr_clear(struct kexterr *ke)
|
||||
{
|
||||
memset(ke, 0, sizeof(*ke));
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
_EXTERROR_MACRO(__VA_ARGS__, _SET_ERROR2, _SET_ERROR1, \
|
||||
_SET_ERROR0)(__VA_ARGS__)
|
||||
|
||||
void exterr_clear(struct kexterr *ke);
|
||||
int exterr_set_from(const struct kexterr *ke);
|
||||
int exterr_set(int eerror, int category, const char *mmsg, uintptr_t pp1,
|
||||
uintptr_t pp2, int line);
|
||||
int exterr_to_ue(struct thread *td, struct uexterror *ue);
|
||||
|
||||
Reference in New Issue
Block a user