Re: Asserts in kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 18, 2008 at 09:38:40PM -0400, Rik van Riel wrote:
> On Fri, 18 Apr 2008 17:34:33 -0700
> "Mrunal Gawade" <mrunal.gawade@xxxxxxxxx> wrote:
> 
> > Does Linux kernel has assert?   I am trying to port a user land program with
> > asserts and want to use them in kernel too. What is the header file in which
> > its declared, if it is. I tried "grep" and other commands but could not
> > find.
> 
> You can use BUG_ON() with a condition that should not happen
> between the braces.
> 
> assert(foo) is the equivalent of BUG_ON(!(foo))

Please use WARN_ON() if it isn't _really_ fatal.

BUG_ON() is panic(), and it's more user friendly to give the admin the 
chance to properly shutdown the system.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux