blob: 5a5a0e29125da907bc1ae04c3fdd8471bd90e3fe [file] [log] [blame]
Adam Lesinski16c4d152014-01-24 13:27:13 -08001/*
2 * Copyright (C) 2005 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
17#include <sys/types.h>
18
19//
20// Handy utility functions and portability code.
21//
22#ifndef _LIBS_ANDROID_FW_MISC_H
23#define _LIBS_ANDROID_FW_MISC_H
24
25namespace android {
26
27/*
28 * Some utility functions for working with files. These could be made
29 * part of a "File" class.
30 */
31typedef enum FileType {
32 kFileTypeUnknown = 0,
33 kFileTypeNonexistent, // i.e. ENOENT
34 kFileTypeRegular,
35 kFileTypeDirectory,
36 kFileTypeCharDev,
37 kFileTypeBlockDev,
38 kFileTypeFifo,
39 kFileTypeSymlink,
40 kFileTypeSocket,
41} FileType;
42/* get the file's type; follows symlinks */
43FileType getFileType(const char* fileName);
44/* get the file's modification date; returns -1 w/errno set on failure */
45time_t getFileModDate(const char* fileName);
46
47}; // namespace android
48
49#endif // _LIBS_ANDROID_FW_MISC_H