1819502 Members
3403 Online
109603 Solutions
New Discussion юеВ

uname

 
AMAT SA
Advisor

uname

I have a system name which is longer than 8 characters. Every thing is fine except uname returns only the first 8 characters. Can some one please let me know if there is a fix for this. I am using HPUX 11.11 on an rp7420.
6 REPLIES 6
Sudeesh
Respected Contributor

Re: uname

Hi,

As of my knowledge, no patch is available for HPUX 11.11 to fix this issue. I heard HPUX 11.31 will have uname supporting more than 8 charactors.

Hope this helps

Sudeesh
The most predictable thing in life is its unpredictability
Joseph Loo
Honored Contributor

Re: uname

hi,

u may like to refer to this doc:

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000068695446
-> on the limit set for hostname and uname.


regards.
what you do not see does not mean you should not believe
Muthukumar_5
Honored Contributor

Re: uname

You can have hostname with only 8 characters with uname. It is limited one.

hth.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: uname

Hostname with uname command is limited with a macro called UTSLEN. Nodename can be set as,

uname -S

and length will be UTSLEN-1. UTSLEN macro is defined as,

# define UTSLEN 9

so it will keep upto 8 characters.

see in file.

hth.
Easy to suggest when don't know about the problem!
vinod_25
Valued Contributor

Re: uname

hi Amat

This is not tested but try it on a test server...what i got from MAN pages are sorted below...

from the MAN pages of uname(1):

Change the node name (system name) to nodename.
nodename is restricted to UTSLEN-1 characters (see uname(2)). See WARNINGS. Only users with appropriate privileges can use the -S option.

from the MAN pages of uname(2):

The utsname structure, defined in , is set up as
follows:

#define UTSLEN 9
#define SNLEN 15

char sysname[UTSLEN];
char nodename[UTSLEN];

_______________________________________


setuname()
The setuname() system call sets the node name (system name), as returned in the nodename field of the utsname structure, to name, which has a length of namelen characters. This is usually executed by /sbin/init.d/hostname at system boot time. Names are limited to UTSLEN - 1 characters; UTSLEN is defined in .

The sethostname() system call sets the name of the host processor to name, which has a length of namelen characters. At system boot time sethostname() is normally executed by the hostname command (see hostname(1)) in the /sbin/init.d/hostname script. Host names are limited to MAXHOSTNAMELEN characters, as defined in
______________________________________

editing the entries in /usr/include/sys/utsname.h

# define _SYS_NMLN 9
# define UTSLEN _SYS_NMLN

you can change the _SYS_NMLN value to the desired nodename length + 1 ...

Try changing the system name...

try this on a test server before trying it on a production one... as this is not tested and are as per the MAN pages...

Good Luck

Vinod K
Mahesh Kumar Malik
Honored Contributor

Re: uname

Hi Amat

If you convert your OS to Trusted system environment, you can have longer host names.

Regards
Mahesh