From c386664b94e2392f2d2cca35d7f8e9c6cb3c85c2 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Jul 2011 09:24:11 +0000 Subject: realpath --- eio.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'eio.c') diff --git a/eio.c b/eio.c index 7330a7f..c3795e0 100644 --- a/eio.c +++ b/eio.c @@ -837,6 +837,10 @@ int eio_poll (void) /*****************************************************************************/ /* work around various missing functions */ +#if _POSIX_VERSION < 200809L +# define realpath(path,resolved_path) (errno = ENOSYS, 0) +#endif + #if !HAVE_PREADWRITE # undef pread # undef pwrite @@ -1776,6 +1780,11 @@ eio_execute (etp_worker *self, eio_req *req) case EIO_SYMLINK: req->result = symlink (req->ptr1, req->ptr2); break; case EIO_MKNOD: req->result = mknod (req->ptr1, (mode_t)req->int2, (dev_t)req->offs); break; + case EIO_REALPATH: req->flags |= EIO_FLAG_PTR2_FREE; + req->ptr2 = realpath (req->ptr1, 0); + req->result = req->ptr2 ? strlen (req->ptr2) : -1; + break; + case EIO_READLINK: ALLOC (PATH_MAX); req->result = readlink (req->ptr1, req->ptr2, PATH_MAX); break; @@ -2002,6 +2011,11 @@ eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data) return eio__1path (EIO_READLINK, path, pri, cb, data); } +eio_req *eio_realpath (const char *path, int pri, eio_cb cb, void *data) +{ + return eio__1path (EIO_REALPATH, path, pri, cb, data); +} + eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data) { return eio__1path (EIO_STAT, path, pri, cb, data); -- cgit v1.2.3