1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
/*
Copyright Ⓒ 2009 Regis Duchesne
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifdef __APPLE__
/*
This file is for symbols which have the "$INODE64" version, i.e. symbols
which use a 64-bit ino_t.
In this file, 'struct stat' is an alias for 'struct stat64'.
*/
#include <sys/types.h>
#ifndef _DARWIN_FEATURE_ONLY_64_BIT_INODE
#define _DARWIN_USE_64_BIT_INODE
#include "config.h"
#include "communicate.h"
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
#include <stdio.h>
#include <spawn.h>
#ifdef HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif /* HAVE_SYS_ACL_H */
#if HAVE_FTS_H
#include <fts.h>
#endif /* HAVE_FTS_H */
void load_library_symbols(void);
#include "wrapped.h"
#include "wraptmpf.h"
#include "wrapdef.h"
#ifdef LIBFAKEROOT_DEBUGGING
extern int fakeroot_debug;
#endif /* LIBFAKEROOT_DEBUGGING */
int lstat$INODE64(const char *file_name,
struct stat *st){
int r;
#ifdef LIBFAKEROOT_DEBUGGING
if (fakeroot_debug) {
fprintf(stderr, "lstat$INODE64 file_name %s\n", file_name);
}
#endif /* LIBFAKEROOT_DEBUGGING */
r=next_lstat$INODE64(file_name, st);
if(r)
return -1;
send_get_stat64((struct stat64 *)st);
return 0;
}
int stat$INODE64(const char *file_name,
struct stat *st){
int r;
#ifdef LIBFAKEROOT_DEBUGGING
if (fakeroot_debug) {
fprintf(stderr, "stat$INODE64 file_name %s\n", file_name);
}
#endif /* LIBFAKEROOT_DEBUGGING */
r=next_stat$INODE64(file_name,st);
if(r)
return -1;
send_get_stat64((struct stat64 *)st);
return 0;
}
int fstat$INODE64(int fd,
struct stat *st){
int r;
#ifdef LIBFAKEROOT_DEBUGGING
if (fakeroot_debug) {
fprintf(stderr, "fstat$INODE64 fd %d\n", fd);
}
#endif /* LIBFAKEROOT_DEBUGGING */
r=next_fstat$INODE64(fd, st);
if(r)
return -1;
send_get_stat64((struct stat64 *)st);
return 0;
}
#ifdef HAVE_FTS_READ
FTSENT *fts_read$INODE64(FTS *ftsp) {
FTSENT *r;
#ifdef LIBFAKEROOT_DEBUGGING
if (fakeroot_debug) {
fprintf(stderr, "fts_read$INODE64\n");
}
#endif /* LIBFAKEROOT_DEBUGGING */
r=next_fts_read$INODE64(ftsp);
#ifdef __APPLE__
if (r && ((ftsp->fts_options & FTS_NOSTAT)
|| r->fts_info == FTS_NS || r->fts_info == FTS_NSOK))
r->fts_statp = NULL; /* Otherwise fts_statp may be a random pointer */
#endif
if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
send_get_stat64((struct stat64 *)r->fts_statp);
}
return r;
}
FTSENT *fts_children$INODE64(FTS *ftsp,
int options) {
FTSENT *first;
FTSENT *r;
#ifdef LIBFAKEROOT_DEBUGGING
if (fakeroot_debug) {
fprintf(stderr, "fts_children$INODE64\n");
}
#endif /* LIBFAKEROOT_DEBUGGING */
first=next_fts_children$INODE64(ftsp, options);
for(r = first; r; r = r->fts_link) {
if(r->fts_statp) { /* Should we bother checking fts_info here? */
send_get_stat64((struct stat64 *)r->fts_statp);
}
}
return first;
}
#endif /* HAVE_FTS_READ */
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 */
#endif /* ifndef _DARWIN_FEATURE_ONLY_64_BIT_INODE */
#endif /* ifdef __APPLE__ */
|