2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
12 #include "__arosc_privdata.h"
13 #include "__filesystem_support.h"
17 /* like Dos_Lock() but no automatic soft link resolution */
22 /*****************************************************************************
35 Returns information about a file like stat does except that lstat
36 does not follow symbolic links. Information is stored in stat
37 structure. Consult stat() documentation for detailed description
41 path - Pathname of the file
42 sb - Pointer to stat structure that will be filled by the lstat() call.
45 0 on success and -1 on error. If an error occurred, the global
46 variable errno is set.
58 Consult stat() documentation for details.
60 ******************************************************************************/
62 struct aroscbase
*aroscbase
= __GM_GetBase();
66 /* check for empty path before potential conversion from "." to "" */
67 if (aroscbase
->acb_doupath
&& path
&& *path
== '\0')
73 path
= __path_u2a(path
);
77 lock
= __lock(path
, SHARED_LOCK
);
80 if ( IoErr() == ERROR_IS_SOFT_LINK
81 || IoErr() == ERROR_OBJECT_IN_USE
)
83 /* either the file is already locked exclusively
84 or it is a soft link, in both cases only way
85 to get info about it is to find it in the
86 parent directory with the ExNext() function
90 return __stat_from_path(path
, sb
);
93 errno
= __arosc_ioerr2errno(IoErr());
97 res
= __stat(lock
, sb
, FALSE
);
108 return Lock(name
, accessMode
);