- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- pstat_getproc - Variation of string length of pst_...
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
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
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
тАО12-11-2006 02:14 AM
тАО12-11-2006 02:14 AM
pstat_getproc returns the process name through the pst_ucomm struct member. On some installations of 11.11i, the process name seems to be truncating with only 13 chars and on (most) other installations of 11.11i, the process name comes in as 14 chars.
Could any one please let me know if such they had faced such issues and the workaround / solution for this?
Thanks in advance, Vinod.
PS: I found below link which talks about this, but not completely suggests a solution - http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=195283
Stub (testPstat.c) and results below:
#include
#include
#include
#include
int main ()
{
struct pst_status ProcStat_t;
int Status_i = -1;
errno=0;
Status_i = pstat_getproc (&ProcStat_t, sizeof(ProcStat_t), 0, getpid());
if ( -1 == Status_i || 0 != errno )
{
printf ("Failed to execute pstat_getproc. Status : [%d]\t\t Errno : [%d]\t\t Error Desc : [%s]\n",
Status_i, errno, strerror(errno) );
exit (-1);
}
else
{
printf ("Proc Name : [%s]\n", ProcStat_t.pst_ucomm);
}
}
Server 1:
$: uname -a
HP-UX
$: cc testPstat.c -o testPstattestPstat
$: ./testPstattestPstat
Proc Name : [testPstattestP]
Server 2:
$: uname -a
HP-UX
$: cc testPstat.c -o testPstattestPstat
$: ./testPstattestPstat
Proc Name : [testPstattest]
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2006 02:32 AM
тАО12-11-2006 02:32 AM
Re: pstat_getproc - Variation of string length of pst_ucomm
and welcome to the forums !
Have you compared:
/usr/include/sys/pstat/pm_pstat_body.h
look for "define PST_UCOMMLEN"
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2006 02:48 AM
тАО12-11-2006 02:48 AM
Re: pstat_getproc - Variation of string length of pst_ucomm
Thanks for the fast reply. I did check up on the pm_pstat_body.h header. In both the servers, it is defined in the same way:
#define PST_UCOMMLEN (14 + 1)
Any further pointers?
Cheers,
Vinod.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2006 03:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2006 03:22 AM
тАО12-11-2006 03:22 AM
Re: pstat_getproc - Variation of string length of pst_ucomm
Thanks for the reply. This works perfectly on both my servers.
Could you pls throw some light on why it was not working the same way on server2 initially?
My concern is that we might have missed out applying some patches (?) on server2 which truncated the string length. Or is there any other work around / environment tweak which can be done without changing the existing code?
Cheers,
Vinod.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2006 03:31 AM
тАО12-11-2006 03:31 AM
Re: pstat_getproc - Variation of string length of pst_ucomm
union pstun pst; pst.pst_command=&commande,
Status_i=pstat(PSTAT_GETCOMMANDLINE,
pst, sizeof(commande),1,pid);
# ./a.out
Proc Name : [a.out]
Proc Name : [./a.out]
# cp a.out 0123456789012345678901234567890
# ./0123456789012345678901234567890
Proc Name : [01234567890123]
Proc Name : [./0123456789012345678901234567890]
#
Cheers,
Laurent