xref: /freebsd/lib/libc/sys/lstat.c (revision d7847a8d351436a4654bd2c746bc9c04401160ee)
1*d7847a8dSBrooks Davis /*-
2*d7847a8dSBrooks Davis  * Copyright (c) 2012 Gleb Kurtsou <gleb@FreeBSD.org> All rights reserved.
3*d7847a8dSBrooks Davis  * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
4*d7847a8dSBrooks Davis  *
5*d7847a8dSBrooks Davis  * Redistribution and use in source and binary forms, with or without
6*d7847a8dSBrooks Davis  * modification, are permitted provided that the following conditions
7*d7847a8dSBrooks Davis  * are met:
8*d7847a8dSBrooks Davis  * 1. Redistributions of source code must retain the above copyright
9*d7847a8dSBrooks Davis  *    notice, this list of conditions and the following disclaimer.
10*d7847a8dSBrooks Davis  * 2. Redistributions in binary form must reproduce the above copyright
11*d7847a8dSBrooks Davis  *    notice, this list of conditions and the following disclaimer in the
12*d7847a8dSBrooks Davis  *    documentation and/or other materials provided with the distribution.
13*d7847a8dSBrooks Davis  *
14*d7847a8dSBrooks Davis  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*d7847a8dSBrooks Davis  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*d7847a8dSBrooks Davis  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*d7847a8dSBrooks Davis  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*d7847a8dSBrooks Davis  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*d7847a8dSBrooks Davis  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*d7847a8dSBrooks Davis  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*d7847a8dSBrooks Davis  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*d7847a8dSBrooks Davis  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*d7847a8dSBrooks Davis  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*d7847a8dSBrooks Davis  * SUCH DAMAGE.
25*d7847a8dSBrooks Davis  */
26*d7847a8dSBrooks Davis 
27*d7847a8dSBrooks Davis #include "namespace.h"
28*d7847a8dSBrooks Davis #include <sys/param.h>
29*d7847a8dSBrooks Davis #include <sys/fcntl.h>
30*d7847a8dSBrooks Davis #include <sys/syscall.h>
31*d7847a8dSBrooks Davis #include <sys/stat.h>
32*d7847a8dSBrooks Davis #include <unistd.h>
33*d7847a8dSBrooks Davis #include "libc_private.h"
34*d7847a8dSBrooks Davis 
35*d7847a8dSBrooks Davis int
lstat(const char * path,struct stat * sb)36*d7847a8dSBrooks Davis lstat(const char *path, struct stat *sb)
37*d7847a8dSBrooks Davis {
38*d7847a8dSBrooks Davis 
39*d7847a8dSBrooks Davis 	return (__sys_fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW));
40*d7847a8dSBrooks Davis }
41