| Calin Juravle | fe317a3 | 2014-02-21 15:11:03 +0000 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2014 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
|  | 15 | */ | 
|  | 16 |  | 
| Calin Juravle | d4934a7 | 2014-02-24 16:13:50 +0000 | [diff] [blame] | 17 | #include <ftw.h> | 
| Calin Juravle | fe317a3 | 2014-02-21 15:11:03 +0000 | [diff] [blame] | 18 | #include <stdlib.h> | 
|  | 19 |  | 
| Elliott Hughes | 31165ed | 2014-09-23 17:34:29 -0700 | [diff] [blame] | 20 | // Delegation will work in these cases because all the transitive dependencies | 
|  | 21 | // are already 64-bit ready. In particular, we don't have non-O_LARGEFILE | 
|  | 22 | // open (our open is actually open64) and stat and stat64 are the same. | 
|  | 23 | int mkstemp64(char* path) { | 
|  | 24 | return mkstemp(path); | 
|  | 25 | } | 
|  | 26 | int mkostemp64(char* path, int flags) { | 
|  | 27 | return mkostemp(path, flags); | 
|  | 28 | } | 
|  | 29 | int mkstemps64(char* path, int suffix_length) { | 
|  | 30 | return mkstemps(path, suffix_length); | 
|  | 31 | } | 
|  | 32 | int mkostemps64(char* path, int suffix_length, int flags) { | 
|  | 33 | return mkostemps(path, suffix_length, flags); | 
| Calin Juravle | fe317a3 | 2014-02-21 15:11:03 +0000 | [diff] [blame] | 34 | } | 
| Calin Juravle | d4934a7 | 2014-02-24 16:13:50 +0000 | [diff] [blame] | 35 |  | 
|  | 36 | typedef int (*ftw_fn)(const char*, const struct stat*, int); | 
|  | 37 | typedef int (*nftw_fn)(const char*, const struct stat*, int, struct FTW*); | 
|  | 38 |  | 
|  | 39 | int ftw64(const char *dirpath, | 
|  | 40 | int (*fn)(const char*, const struct stat64*, int), int nopenfd) { | 
|  | 41 | return ftw(dirpath, reinterpret_cast<ftw_fn>(fn), nopenfd); | 
|  | 42 | } | 
|  | 43 |  | 
|  | 44 | int nftw64(const char * dirpath, | 
|  | 45 | int (*fn)(const char*, const struct stat64*, int, struct FTW*), | 
|  | 46 | int nopenfd, int flags) { | 
|  | 47 | return nftw(dirpath, reinterpret_cast<nftw_fn>(fn), nopenfd, flags); | 
|  | 48 | } |