- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sem_wait, core dump
Operating System - HP-UX
1822909
Members
3748
Online
109645
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
Forums
Discussions
юдл
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-18-2004 04:09 AM
тАО05-18-2004 04:09 AM
sem_wait, core dump
The following code snippet throws a Memory fault(coredump)on HP-UX 11i
---------------8<----------------------
#include
int main (int argc, char *argv[]){
sem_t* semt;
semt = sem_init(semt,1,0);
if (sem_wait(semt) < 0 )
perror ("wait error ");
}
---------------8<----------------------
The program was compiled with the following command line
cc -o sem_try -g try_sem.c -lrt
What seems to be wrong with the program ...
regards
---------------8<----------------------
#include
int main (int argc, char *argv[]){
sem_t* semt;
semt = sem_init(semt,1,0);
if (sem_wait(semt) < 0 )
perror ("wait error ");
}
---------------8<----------------------
The program was compiled with the following command line
cc -o sem_try -g try_sem.c -lrt
What seems to be wrong with the program ...
regards
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-18-2004 05:01 AM
тАО05-18-2004 05:01 AM
Re: sem_wait, core dump
Well the fundamental problem is your sem_init. Note that no memory has been allocated for what semt points to and also sem_init returns an int.
sem_t semt;
int cc = 0;
cc = sem_init(&semt,1,0);
if (cc == 0)
{
if (sem_wait(&semt) < 0) perror("wait_error");
}
sem_t semt;
int cc = 0;
cc = sem_init(&semt,1,0);
if (cc == 0)
{
if (sem_wait(&semt) < 0) perror("wait_error");
}
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-18-2004 04:35 PM
тАО05-18-2004 04:35 PM
Re: sem_wait, core dump
Thanks for the response, how can the same functionality be acheived using sem_open instead of sem_init ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-19-2004 05:07 AM
тАО05-19-2004 05:07 AM
Re: sem_wait, core dump
Well, here's a 3 minute example. Note that you can safely use O_CREAT each time to create a named semaphore and it will create one if needed. The sem_unlink should probably only be used when the sema4 is no longer needed.
Attached is sem.c
Compile like this:
cc sem.c -lrt -o sem
Attached is sem.c
Compile like this:
cc sem.c -lrt -o sem
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP