LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Re: [linux-edu] war games?

[ILUG] Re: [linux-edu] war games?

Mark Fallon Mark.Fallon at oracle.com
Wed Jun 21 16:51:51 IST 2000


Hi,

Another way goto's are used in the kernel to handle errors is 
when more than one resource is needed e.g:

int some_kernel_func(){
  if (get_res1() != 0){
    err = ERRRES1;
    goto err_exit;
  }
  if (get_res2() != 0){
    err = ERRRES2;
    goto err_exit_res1;
  }
  if (get_res3() != 0){
    err = ERRRES3;
    goto err_exit_res2;
  }


...

	Do something interesting (TM)


....

  err = SUCCESS;
  release_res3();

err_exit_res2:
  release_res2();

err_exit_res1:
  release_res1();

err_exit:
  return(err);
}


-- 
_______________________________________________________________

Mark Fallon			E-mail : Mark.Fallon at oracle.com
Senior Software Engineer	Phone  : +353-1-8033207
Global Product Engineering	Fax    : +353-1-8033221
_______________________________________________________________




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell