LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-16-2007, 12:33 AM   #1
jaysrikrishna
LQ Newbie
 
Registered: Oct 2007
Posts: 21

Rep: Reputation: 15
system call


I didn't found any answer for the relationship between
sigsetjmp(env),siglongjmp(env,2),setjmp(env) and longjmp(env,1) ,
can any one answer me this in context that how they related with each other with respect to variable env .

Last edited by jaysrikrishna; 12-16-2007 at 12:35 AM.
 
Old 12-16-2007, 03:50 AM   #2
KrahnacK
Member
 
Registered: Nov 2007
Location: /dev/volcano
Posts: 70

Rep: Reputation: 15
i took a look at : http://man.he.net/man3/setjmp

it says :
Code:
       setjmp() saves the stack context/environment in
       env for later use by longjmp().  The stack context will be
       invalidated if the function which called setjmp() returns.

       If  you  want  to  save   signal   masks,   use
       sigsetjmp(3).
i'm just curious about why do people actually need these instead of calling a new function ?
 
Old 12-16-2007, 04:28 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
People use them because they can provide a sort of exception handling that let's you unroll the function call stack back to a predetermined point in the event of some sort of error. This can be used to implement a sort of try ... catch semantic in C. However, it makes the program quite unreadable and definitely lives in the land of guru-level C tricks,
 
Old 12-16-2007, 05:12 PM   #4
KrahnacK
Member
 
Registered: Nov 2007
Location: /dev/volcano
Posts: 70

Rep: Reputation: 15
all right, i think i get the point (i didn't seen it that way)

thanks for enlightening me
 
Old 12-17-2007, 01:45 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
And, by the way, these functions aren't system calls.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM
How do I include my own system call in file system driver kgp Linux - Kernel 3 06-06-2007 10:41 AM
system system call usage sureshkellemane Programming 3 03-20-2007 12:41 AM
list file system linux supports "please give the command or system call" varun_shrivastava Linux - General 4 01-09-2007 07:28 AM
Calling a system call from a system call? Loc_8 Programming 0 09-16-2006 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration