HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Printing process name in Shared lib function
Operating System - HP-UX
1833876
Members
1690
Online
110063
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
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
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
07-01-2002 12:49 PM
07-01-2002 12:49 PM
Printing process name in Shared lib function
Hi,
I have 3 functions calling single function
present in shared lib. I want to print these
process names in the shared lib function.
Is there any system call to get process name?
Thanx in Advance
I have 3 functions calling single function
present in shared lib. I want to print these
process names in the shared lib function.
Is there any system call to get process name?
Thanx in Advance
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2002 01:19 PM
07-01-2002 01:19 PM
Re: Printing process name in Shared lib function
Depending upon the compiler/linker you use a global variable is set. Man crt0 for details.
The scheme is this:
extern char **__argv_value;
/* yours may be __argv */
.....
.....
(void) printf("Process: %s\n",__argv_value[0]);
---------------------------------------------
A far mode portable method is to do a getpid() and then a popen() call to ps -p pid.
The scheme is this:
extern char **__argv_value;
/* yours may be __argv */
.....
.....
(void) printf("Process: %s\n",__argv_value[0]);
---------------------------------------------
A far mode portable method is to do a getpid() and then a popen() call to ps -p pid.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 02:00 AM
07-11-2002 02:00 AM
Re: Printing process name in Shared lib function
Define another function initname(const char*)for the shared library, which you call at the beginning of main( .... argv) { initname(argv[0]); ...
char* processname;
void initname(const char* name ) {
processname = name;
}
you can access processname in all (shared) functions.
Thanks,
Klaus
char* processname;
void initname(const char* name ) {
processname = name;
}
you can access processname in all (shared) functions.
Thanks,
Klaus
There is a live before death!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2002 05:42 AM
07-16-2002 05:42 AM
Re: Printing process name in Shared lib function
assigning points to the replies is as easy as reading them, at least easier than providing the answers.
There is a live before death!
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
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP