I have a Linux kernel hack which causes special behavior based
on a process's environment. Strangely, unix kernels are aware
of each process's environment, and with Linux it is visible as
/proc/*/environ. The hack works wonderfully.
My problem is I am writing test regression scripts in perl. Modifying %ENV doesn't actually call setenv() to change it for the OS to see, thus my kernel trick is not tested. How can I make perl "flush" the environment?
The perlvar man page says fork() causes the children to receive environment updates, but in my testing it is exec()
which does the magic. Damn.
Sadly, calling system() or qx// or something that calls exec() does not flush the environment of the parent, only the child. :-(
In other words, I challenge you to modify /proc/self/environ in perl without calling exec().
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.