- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Bad structure alignment
Operating System - HP-UX
1745904
Members
4369
Online
108723
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
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
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
тАО06-23-2004 10:26 PM
тАО06-23-2004 10:26 PM
Bad structure alignment
Hi
I have a structure
typedef struct ipc_msg {
int msg_size;
char msg_data[1024 * 32];
}ipc_msg;
In a function a local variable of this structure type is declared and used. The function definition looks like:
----------------------------------
int sic_recvmsg(socket_ipc_client *sic, void * msg_data)
{
int ret;
ipc_msg msg;
ret = recv_all(SIC_REC->socket, &msg, 0);
....
----------------------
The problem is that when never I call this function, I get SIGBUS. The last line in coredump is start of function.
When I see the address of 'msg', it gives 0x79739f88. As the sizeof ipc_msg is 32772(32768 + 4), the address is not properly aligned and i guess this is the problem.
Can anybody tell me why this is happening?
I am using gcc 3.3.3 on HP-UX 11.11.
Thanks in advance
Rohan
I have a structure
typedef struct ipc_msg {
int msg_size;
char msg_data[1024 * 32];
}ipc_msg;
In a function a local variable of this structure type is declared and used. The function definition looks like:
----------------------------------
int sic_recvmsg(socket_ipc_client *sic, void * msg_data)
{
int ret;
ipc_msg msg;
ret = recv_all(SIC_REC->socket, &msg, 0);
....
----------------------
The problem is that when never I call this function, I get SIGBUS. The last line in coredump is start of function.
When I see the address of 'msg', it gives 0x79739f88. As the sizeof ipc_msg is 32772(32768 + 4), the address is not properly aligned and i guess this is the problem.
Can anybody tell me why this is happening?
I am using gcc 3.3.3 on HP-UX 11.11.
Thanks in advance
Rohan
- Tags:
- SIGBUS
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2004 07:38 AM
тАО06-24-2004 07:38 AM
Re: Bad structure alignment
0x79739f88 is properly aligned.
Look more closely at what code and address
is generating the SIGBUS. There isn't enough information here to tell what is causing the SIGBUS. If I had to make a guess I would expect to see that "SIC_REC->socket" uses the "sic" parameter and that was passed in as a bad pointer.
Look more closely at what code and address
is generating the SIGBUS. There isn't enough information here to tell what is causing the SIGBUS. If I had to make a guess I would expect to see that "SIC_REC->socket" uses the "sic" parameter and that was passed in as a bad pointer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2004 07:48 AM
тАО06-24-2004 07:48 AM
Re: Bad structure alignment
Compile/link this with the debugging data flag enabled (-g?) and no optimization and then let it die and use the debugger to examine the dump and do a stack trace. This should zero in on the problem -- down to the offending source line. There is nothing wrong with your struct per se although you might be hitting a limit on maximum struct size --- but I doubt it. I'm simply not up to speed on gcc because I don't use it.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2004 04:21 PM
тАО06-24-2004 04:21 PM
Re: Bad structure alignment
Hi
Thanks a lot for your responses.
It turned out to be a different issue!
Thread was hitting the maximum stack size allowed and hence it was giving the SIGBUS.
After increasing the max allowed thread size, its running properly.
Thanks again.
Rohan
Thanks a lot for your responses.
It turned out to be a different issue!
Thread was hitting the maximum stack size allowed and hence it was giving the SIGBUS.
After increasing the max allowed thread size, its running properly.
Thanks again.
Rohan
- Tags:
- stack overflow
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP