HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- INETD and environment
Operating System - HP-UX
1832089
Members
3086
Online
110037
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
12-10-1999 02:56 AM
12-10-1999 02:56 AM
INETD and environment
When I run a C program main(argc, **arcv, **environ)from INETD (tcp), I find
that getenv() returns no env vars, and I cannot set env vars using putenv() or
env(). For example,
system("putenv SYBASE=/usr/Syb11.3");
fprintf(log_file, "SybPath: %s\n", getenv("SYBASE"); .
How do I set/get env vars from a process running via tcp INETD?
that getenv() returns no env vars, and I cannot set env vars using putenv() or
env(). For example,
system("putenv SYBASE=/usr/Syb11.3");
fprintf(log_file, "SybPath: %s\n", getenv("SYBASE"); .
How do I set/get env vars from a process running via tcp INETD?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-1999 07:54 PM
12-12-1999 07:54 PM
Re: INETD and environment
I the lack of environment variables is intentional;
you will have to set up your own PATH and such instead
of relying whatever is there.
As to why the 'system("putenv SYBASE=/usr/Syb11.3");'
fails for you is that there you create a new shell
process (see system(3) manual page) and set the
environment variable in there. As environment
variables are not inherited from a child process to
the parent, the effect of "putenv" ends as soon as
the subsequent shell exits (and the system() call returns).
To set an environment variable in the current process
(and to be inherited by child processes) you'll need
to call the putenv() function call directly without
an intervening shell:
putenv("SYBASE=/usr/Syb11.3");
Hope this helps,
..Juha
you will have to set up your own PATH and such instead
of relying whatever is there.
As to why the 'system("putenv SYBASE=/usr/Syb11.3");'
fails for you is that there you create a new shell
process (see system(3) manual page) and set the
environment variable in there. As environment
variables are not inherited from a child process to
the parent, the effect of "putenv" ends as soon as
the subsequent shell exits (and the system() call returns).
To set an environment variable in the current process
(and to be inherited by child processes) you'll need
to call the putenv() function call directly without
an intervening shell:
putenv("SYBASE=/usr/Syb11.3");
Hope this helps,
..Juha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-1999 11:48 PM
12-12-1999 11:48 PM
Re: INETD and environment
You're right about inheiritance, but the problem I'm having is that within a
process (main()) that's called by INETD, I am unable to successfully set
environment variables, such as by reading my .profile or by using setenv(). If
INETD calls a shell and then I spawn a child process, I can no longer pass data
to/from the client, so INETD must call main() directly.
Thanks, Rodger
process (main()) that's called by INETD, I am unable to successfully set
environment variables, such as by reading my .profile or by using setenv(). If
INETD calls a shell and then I spawn a child process, I can no longer pass data
to/from the client, so INETD must call main() directly.
Thanks, Rodger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-1999 12:51 AM
12-13-1999 12:51 AM
Re: INETD and environment
My apologies to Mr. Laiho for not reading his email carefully enough before I
responded. Calling setenv() directly from main() does work. Thanks for the
help!
Rodger
responded. Calling setenv() directly from main() does work. Thanks for the
help!
Rodger
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