[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Plash] executable objects and cwd
From: |
Toby Murray |
Subject: |
[Plash] executable objects and cwd |
Date: |
Fri, 16 Jun 2006 17:39:53 +0930 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 |
Hi plash-ers,
I've been playing around with pola-shell a bit lately and have a couple
questions. I'm hoping someone can clarify a few details. After reading
the docs on the website I think I'm getting my head around plash's
object system and how the pola-shell might be operating but a couple
things are puzzling me at the moment.
Firstly, from some quick experimenting, I can't seem to find a
configuration in which an executable object (created with exec-object)
is able to call getcwd() successfully.
My test case was just to create a dummy app that just did a something like:
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char *argv[]){
char buffer[1024];
if (getcwd(buffer,sizeof(buffer)) == NULL){
fprintf(stderr,"error getting cwd: %s\n",strerror(errno));
exit(1);
}
printf("%s\n",buffer);
return 0;
}
this was built as 'getcwd' then from pola-shell doing
def my_getcwd = capcmd exec-object '/somedir/getcwd' /x=(mkfs
/somedir/getcwd/ /lib /usr/lib => /dev/tty /dev/null)
to create an executable object for it with the minimum authority
necessary (or so I presume)
when running:
my_getcwd
it always turns up with "Permission denied" when trying to do the getcwd()
On a related note, how does pola-shell determine whether or not to set
the cwd of a child process? Turning on the 'print_fs_tree' option allows
one to find out when it does choose to set the cwd.
(eg. plash-opts /obj1=options 'print_fs_tree' 'on' )
Even when it does say it's setting the cwd of the child process when
invoking an executable object, the executable object still can never
seem to be able to determine its cwd.
pola-shell's algorithm for determining when to set the cwd is a bit
confusing. If I run
my_getcwd /
I get the debugging output: "set cwd successfully"
if I run
my_getcwd /somedir
(where /somedir is the path to the 'getcwd' binary)
instead it says "leaving cwd unset".
Why does it distinguish between these two? What is the criteria for
deciding whether the cwd gets set?
Or am I missing something here -- perhaps the cwd of executable objects
themselves never gets set, perhaps the "cwd set successfully" is
referring to some (other) child process that's spawned which does the
actual method call on the executable object....
It's all a tad confusing.
Any info would be great.
Thanks heaps,
Toby
--
Toby Murray
Advanced Computer Capabilities Group
Information Networks Division
DSTO, Australia
IMPORTANT: This e-mail remains the property of the Australian Defence
Organisation and is subject to the jurisdiction of section 70 of the
Crimes Act 1914. If you have received this e-mail in error, you are
requested to contact the sender and delete the e-mail.
- [Plash] executable objects and cwd,
Toby Murray <=