Difference between execv and just running the application?

We have a stub that we run from inittab that executes our process. (Kernel ARM Linux 2.6.25)

When testing the process, it only fails when run from inittab and execv'd. If it's run on the command line, it works fine, every time.

This process makes heavy use of SYS V IPC.

Are there any differences between the two startup methods that I should be aware of?

0


a source to share


5 answers


Is a mismatched core / library. Everything is cleaned up after a full recompilation.



0


a source


As Matthew mentioned, this is probably a problem with the env variable. Try to dump your env list before calling your program in both cases - through a stub or "manually".

BTW This can help a lot if you could provide more information on why your program worked. Log file? core dump / gdb? return value from execve?




Edit: Other checks: are you sure to pass the exact same parameter list (if there are parameters)?

To answer your question, there is no difference between the two methods. Actually your shell is fork (), and finally call execve () to start your process, feeding it with the options you manually supplied and the environement variables you set in your shell. Btw when you run your program through init, it can start it early on in your computer startup. Are you sure you are ready to use your application well at this point?

+2


a source


Could this be an environment variable issue? If so, consider using execve or execle with the appropriate envp argument.

+1


a source


The environment variable suggestion is pretty good - I'd check $ PATH to make sure your dependent libraries are found (if any). Another thing you could check is that you are running under the same uid / gid when you run as inittab?

0


a source


And if you replace the stub with a shell script? If it works from the command line, it should work from a shell script, and you may know that this is your stub, or the fact that it is in inittab.

Could this be a tty control issue?

Another advantage of the shell script is that you can edit it and strace your program to see where it fails

0


a source







All Articles