Print this page
5042 stop using deprecated atomic functions


 357 
 358         if (fm_nvprintr(nvl, 0, c, ereport_cols) != 0)
 359                 console_printf("\n");
 360 
 361         console_printf("\n");
 362 }
 363 
 364 /*
 365  * Wrapper for panic() that first produces an FMA-style message for admins.
 366  * Normally such messages are generated by fmd(1M)'s syslog-msgs agent: this
 367  * is the one exception to that rule and the only error that gets messaged.
 368  * This function is intended for use by subsystems that have detected a fatal
 369  * error and enqueued appropriate ereports and wish to then force a panic.
 370  */
 371 /*PRINTFLIKE1*/
 372 void
 373 fm_panic(const char *format, ...)
 374 {
 375         va_list ap;
 376 
 377         (void) casptr((void *)&fm_panicstr, NULL, (void *)format);
 378 #if defined(__i386) || defined(__amd64)
 379         fastreboot_disable_highpil();
 380 #endif /* __i386 || __amd64 */
 381         va_start(ap, format);
 382         vpanic(format, ap);
 383         va_end(ap);
 384 }
 385 
 386 /*
 387  * Simply tell the caller if fm_panicstr is set, ie. an fma event has
 388  * caused the panic. If so, something other than the default panic
 389  * diagnosis method will diagnose the cause of the panic.
 390  */
 391 int
 392 is_fm_panic()
 393 {
 394         if (fm_panicstr)
 395                 return (1);
 396         else
 397                 return (0);




 357 
 358         if (fm_nvprintr(nvl, 0, c, ereport_cols) != 0)
 359                 console_printf("\n");
 360 
 361         console_printf("\n");
 362 }
 363 
 364 /*
 365  * Wrapper for panic() that first produces an FMA-style message for admins.
 366  * Normally such messages are generated by fmd(1M)'s syslog-msgs agent: this
 367  * is the one exception to that rule and the only error that gets messaged.
 368  * This function is intended for use by subsystems that have detected a fatal
 369  * error and enqueued appropriate ereports and wish to then force a panic.
 370  */
 371 /*PRINTFLIKE1*/
 372 void
 373 fm_panic(const char *format, ...)
 374 {
 375         va_list ap;
 376 
 377         (void) atomic_cas_ptr((void *)&fm_panicstr, NULL, (void *)format);
 378 #if defined(__i386) || defined(__amd64)
 379         fastreboot_disable_highpil();
 380 #endif /* __i386 || __amd64 */
 381         va_start(ap, format);
 382         vpanic(format, ap);
 383         va_end(ap);
 384 }
 385 
 386 /*
 387  * Simply tell the caller if fm_panicstr is set, ie. an fma event has
 388  * caused the panic. If so, something other than the default panic
 389  * diagnosis method will diagnose the cause of the panic.
 390  */
 391 int
 392 is_fm_panic()
 393 {
 394         if (fm_panicstr)
 395                 return (1);
 396         else
 397                 return (0);