Software :: Protect Environment Variables To Be Changed By Child Processes?

Jul 20, 2010

Im wondering if there is a simple way to protect environment variables to be changed by child processes?

View 1 Replies


ADVERTISEMENT

Programming :: Memory Optimization For Child Processes?

Sep 6, 2010

I work on Linux for ARM processor for cable modem. There is a tool that I have written (as the job demands) that sends/storms customized UDP packets using raw sockets. I form the packet from scratch so that we have the flexibility to play with different options. This tool is mainly for stress testing routers.

The details are here.

I actually have multiple interfaces created. Each interface will obtain IP addresses using DHCP. This is done in order to make the modem behave as virtual customer premises equipment (vcpe).

When the system comes up, I start those processes that are asked to. Every process that I start will continuously send packets. So process 0 will send packets using interface 0 and so on. Each of these processes that send packets would allow configuration (change in UDP parameters and other options at run time). Thats the reason I decide to have separate processes.

I start these processes using fork and excec from the provisioning processes of the modem.

The problem now is that each process takes up a lot of memory. Starting just 3 such processes, causes the system to crash and reboot.

I have tried the following:- 1-I have always assumed that pushing more code to the Shared Libraries will help. So when I tried moving many functions into shared library and keeping minimum code in the processes, it made no difference to my surprise.

2-I also removed all arrays and made them use the heap. However it made no difference. This maybe because the processes runs continuously and it makes no difference if it is stack or heap?

3-I suspect the process from I where I call the fork is huge and that is the reason for the processes that I make result being huge. I am not sure how else I could go about. say process A is huge -> I start process B by forking and excec. B inherits A's memory area. So now I do this -> A starts C which inturn starts B will also not help as C still inherits A?. I used vfork as an alternative which did not help either. I do wonder why.

reduce the memory used by each independent child processes.

View 1 Replies View Related

Programming :: Creating Child Processes In A Script?

Oct 14, 2010

the wrong part of the forum but basically im working on a project and getting no where what so ever and i was wondering if i could get your help. Basically i have to create two scripts do:

The parent script which is going to:
o spawn several child processes.
o keep track of the progress of the child processes.

[code]...

View 1 Replies View Related

General :: Finding All Attached Child Processes

Nov 17, 2010

I want to check all the child processes attached to a specific process. Say for a example; my process is a java process. Then I wanna know what are the processes attached to that java process. At the moment I use the command # ps aux|grep java; this gives the details about the currently running java process. So I can kill the whole java process using #kill -9 {pid} ...but there are sub processes attached (I guess child processes) to java process. I wanna view all of them & kill whatever the process I like not the whole thing. I'm using Red hat 5 enterprise edition. and currently a weblogic application server is running on that.

View 2 Replies View Related

General :: Memory Optimization For Child Processes?

Sep 6, 2010

I work on Linux for ARM processor for cable modem. There is a tool that I have written (as the job demands) that sends/storms customized UDP packets using raw sockets. I form the packet from scratch so that we have the flexibility to play with different options. This tool is mainly for stress testing routers.I actually have multiple interfaces created. Each interface will obtain IP addresses using DHCP. This is done in order to make the modem behave as virtual customer premises equipment (vcpe).

When the system comes up, I start those processes that are asked to. Every process that I start will continuously send packets. So process 0 will send packets using interface 0 and so on. Each of these processes that send packets would allow configuration (change in UDP parameters and other options at run time). Thats the reason I decide to have separate processes. I start these processes using fork and excec from the provisioning processes of the modem. The problem now is that each process takes up a lot of memory. Starting just 3 such processes, causes the system to crash and reboot.

I have tried the following:-

1-I have always assumed that pushing more code to the Shared Libraries will. when I tried moving many functions into shared library and keeping minimum code in the processes, it made no difference to my surprise.

2-I also removed all arrays and made them use the heap. However it made no difference. This maybe because the processes runs continuously and it makes no difference if it is stack or heap?

3-I suspect the process from I where I call the fork is huge and that is the reason for the processes that I make result being huge. I am not sure how else I could go about. say process A is huge -> I start process B by forking and excec. B inherits A's memory area. So now I do this -> A starts C which inturn starts B will also not help as C still inherits A?. I used vfork as an alternative which did not help either. I do wonder why.

View 1 Replies View Related

Programming :: Ipc Between Parent And Child Processes Using Pipe?

Oct 13, 2010

If a process forks its child and communicate with the child using pipe, do closing the write end of the pipe and terminating the writing process have the same effect?

View 3 Replies View Related

Server :: Finding Child Processes Spawned From Screen?

Aug 25, 2010

I have a situation where I have several screen (/usr/bin/screen) sessions running. 2 of the screen sessions (ps1 and ps2) run a script that launched SipP with specific parameters. 1 script starts SipP and has it make 50 calls where the other makes only 20 calls. However The script is configured where we can change how many calls it makes if needed.

So the problem is, due to issues with SipP, we must restart everything every 12 hours (at maximum). So I am trying to work out scripts to stop the SipP processes cleanly. In order to do so I need to figure out which SipP process is spawned by which screen. i.e. which sipp was started by screen session ps1, and which one was started by screen session ps2.

Now I can do ps -ef | grep <number of calls configured> to find out but then I would have to change my stop script every time we reconfigure how many calls are made, and have a separate stop script for each screen session. I would much rather be able to send the screen name as a parameter to the stop script and have it work no matter how many calls SipP is configured to make.Also your standard kill -1 <PID> does not shutdown SipP cleanly. So working out those details is a bit more tricky. Anyone know how I can determine what processes are spawned from a specific screen session?

View 2 Replies View Related

Programming :: Find Number Of Child Processes (C / POSIX)?

May 26, 2010

I'm in the process of writing a program that is a server- it will accept connections and stuff, and spawn a child process for each. However, i've run into a small problem. I do NOT want to bother with keeping track of the processes unless i need to. So, i set SA_NOCLDWAIT (#ifdef) on a SIG_IGN to the SIGCHLD handler through sigaction interface. The standard says that it the kernel will then keep track of reaping zombie processes for me (a HUGE plus). However, upon receiving a SIGINT signal, i want to stop the server from accepting new connections (done), and then wait for there to be no new connections. I was thinking of just putting a loop like so:

Code:

while((wait(NULL) != (pid_t)-1) && errno != ECHILD);

However, I'm not *sure* that this will work, especially with SIGCHLD still ignored. So how can i tell if there are still child processes? I can't find any call like int getnumchld(pid_t proc); (i wish). Plus it would be inefficient to spin on that function anyway. OTOH, i would rather *NOT* have to do the same thing in a loop with a system("ps |...>file"); read(file); etc. either. Is there a way i can portably implement this feature (I was hoping i could run it on linux and the major BSDs, at least).

TO SUM IT UP:

How can i tell if a process has no child processes if i've SIG_IGN'd SA_NOCLDWAIT'd the SIGCHLD? Is there a _reasonably_ portable way to do so? I *don't* want to manually wait for EVERY process. Maybe only those still active at the time of SIGTERM, but that requires keeping track of the number of connections and whether those have terminated...

EDIT: Does anyone know if the above code *would* work, even with SIGCHLD ignored and the kernel cleaning up zombies *for* me? I checked the manpage and it doesn't say much.

EDIT1: Note that all of the processes are in the same process group and session. SO i can find them through this as well. Perhaps even setting the uid/gid and finding all processes run by that group?

EDIT2: i have an idea if the above isn't feasible. If there is no "elegant" way to do it, i could reduce the complexity by sending a SIGUSR1 to the whole process group. Each process would then set a flag telling it to send a SIGUSR1 in reply and send a SIGUSR2 when it is done executing. Then i could keep a count of signals. Maybe that would be *easier*. Or perhaps a count of all child processes and just a termination signal to decrement the counter.

View 2 Replies View Related

Programming :: Perl - Multiple Child Processes In Parallel?

Sep 3, 2010

I'm looking for a way in Perl to be able to take a list of servers, ssh multiple commands to it and store the results. If I do this process serially, sometimes one server will hang the whole script and if it doesn't, it still takes hours to complete.

I'm thinking what I need to do is make a parent loop that calls out a separate process that passes the server name to the child sub process and then executes all the commands I have defined in its own process. If one server 'hangs', at least that won't stop the script from doing all the other servers in the list.

I'm guessing using the fork() command would serve me best, however, all the online descriptions I have found have been vague at best.

View 4 Replies View Related

General :: Child Processes Of A Parent Process Occupying Socket Memory?

Jul 22, 2010

I am facing an issue where the process starts hanging. When I closely look at the logs I come to know that some of the child processes that are forked by the parent process are not finished.

1) Is it possible that the child processes that are not finished occupy the socket memory of the parent process and ultimately a point is reached where no socket memory is available to fork new child processes.

2) What is the standard limit of socket memory in linux?

3) What is the fate of such child processes (as I have mentioned above)?

4) How to debug such cases so that the exact problematic area is identified?

View 2 Replies View Related

General :: Find All Child Processes Of A Parent Process Given To Script As Argument?

Feb 15, 2011

well i have just started with shell scripting...how to find all child processes of a parent process given to script as argument.

View 10 Replies View Related

Programming :: Perl Child Processes Become Zombie On A Multi-core Processor?

Apr 11, 2011

I have written a simple script which has to find required patterns from a bunch of files ( where each file is around 2 GB each,which contain the output of seq 1 10000000000000) on an 8 core machine.I am current forking 6 child processes which run simultaneously on 6 cores of the processor & have to search for the required pattern in 6 different files & inform the parent process when a pattern is found using a PIPE.

The problem is,when a child process is done reading a text file looking for a pattern,it is becoming a zombie process.It exits cleanly when i put a $SIG{CHLD} = "IGNORE"; in the script.Can any one tell me whats going on & how do i improve the communication between child and parent processes?

Code:
#!/bin/perl
use strict;

[code]...

View 3 Replies View Related

Fedora :: How To Set Environment Variables

May 18, 2010

I just installed valgrind on my Fedora12 machine.

$ valgrind // 1
$ valgrind: Command not found. //error
$ /usr/local/bin/valgrind // 2 works fine

[code]...

View 3 Replies View Related

Debian :: Python 2.7 Can't See OS Environment Variables

Aug 23, 2015

I'm trying to compile Ardour on jessie amd64 using the Debian source code (there's already an ardour package but I want to use different compile options). I've applied the Debian patches and have all the required dependencies installed.

Scons quits with a KeyError message from python2.7 saying that os.environ['DEB_HOST_ARCH_OS'] is not defined.

Checking with 'dpkg-archtecture -l' shows that DEB_HOST_ARCH_OS=linux, but 'print os.environ["DEB_HOST_ARCH_OS"]' in python says that name 'os' is not defined. The scons script has 'import os' at the top so it should be seeing it.

How do I make this visible to python (I'm assuming this problem is specific to the jessie python2.7 installation and not python in general)?

View 1 Replies View Related

Fedora :: Changing Environment Variables?

Oct 11, 2009

How do I edit my .bash_profile so recursive directories are on my path without manually typing all the directories? For example, I want to have /home/woodenbox/SU, /home/woodenbox/SU/bin, /home/woodenbox/SU/bin/src, etc on my path without actually having to write the paths for all the subdirectories

View 3 Replies View Related

Fedora :: How To Set Environment Variables Permenently

May 3, 2011

How to set JAVA_HOME environment variables permanently such that it will not have to be set each time it has to be used.

View 5 Replies View Related

General :: Any Other Ways To Set Environment Variables

May 20, 2010

I am running Red Hat Linux Enterprise 5; I am always using the export command to set environment variables.Are there any other ways to set environment variables and what are the advantages/disadvantages of them?

View 4 Replies View Related

General :: Environment Variables Not Being Set Correctly?

Jun 21, 2010

he $g09root is picked up ( in both the csh and the bash), but not the $GV_DIR or the $GAUSS_SCRDIR. I guess it's some stupid error, but it is highly frustrating.Here is the .profile file:Quote:

# To make use of this feature, simply uncomment one of the lines below or
# add your own one (see /usr/share/locale/locale.alias for more codes)
#

[code]...

View 9 Replies View Related

Software :: Environment Variables And Konsole In KDE?

Apr 27, 2011

I have installed jdk in my pc, and i've set up the environment variable on the .bashrc file in my home directory although i can use java's compiler and interpreter in terminal (xfce) if i try to use these commands in konsole (kde) for some reason they don't work. do i need to edit other file?

Nevermind, i found out that konsole was being executed with -e $SHELL -l parameters, once i took them out, and just ran konsole everything worked.

View 6 Replies View Related

Software :: Set Environment Variables That Don't Need Terminal ?

Jun 12, 2011

I've added an export command to /etc/profile, but the environment variables don't show up when not using a terminal.

For example: when I add:

Code:

To my /etc/profile (then open a new terminal so it registers) and run a graphical program from that terminal, the graphical program can see see the environment variable A.

However if I add the export command to my /etc/profile, then reboot so everything registers, then run that same graphical program from a menu (such as Applications->Accessories->Myprogram), it can't see the environment variable.

What I'm trying to say is basically, my environment variables only show up if I run a program in a shell. Is there a way to set environment variables that will show even without a shell?

View 2 Replies View Related

Programming :: Using Environment Variables In Scripts?

Jun 19, 2010

Trying to mounts three cifs shares at boot up. I want to mount the shares under three different sub directories in the user's home directory:

share 1 mounted to /home/(insert username here)/movies
share 2 mounted to /home/(insert username here)/music
share 3 mounted to home/(insert username here)/software

I would like to use the environment variable HOME to dynamically build the mount point parameter. I've tried:

View 14 Replies View Related

Debian :: Unable To Change Environment Variables

Dec 17, 2015

I installed debian 8 on a usb drive using this guide. I used a debian 8.2 64-bit image with mate. It has all worked as I wanted it to. However recently I needed to change the PATH variable, and create another environment variable. I have not been able to do neither. What I have tryed (from google):

1. adding "export PATH=$PATH:/xxxx/" to etc/profile or to /home/user/.profile
2. adding ":/xxxx/" to a point in /etc/profile where the PATH variable is set
3. creating a script in /etc/profile.d which run "export PATH=$PATH:/xxxx/"

(where xxxx is the the location i want to add)

View 7 Replies View Related

Debian Configuration :: Environment Variables For All Users

Nov 27, 2015

I'm newbie on Debian, and I just installed Debian 8.2. (I used to run openSuse, and I see Debian is quite different.)

Where should I set environment variables (like PATH or JAVA_HOME) in order to affect all users?

I read some documentation about that, but It is not clear for me, the difference among "/etc/environment", "/etc/bash.bashrc" and "/etc/profile".

(In openSuse, I used to create a file "/etc/bash.bashrc.local" and set the environment variables there, in order these settings are not lost with updates.)

View 1 Replies View Related

Fedora :: Script Unable To Set Environment Variables

Nov 24, 2010

I've never done much scripting myself and I'm quite unused to the bash as well, but anyway, Here's my problem.

I've a script which is supposed to set some environment variables, using export. However, if I check those variables using echo, they appear not to be set (they are empty). If I set the same variables manually, everything is fine, of course, but I don't want to set them each time manually.

View 6 Replies View Related

General :: Exporting Environment Variables In Ubuntu?

Jun 2, 2010

I know many people have asked about environment variables before, but I am having a hard time dealing with these paths while ensuring I don't mess around with the original settings. How would you go about executing these commands in Ubuntu in terms of environment variables?

put /home/stanley/Downloads/ns-allinone-2.34/bin:/home/stanley/Downloads ns-allinone-2.34/tcl8.4.18/unix:/home/stanley/Downloads/ns-allinone-2.34/tk8.4.18/unixinto your PATH environment; so that you'll be able to run itm/tclsh wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put
/home/stanley/Downloads/ns-allinone-2.34/otcl-1.13,
/home/stanley/Downloads/ns-allinone-2.34/lib,
into your LD_LIBRARY_PATH environment variable.

[Code]....

View 1 Replies View Related

General :: Setting (permenant) Environment Variables In 10.0.4

Sep 4, 2010

I am running an application which requires setting environment variables to be set.At the moment, the way I am achieving this is by exporting the EV at the command line, and then running the app from the command line.I want to be able to run the app from my menu (it is already a menu item after I installed it).How may I set the env var so that it is always available, so I can just run the app from the menu instead of from the CLI?

View 1 Replies View Related

Ubuntu :: Cannot Save Environment Variables In Terminal?

Feb 12, 2010

In terminal, I use the command " export XXX="xxx" " to create a new environment variable, and then " env | grep XXX " to check if it is existed. But when I run the terminal again, the variable I created is disappeared. I've found it just can't save the variables I created..

View 3 Replies View Related

Ubuntu :: Update Environment Variables Forever?

Apr 7, 2010

I've created a new environment variable and updated another one (PATH). I just want to save this changes once after reboot and forever. This is because I want to run a program (tecplot) just typing 'tec360' in the command line. If I create those new variable ( TEC_360_2008=/usr/tec360_2008 ) and update the PATH variable ( export PATH=$PATH:$TEC_360_2008/bin ) then bash detect the command 'tec360' and it runs my program. The problem is that this changes are not saved after rebooting.

According to the manual, I have to update the .bash_profile in my home directory but I don't have this file in this directory (neither in other directory). I only have .bash_history, .bash_logout and .bashrc in the home directory. I have updated .bashrc (typing . ./.bashrc) but it is not working.

View 5 Replies View Related

Ubuntu Installation :: Set Some Custom Environment Variables

May 13, 2010

I need to set some custom environment variables.

View 6 Replies View Related

Ubuntu :: Sudo Doesn't Keep Environment Variables

Jul 19, 2010

When I execute something with sudo, the environment that it executes in doesn't have all the environment variables from /etc/profile{,.d/} defined. I googled around and found that there is a way to get the environment variables from the calling environment to be carried over to sudo's own environment, but that's not exactly what I want. I just want sudo to read the /etc/profile and /etc/profile.d/ before executing commands.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved