[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] chroot()
On Thu, Mar 09, 2000 at 11:04:58PM +0100, Tomas Berndtsson wrote:
> Frank Naumann <fnaumann@cs.uni-magdeburg.de> writes:
>
> > > As far as I could tell, chroot() isn't supported by MiNT, right?
> >
> > Implemented since 1.15.3 beta.
>
> Oh, there you go. But there was no wrapper for a chroot() in mintlib,
> it seems. Only a prototype for Pchroot().
In the last MiNTLib, chroot was still work in progress. It has now been
renamed to Dchroot. Anyway, here is what you need:
<mintbind.h>
...
#define Dchroot(dir) trap_1_wl (0x14a, (long) dir)
...
And
chroot.c:
#include <unistd.h>
#include <errno.h>
#include <mintbind.h>
int
__chroot (const char* path)
{
int retval = Dchroot (path);
if (retval != 0) {
__set_errno (-retval);
return -1;
}
return 0;
}
weak_alias (__chroot, chroot)
/* End of chroot.c */
There is a trap: The portlib also contained a module chroot.o which
derived from something like:
int
chroot (const char* path)
{
return chdir (path);
}
If you link against the portlib you have to delete that module from the
library:
ar d libport.a chroot.o
Otherwise you drag the wrong code into your link. You can safely do this
because the portlib is now obsolete. All functions found there are now
part of the MiNTLib (beginning with version 0.54).
Ciao
Guido
--
http://stud.uni-sb.de/~gufl0000/
mailto:guido@freemint.de