2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 POSIX.1-2008 function readlink().
8 #include <aros/debug.h>
10 #include <proto/dos.h>
14 #include "__arosc_privdata.h"
15 #include "__filesystem_support.h"
18 /*****************************************************************************
31 Places the contents of a symbolic link in a buffer of given size. No NUL
32 char is appended to the buffer.
35 path - the path to the symbolic link
36 buf - pointer to the buffer where to store the symbolic link content
37 bufsize - the size of the buffer in bytes
40 The call returns the count of characters placed in the buffer if it
41 succeeds, or a -1 if an error occurs, placing the error code in the
42 global variable errno.
45 struct aroscbase
*aroscbase
= __aros_getbase_aroscbase();
47 struct DevProc
*dvp
= NULL
;
49 struct Process
*me
= (struct Process
*)FindTask(NULL
);
51 /* check for empty path before potential conversion from "." to "" */
52 if (aroscbase
->acb_doupath
&& path
&& *path
== '\0')
58 path
= __path_u2a(path
);
62 res
= ReadLink(dvp
->dvp_Port
, dvp
->dvp_Lock
, path
, buf
, bufsize
);
68 error
= me
->pr_Result2
= 0;
74 errno
= __arosc_ioerr2errno(error
);