1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27#include "lint.h" 28#include <sys/types.h> 29#include <sys/syscall.h> 30#include <sys/stat.h> 31#include <sys/fcntl.h> 32 33#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 34 35#pragma weak _fstatat64 = fstatat64 36int 37fstatat64(int fd, const char *name, struct stat64 *sb, int flags) 38{ 39 return (syscall(SYS_fstatat64, fd, name, sb, flags)); 40} 41 42#pragma weak _stat64 = stat64 43int 44stat64(const char *name, struct stat64 *sb) 45{ 46#if defined(_RETAIN_OLD_SYSCALLS) 47 return (syscall(SYS_stat64, name, sb)); 48#else 49 return (fstatat64(AT_FDCWD, name, sb, 0)); 50#endif 51} 52 53#pragma weak _lstat64 = lstat64 54int 55lstat64(const char *name, struct stat64 *sb) 56{ 57#if defined(_RETAIN_OLD_SYSCALLS) 58 return (syscall(SYS_lstat64, name, sb)); 59#else 60 return (fstatat64(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); 61#endif 62} 63 64#pragma weak _fstat64 = fstat64 65int 66fstat64(int fd, struct stat64 *sb) 67{ 68#if defined(_RETAIN_OLD_SYSCALLS) 69 return (syscall(SYS_fstat64, fd, sb)); 70#else 71 return (fstatat64(fd, NULL, sb, 0)); 72#endif 73} 74 75#else /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ 76 77#pragma weak _fstatat = fstatat 78int 79fstatat(int fd, const char *name, struct stat *sb, int flags) 80{ 81 return (syscall(SYS_fstatat, fd, name, sb, flags)); 82} 83 84#pragma weak _stat = stat 85int 86stat(const char *name, struct stat *sb) 87{ 88#if defined(_RETAIN_OLD_SYSCALLS) 89 return (syscall(SYS_stat, name, sb)); 90#else 91 return (fstatat(AT_FDCWD, name, sb, 0)); 92#endif 93} 94 95#pragma weak _lstat = lstat 96int 97lstat(const char *name, struct stat *sb) 98{ 99#if defined(_RETAIN_OLD_SYSCALLS) 100 return (syscall(SYS_lstat, name, sb)); 101#else 102 return (fstatat(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); 103#endif 104} 105 106#pragma weak _fstat = fstat 107int 108fstat(int fd, struct stat *sb) 109{ 110#if defined(_RETAIN_OLD_SYSCALLS) 111 return (syscall(SYS_fstat, fd, sb)); 112#else 113 return (fstatat(fd, NULL, sb, 0)); 114#endif 115} 116 117#endif /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ 118