New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
envp PWD= #11
Comments
I'm sorry, I don't understand. What is this about? |
there is a line in the master branch of your os_posix.cpp file of apitrace and I was giving you a posix portable way to get the absolute path of the executable sense there's a comment requesting it on line 64. You just have to concatenate the PWD environmental variable with argv[0] of your argument vector to get the absolute path. (Instead of trying to read the proc file system) I was going to provide example code but i didn't want to forget. // http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe. |
Ah, no, that's not what it is. The code in question is also in a library, which doesn't have the access the argv vector so we can't rely on it. |
but getenv should work, shouldn't it? On Thu, Apr 28, 2011 at 10:40 PM, zackr <
"lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 |
No, there's no env variable for the currently running process name. |
have you tried it? That behavior seems contrary to posix. http://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/getenv.htm |
Tried what? What behavior? That environment doesn't have a variable holding currently running process name? It never did. |
i would fork but I'd have nothing else to contribute. Coming undergraduate Operating Systems class, you look in the envp* dictionary. I forget how to get things out of dictionaries in C but the envp* dictionary is a parameter of your main function so, for example
int main(int argc,char *argv[],char *envp[])
printf("The environment is as follows:\n");
int a = 0;
while (envp[a] != NULL)
printf("\t%s\n", envp[a++]);
return 0;
the *envp pointer is a dictionary, so it should print out the entire environmental dictionary. where did u think bash was getting it?
The text was updated successfully, but these errors were encountered: