- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: struct utsname throwing error : Value too larg...
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
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
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
06-16-2011 09:07 PM
06-16-2011 09:07 PM
struct utsname throwing error : Value too large to be stored in data type
I am trying to fetch sysname and nodename using struct utsname. I have two HP-UX servers on with 10 characters and other with 13 characters host name. For the first one I am getting truncated 8 characters as output but for the second one i am getting "Value too large to be stored in data type" error. Why this is so ?
What should I do to avoid getting this error ?
Here is the sample code which I am using :
code:
#include
#include
int main()
{
struct utsname uts;
if(uname(&uts) != -1)
{
printf("\n sysname :%s",uts.sysname);
printf("\n nodename :%s",uts.nodename);
}
else
{
printf( "Error fetching uname: %s\n", strerror( errno ) );
perror( "Error fetching uname :" );
}
return 0;
}
- Tags:
- uname
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2011 01:23 AM
06-17-2011 01:23 AM
Re: struct utsname throwing error : Value too large to be stored in data type
You can configure the kernel so that it gives that above error if longer than 8, rather than silently truncating it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2011 03:32 AM
06-17-2011 03:32 AM
Re: struct utsname throwing error : Value too large to be stored in data type
And regarding kernel configurations to throw this error rather than truncating the same, if you could let me know what changes to kernel will make me get first 8 bytes will be great.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2011 04:09 PM
06-17-2011 04:09 PM
Re: struct utsname throwing error : Value too large to be stored in data type
With what options?
Have you looked at uname(2), nodehostnamesize(5) and uname_eoverflow(5)? They point to the whitepaper "Node and Host Name Sizes on HP-UX: Using the Expanded Capabilities":
http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c01925495/c01925495.pdf
To turn off error reporting:
kctune uname_eoverflow=0
There is a warning that in the future it may not truncate but just return an empty string and suggests calling gethostname(2).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 05:48 AM
06-27-2011 05:48 AM
Re: struct utsname throwing error : Value too large to be stored in data type
Hi, thanks for giving a link for the whitepaper. http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c01925495/c01925495.pdf
What I did is, on the machine where I am getting truncated name, tried setting "
kctune uname_eoverflow=1" so that I can reproduce the error. But when I ran my sample CPP program, I got truncated node name!! Basically either setting this value to 0 or 1 is always returning my the truncated node name. I am not able to reproduce the error in my first box.
Could not try this on second box as this is a production setup. Once I am sure that setting this properly really works as expected, will try it on the box where I am getting this error.
Any idea why this is so?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2011 11:03 PM
06-27-2011 11:03 PM
Re: struct utsname throwing error : Value too large to be stored in data type
>I got truncated node name!! Basically either setting this value to 0 or 1 is always returning me the truncated node name. I am not able to reproduce the error in my first box.
I would expect that error and possibly a truncated name. I wouldn't think the 10 vs. 13 length would suppress the error.
>will try it on the box where I am getting this error.
I thought you didn't want the error? And were OK with the name being truncated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2011 12:37 PM
06-28-2011 12:37 PM
Re: struct utsname throwing error : Value too large to be stored in data type
If using expanded nodename / hostname feature on HP-UX 11i v3, you need to add the option -D_HPUX_API_LEVEL=20040821 to compile line in respective make files. This option will enable selection of expanded utsname structure from /usr/include/sys/utsname.h
Regards
-Rajesh