xref: /onnv-gate/usr/src/lib/libbc/libc/sys/4.2/stat.c (revision 11798:1e7f1f154004)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*11798SRoger.Faulkner@Sun.COM  * Common Development and Distribution License (the "License").
6*11798SRoger.Faulkner@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*11798SRoger.Faulkner@Sun.COM 
220Sstevel@tonic-gate /*
23*11798SRoger.Faulkner@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #include "chkpath.h"
280Sstevel@tonic-gate #include <sys/stat.h>
290Sstevel@tonic-gate 
300Sstevel@tonic-gate extern int errno;
310Sstevel@tonic-gate 
stat(path,buf)320Sstevel@tonic-gate int stat(path, buf)
330Sstevel@tonic-gate char *path;
340Sstevel@tonic-gate struct stat *buf;
350Sstevel@tonic-gate {
360Sstevel@tonic-gate 	return(bc_stat(path, buf));
370Sstevel@tonic-gate }
380Sstevel@tonic-gate 
390Sstevel@tonic-gate 
bc_stat(path,buf)400Sstevel@tonic-gate int bc_stat(path, buf)
410Sstevel@tonic-gate char *path;
420Sstevel@tonic-gate struct stat *buf;
430Sstevel@tonic-gate {
440Sstevel@tonic-gate 	if ((path == (char*)-1) || (path == (char*)0)) {
450Sstevel@tonic-gate 		errno = EFAULT;
460Sstevel@tonic-gate 		return (-1);
470Sstevel@tonic-gate 	}
480Sstevel@tonic-gate 	if ((buf == (struct stat*)0) || (buf == (struct stat*)-1)) {
490Sstevel@tonic-gate 		errno = EFAULT;
500Sstevel@tonic-gate 		return (-1);
510Sstevel@tonic-gate 	}
52*11798SRoger.Faulkner@Sun.COM 	return(stat_com(0, path, buf));
530Sstevel@tonic-gate }
540Sstevel@tonic-gate 
550Sstevel@tonic-gate 
lstat(path,buf)560Sstevel@tonic-gate int lstat(path, buf)
570Sstevel@tonic-gate char *path;
580Sstevel@tonic-gate struct stat *buf;
590Sstevel@tonic-gate {
600Sstevel@tonic-gate 	return(bc_lstat(path, buf));
610Sstevel@tonic-gate }
620Sstevel@tonic-gate 
bc_lstat(path,buf)630Sstevel@tonic-gate int bc_lstat(path, buf)
640Sstevel@tonic-gate char *path;
650Sstevel@tonic-gate struct stat *buf;
660Sstevel@tonic-gate {
670Sstevel@tonic-gate 	CHKNULL(path);
68*11798SRoger.Faulkner@Sun.COM 	return(stat_com(1, path, buf));
690Sstevel@tonic-gate }
700Sstevel@tonic-gate 
71