- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Problems with SIGTERM and libBSD (HP-UX B.11.0...
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
Forums
Discussions
Discussions
Discussions
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
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
05-03-2007 05:00 AM
05-03-2007 05:00 AM
Problems with SIGTERM and libBSD (HP-UX B.11.00 U 9000/800)
Given then program below (foo.C):
#include
#include
#include
void sigterm_proc(int s)
{
cout << "sigterm_proc " << s << endl;
}
int main()
{
signal(SIGTERM, sigterm_proc);
sleep(60);
cout << "wake up" << endl;
}
When I compile it with "aCC -lcl k2.c" and send a SIGTERM signal (kill pid) the output is:
sigterm_proc 15
wake up
But if I compile it with "aCC -lcl -lBSD foo.C" the output is:
sigterm_proc 15
and the process doesn't wake up. Is there any bug is libBSD library?
Thanks in advance,
Jose Luis.
- Tags:
- SIGTERM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2007 05:47 AM
05-03-2007 05:47 AM
Re: Problems with SIGTERM and libBSD (HP-UX B.11.00 U 9000/800)
I suspect that your seconds example is not quite complete in that the program will terminate and print "wake up" after the sleep terminates.
Without testing, I am assumming that the sleep() function behaves as documented in that any caught signal terminates the sleep as well as its normal SIGALRM behavior. When libBSD is linked in, the sleep function there does not terminate upon the receipt of a caught signal.
You can verify this by using tusc to attach to the two versions but I am all but sure that it is the behavior of the sleep function that changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2007 04:11 PM
05-03-2007 04:11 PM
Re: Problems with SIGTERM and libBSD (HP-UX B.11.00 U 9000/800)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2007 07:04 PM
05-03-2007 07:04 PM
Re: Problems with SIGTERM and libBSD (HP-UX B.11.00 U 9000/800)
What is useful for the libBSD library? What is does change the standard behavior of sleep?
If I don't use libcl the program runs fine. I don't understand why.
Thanks for your replies.
Regards,
Jose Luis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2007 06:39 PM
05-04-2007 06:39 PM
Re: Problems with SIGTERM and libBSD (HP-UX B.11.00 U 9000/800)
I would assume you knew that since you must have some good reason for using it?? If not, junk it ASAP. Looking at some man pages may mention using libBSD.
>If I don't use libcl the program runs fine. I don't understand why.
I don't know either except you have libcl before AND after libBSD and that may cause libcl to use the foreign devil versions in libBSD instead of libc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2007 10:17 PM
05-07-2007 10:17 PM
Re: Problems with SIGTERM and libBSD (HP-UX B.11.00 U 9000/800)
tusc shows:
libBSD:
[5134] sigaction(SIGTERM, 0x7f7f0f08, 0x7f7f0f30) ........ = 0
[5134] sigprocmask(SIG_BLOCK, 0x7f7f0ed8, 0x7f7f0ef8) .... = 0
[5134] getitimer(ITIMER_REAL, 0x7f7f0f18) ................ = 0
[5134] time(NULL) ........................................ = 1178618346
[5134] sigtimedwait(0x7f7f0f28, NULL, 0x7f7f0f48) ........ [sleeping]
[5134] Received signal 15, SIGTERM, in sigtimedwait(), [caught], no siginfo
[5134] sigtimedwait(0x7f7f0f28, NULL, 0x7f7f0f48) ........ ERR#4 EINTR
[5134] Received signal 26, SIGCONT, in sigenable(), [SIG_DFL], no siginfo
[5134] write(1, "s i g t e r m _ p r o c 1 5 \n", 16) .. = 16
[5134] sigtimedwait(0x7f7f0f28, NULL, 0x7f7f0f48) ........ [sleeping]
No libBSD:
[5253] sigprocmask(SIG_SETMASK, 0x7f7f0f60, 0x7f7f0f80) .. = 0
[5253] sigprocmask(SIG_SETMASK, 0x7f7f0f80, 0x7f7f0f60) .. = 0
[5253] sigsetreturn(0x7b036fbe, 0x6211988, 1392) ......... = 0
[5253] sigprocmask(SIG_SETMASK, 0x7f7f0f60, 0x7f7f0f80) .. = 0
[5253] sigprocmask(SIG_SETMASK, 0x7f7f0f80, 0x7f7f0f60) .. = 0
[5253] sigvec(SIGTERM, 0x7f7f0ec0, 0x7f7f0ed0) ........... = 0
[5253] sigprocmask(SIG_BLOCK, 0x7f7f0ed8, 0x7f7f0ef8) .... = 0
[5253] getitimer(ITIMER_REAL, 0x7f7f0f18) ................ = 0
[5253] time(NULL) ........................................ = 1178618480
[5253] sigtimedwait(0x7f7f0f28, NULL, 0x7f7f0f48) ........ [sleeping]
[5253] Received signal 15, SIGTERM, in sigtimedwait(), [caught], no siginfo
[5253] sigtimedwait(0x7f7f0f28, NULL, 0x7f7f0f48) ........ ERR#4 EINTR
[5253] Received signal 26, SIGCONT, in sigenable(), [SIG_DFL], no siginfo
[5253] write(1, "s i g t e r m _ p r o c 1 5 \n", 16) .. = 16
[5253] time(NULL) ........................................ = 1178618491
[5253] sigprocmask(SIG_SETMASK, 0x7f7f0ef8, NULL) ........ = 0
[5253] write(1, "w a k e u p \n", 8) ................... = 8
[5253] exit(0) ........................................... WIFEXITED(0)
So libBSD probably changes signal(2) to sigaction(2) and sets SA_RESTART?