/* Check if effective user id can access file
- Copyright (C) 1990, 91, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1990,91,95,96,97,98,99,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
const char *path;
int mode;
{
- struct stat stats;
+ struct stat64 stats;
int granted;
#ifdef _LIBC
return access (path, mode);
#endif
- if (stat (path, &stats))
+ if (stat64 (path, &stats))
return -1;
mode &= (X_OK | W_OK | R_OK); /* Clear any bogus bits. */
/* Determine whether descriptor has given property.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
int
isfdtype (int fildes, int fdtype)
{
- struct stat st;
+ struct stat64 st;
int result;
{
int save_error = errno;
- result = fstat (fildes, &st);
+ result = fstat64 (fildes, &st);
__set_errno (save_error);
}
int
posix_fallocate (int fd, __off_t offset, size_t len)
{
- struct stat st;
+ struct stat64 st;
struct statfs f;
size_t step;
/* First thing we have to make sure is that this is really a regular
file. */
- if (__fxstat (_STAT_VER, fd, &st) != 0)
+ if (__fxstat64 (_STAT_VER, fd, &st) != 0)
return EBADF;
if (S_ISFIFO (st.st_mode))
return ESPIPE;
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
static int
direxists (const char *dir)
{
- struct stat buf;
- return __xstat (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
+ struct stat64 buf;
+ return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
}
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
struct timeval tv;
int count, fd = -1;
int save_errno = errno;
- struct stat st;
+ struct stat64 st;
len = strlen (tmpl);
if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
- if (__xstat (_STAT_VER, tmpl, &st) < 0)
+ if (__xstat64 (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
char _buf[512];
#endif
char *buf = _buf;
- struct stat st;
+ struct stat64 st;
char *grtmpbuf;
struct group grbuf;
size_t grbuflen = __sysconf (_SC_GETGR_R_SIZE_MAX);
if (pts_name (fd, &buf, sizeof (_buf)))
return -1;
- if (__xstat (_STAT_VER, buf, &st) < 0)
+ if (__xstat64 (_STAT_VER, buf, &st) < 0)
goto cleanup;
/* Make sure that we own the device. */
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,98,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
__opendir (const char *name)
{
DIR *dirp;
- struct stat statbuf;
+ struct stat64 statbuf;
int fd;
size_t allocation;
int save_errno;
/* We first have to check whether the name is for a directory. We
cannot do this after the open() call since the open/close operation
performed on, say, a tape device might have undesirable effects. */
- if (__xstat (_STAT_VER, name, &statbuf) < 0)
+ if (__xstat64 (_STAT_VER, name, &statbuf) < 0)
return NULL;
if (! S_ISDIR (statbuf.st_mode))
{
/* Now make sure this really is a directory and nothing changed since
the `stat' call. */
- if (__fstat (fd, &statbuf) < 0)
+ if (__fxstat64 (_STAT_VER, fd, &statbuf) < 0)
goto lose;
if (! S_ISDIR (statbuf.st_mode))
{
fstatvfs (int fd, struct statvfs *buf)
{
struct statfs fsbuf;
- struct stat st;
+ struct stat64 st;
/* Get as much information as possible from the system. */
if (__fstatfs (fd, &fsbuf) < 0)
return -1;
-#define STAT(st) fstat (fd, st)
+#define STAT(st) fstat64 (fd, st)
#include "internal_statvfs.c"
/* We signal success if the statfs call succeeded. */
while (__getmntent_r (mtab, &mntbuf, tmpbuf, sizeof (tmpbuf)))
{
- struct stat fsst;
+ struct stat64 fsst;
/* Find out about the device the current entry is for. */
- if (stat (mntbuf.mnt_dir, &fsst) >= 0
+ if (stat64 (mntbuf.mnt_dir, &fsst) >= 0
&& st.st_dev == fsst.st_dev)
{
/* Bingo, we found the entry for the device FD is on.
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
terminal devices. As of Linux 2.1.115 these are no longer
supported. They have been replaced by major numbers 2 (masters)
and 3 (slaves). */
-
+
/* Directory where we can find the slave pty nodes. */
#define _PATH_DEVPTS "/dev/pts/"
__ptsname_r (int fd, char *buf, size_t buflen)
{
int save_errno = errno;
- struct stat st;
+ struct stat64 st;
int ptyno;
if (buf == NULL)
return ERANGE;
}
- if (__fstat (fd, &st) < 0)
+ if (__fxstat64 (_STAT_VER, fd, &st) < 0)
return errno;
/* Check if FD really is a master pseudo terminal. */
p[2] = '\0';
}
- if (__xstat (_STAT_VER, buf, &st) < 0)
+ if (__xstat64 (_STAT_VER, buf, &st) < 0)
return errno;
/* Check if the name we're about to return really corresponds to a
statvfs (const char *file, struct statvfs *buf)
{
struct statfs fsbuf;
- struct stat st;
+ struct stat64 st;
/* Get as much information as possible from the system. */
if (__statfs (file, &fsbuf) < 0)
return -1;
-#define STAT(st) stat (file, st)
+#define STAT(st) stat64 (file, st)
#include "internal_statvfs.c"
/* We signal success if the statfs call succeeded. */
char *__ttyname;
static char *getttyname (const char *dev, dev_t mydev,
- ino_t myino, int save, int *dostat)
+ ino64_t myino, int save, int *dostat)
internal_function;
static char *
internal_function
-getttyname (const char *dev, dev_t mydev, ino_t myino, int save, int *dostat)
+getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
{
static size_t namelen;
- struct stat st;
+ struct stat64 st;
DIR *dirstream;
struct dirent *d;
size_t devlen = strlen (dev) + 1;
*((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/';
}
memcpy (&getttyname_name[devlen], d->d_name, dlen);
- if (__xstat (_STAT_VER, getttyname_name, &st) == 0
+ if (__xstat64 (_STAT_VER, getttyname_name, &st) == 0
#ifdef _STATBUF_ST_RDEV
&& S_ISCHR (st.st_mode) && st.st_rdev == mydev
#else
- && (ino_t) d->d_fileno == myino && st.st_dev == mydev
+ && (ino64_t) d->d_fileno == myino && st.st_dev == mydev
#endif
)
{
{
static size_t buflen;
char procname[30];
- struct stat st, st1;
+ struct stat64 st, st1;
int dostat = 0;
char *name;
int save = errno;
return ttyname_buf;
}
- if (__fxstat (_STAT_VER, fd, &st) < 0)
+ if (__fxstat64 (_STAT_VER, fd, &st) < 0)
return NULL;
- if (__xstat (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
+ if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
{
#ifdef _STATBUF_ST_RDEV
name = getttyname ("/dev/pts", st.st_rdev, st.st_ino, save, &dostat);
#include <stdio-common/_itoa.h>
static int getttyname_r (char *buf, size_t buflen,
- dev_t mydev, ino_t myino, int save,
+ dev_t mydev, ino64_t myino, int save,
int *dostat) internal_function;
static int
internal_function
-getttyname_r (char *buf, size_t buflen, dev_t mydev, ino_t myino,
+getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino,
int save, int *dostat)
{
- struct stat st;
+ struct stat64 st;
DIR *dirstream;
struct dirent *d;
size_t devlen = strlen (buf);
cp = __stpncpy (buf + devlen, d->d_name, needed);
cp[0] = '\0';
- if (__xstat (_STAT_VER, buf, &st) == 0
+ if (__xstat64 (_STAT_VER, buf, &st) == 0
#ifdef _STATBUF_ST_RDEV
&& S_ISCHR (st.st_mode) && st.st_rdev == mydev
#else
- && (ino_t) d->d_fileno == myino && st.st_dev == mydev
+ && (ino64_t) d->d_fileno == myino && st.st_dev == mydev
#endif
)
{
__ttyname_r (int fd, char *buf, size_t buflen)
{
char procname[30];
- struct stat st, st1;
+ struct stat64 st, st1;
int dostat = 0;
int save = errno;
int ret;
return ERANGE;
}
- if (__fxstat (_STAT_VER, fd, &st) < 0)
+ if (__fxstat64 (_STAT_VER, fd, &st) < 0)
return errno;
/* Prepare the result buffer. */
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
buflen -= sizeof ("/dev/pts/") - 1;
- if (__xstat (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
+ if (__xstat64 (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode))
{
#ifdef _STATBUF_ST_RDEV
ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, save,
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
const char *pathname;
int proj_id;
{
- struct stat st;
+ struct stat64 st;
key_t key;
- if (__xstat (_STAT_VER, pathname, &st) < 0)
+ if (__xstat64 (_STAT_VER, pathname, &st) < 0)
return (key_t) -1;
key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)