Print this page
6092 rtld should always provide assfail/assfail3
Reviewed by: Andy Stormont <astormont@racktopsystems.com>


3055                     ((prevptr == NULL) || (strcmp(prevptr, nextptr) != 0))) {
3056                         prevptr = nextptr;
3057                         nextptr = prf.pr_cur;
3058                         *nextptr = '\0';
3059                 }
3060         }
3061         lock = 0;
3062 }
3063 
3064 /*PRINTFLIKE3*/
3065 void
3066 eprintf(Lm_list *lml, Error error, const char *format, ...)
3067 {
3068         va_list         args;
3069 
3070         va_start(args, format);
3071         veprintf(lml, error, format, args);
3072         va_end(args);
3073 }
3074 
3075 #if     DEBUG
3076 /*
3077  * Provide assfail() for ASSERT() statements.  See <sys/debug.h> for further
3078  * details.
3079  */
3080 int
3081 assfail(const char *a, const char *f, int l)
3082 {
3083         (void) printf("assertion failed: %s, file: %s, line: %d\n", a, f, l);
3084         (void) _lwp_kill(_lwp_self(), SIGABRT);
3085         return (0);
3086 }
3087 
3088 void
3089 assfail3(const char *msg, uintmax_t a, const char *op, uintmax_t b,
3090     const char *f, int l)
3091 {
3092         (void) printf("assertion failed: %s (%llu %s %llu), "
3093             "file: %s, line: %d\n", msg, a, op, b, f, l);

3094         (void) _lwp_kill(_lwp_self(), SIGABRT);
3095 }
3096 #endif
3097 
3098 /*
3099  * Exit.  If we arrive here with a non zero status it's because of a fatal
3100  * error condition (most commonly a relocation error).  If the application has
3101  * already had control, then the actual fatal error message will have been
3102  * recorded in the dlerror() message buffer.  Print the message before really
3103  * exiting.
3104  */
3105 void
3106 rtldexit(Lm_list * lml, int status)
3107 {
3108         if (status) {
3109                 if (rtld_flags & RT_FL_APPLIC) {
3110                         /*
3111                          * If the error buffer has been used, write out all
3112                          * pending messages - lasterr is simply a pointer to
3113                          * the last message in this buffer.  However, if the
3114                          * buffer couldn't be created at all, lasterr points
3115                          * to a constant error message string.
3116                          */




3055                     ((prevptr == NULL) || (strcmp(prevptr, nextptr) != 0))) {
3056                         prevptr = nextptr;
3057                         nextptr = prf.pr_cur;
3058                         *nextptr = '\0';
3059                 }
3060         }
3061         lock = 0;
3062 }
3063 
3064 /*PRINTFLIKE3*/
3065 void
3066 eprintf(Lm_list *lml, Error error, const char *format, ...)
3067 {
3068         va_list         args;
3069 
3070         va_start(args, format);
3071         veprintf(lml, error, format, args);
3072         va_end(args);
3073 }
3074 

3075 /*
3076  * Provide assfail() for ASSERT() statements.  See <sys/debug.h> for further
3077  * details.
3078  */
3079 int
3080 assfail(const char *a, const char *f, int l)
3081 {
3082         (void) printf("assertion failed: %s, file: %s, line: %d\n", a, f, l);
3083         (void) _lwp_kill(_lwp_self(), SIGABRT);
3084         return (0);
3085 }
3086 
3087 void
3088 assfail3(const char *msg, uintmax_t a, const char *op, uintmax_t b,
3089     const char *f, int l)
3090 {
3091         (void) printf("assertion failed: %s (0x%llx %s 0x%llx), "
3092             "file: %s, line: %d\n", msg, (unsigned long long)a, op,
3093             (unsigned long long)b, f, l);
3094         (void) _lwp_kill(_lwp_self(), SIGABRT);
3095 }

3096 
3097 /*
3098  * Exit.  If we arrive here with a non zero status it's because of a fatal
3099  * error condition (most commonly a relocation error).  If the application has
3100  * already had control, then the actual fatal error message will have been
3101  * recorded in the dlerror() message buffer.  Print the message before really
3102  * exiting.
3103  */
3104 void
3105 rtldexit(Lm_list * lml, int status)
3106 {
3107         if (status) {
3108                 if (rtld_flags & RT_FL_APPLIC) {
3109                         /*
3110                          * If the error buffer has been used, write out all
3111                          * pending messages - lasterr is simply a pointer to
3112                          * the last message in this buffer.  However, if the
3113                          * buffer couldn't be created at all, lasterr points
3114                          * to a constant error message string.
3115                          */