Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 124819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:03:39+00:00 2026-05-11T05:03:39+00:00

In Perl, I need to read the environment of other processes. The script is

  • 0

In Perl, I need to read the environment of other processes.

  • The script is running with root privileges.
  • The script will be running in both Linux and Solaris.
  • I would like a solution that’s mostly platform agnostic, at least between Linux and Solaris. In Linux, examining the /env/<proc_id>/environ can get me the answer.
  • I would like to avoid having to fork. I already have a solution forking ‘/usr/ucb/ps -auxwwwe $pid’

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:03:39+00:00Added an answer on May 11, 2026 at 5:03 am

    For Solaris, you could try the procfs module from CPAN. Even though this module still seems quite young, this quote sounds hopeful:

    Brian Farrell sent a very useful patch which handles inspection of argv and environment of processes other than the currently running process.

    I imagine that this is probably just the initial environment (just like the environ file under linux), but that seems to be what you want?

    Otherwise, although I see you say you don’t want to fork, a simple solution would probably to crank ~20 lines of C to produce a small program that just spits out the environment on Solaris as the exact equivalent of the Linux environ file. I have something very similar in C already. If you’re interested, I can post it.

    EDIT (after reading OpenSolaris pargs.c): The environment buffer is reallocated under Solaris when the environment changes, so the psinfo pointer may be invalid. For a bullet proof solution, you need to hunt down _environ. That’s all probably more hassle than you need… pargs -e <pid> might be a nicer alterative to UCB ps(1) if you do go the fork route, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a Perl script to read in a file, and delete
I need to create XML in Perl. From what I read, XML::LibXML is great
In a shell-script (or Perl) I need a subroutine that returns for all my
I need a Perl script to spawn itself with an arbitrary name, i.e. so
I have Perl script and need to determine the full path and filename of
Ok, read that again. I need to open a windows prompt WITH perl. This
I need to make a script to read images from a directory, rename them,
I need to make a script that automates the following: Read comma or tab
I have written a Perl script to read the configuration file and create CGI
I need to communicate with a serial port inside a Perl script. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.