- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- C-compile openvms alarm/setjmp/longjmp/signal
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2008 05:52 AM
тАО12-19-2008 05:52 AM
C-compile openvms alarm/setjmp/longjmp/signal
Base source:
#include
#include
#include
static jmp_buf jbuf;
unsigned char lijn[1024];
int cnt;
static alarmroutin()
{
alarm(0);
longjmp(jbuf,TRUE);
}
static my_read(lijn,cnt)
char *lijn;
int cnt;
{
int alarmroutin();
if (setjmp(jbuf)) return FALSE;
signal (SIGALRM, alarmroutin);
alarm(10);
*lijn='\0';
printf ("\n geef iets %d :",cnt);gets(lijn);
alarm(0);
return strlen(lijn);
}
main()
{
unsigned char *p;
int i,my_read();
cnt=0;
while (cnt < 100000000){
i=my_read(lijn,cnt);
alarm(0);
cnt++;
printf("\n%d\n",i);
if (strstr(lijn,"STOP")) break;
}
}
What is wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2008 09:55 AM
тАО12-20-2008 09:55 AM
Re: C-compile openvms alarm/setjmp/longjmp/signal
Start of the corrected program:
#include
#include
#include
#include
#include
#include
#include
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
static jmp_buf jbuf;
unsigned char lijn[1024];
int cnt;
static void alarmroutin(int sig)
{
alarm(0);
longjmp(jbuf,TRUE);
}
static my_read(lijn,cnt)
char *lijn;
int cnt;
{
if (setjmp(jbuf)) return FALSE;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2008 10:00 AM
тАО12-20-2008 10:00 AM
Re: C-compile openvms alarm/setjmp/longjmp/signal
Oh, and under Linux/gcc it has the inverse effect: alarm never fires again after the first time ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2008 07:29 PM
тАО12-20-2008 07:29 PM
Re: C-compile openvms alarm/setjmp/longjmp/signal
This is probably due to the fact you aren't using sigsetjmp/siglongjmp to save the signal masks.
Some OSes will block the current signal upon entry to the signal handler and unblock on exit. Other OSes will only block the signal if specified in sigaction(2). HP-UX will not block it for signal(2) so my similar test program works fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2008 07:06 AM
тАО12-22-2008 07:06 AM
Re: C-compile openvms alarm/setjmp/longjmp/signal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2008 08:26 AM
тАО12-22-2008 08:26 AM
Re: C-compile openvms alarm/setjmp/longjmp/signal
(If this is Itanium, tossing around lots of signals - once you get it all working - tend to be bad performance news, too.)
What's the background on this requirement? OpenVMS platform, code portability requirements, OpenVMS version, etc?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2008 08:59 AM
тАО12-22-2008 08:59 AM
Re: C-compile openvms alarm/setjmp/longjmp/signal
compile DECC$COMPILER V7.1-015, but in the future it will be INTEGRITY OPENVMS 8.3-1H1
with c-compile HP I64VMS C V7.3-18.
The behaver of the program is the same on two platforms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 02:43 AM
тАО12-23-2008 02:43 AM