| 1 | #ifndef Py_FILEUTILS_H |
| 2 | #define Py_FILEUTILS_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | PyAPI_FUNC(PyObject *) _Py_device_encoding(int); |
| 9 | |
| 10 | PyAPI_FUNC(wchar_t *) Py_DecodeLocale( |
| 11 | const char *arg, |
| 12 | size_t *size); |
| 13 | |
| 14 | PyAPI_FUNC(char*) Py_EncodeLocale( |
| 15 | const wchar_t *text, |
| 16 | size_t *error_pos); |
| 17 | |
| 18 | #ifndef Py_LIMITED_API |
| 19 | |
| 20 | #ifdef MS_WINDOWS |
| 21 | struct _Py_stat_struct { |
| 22 | unsigned long st_dev; |
| 23 | __int64 st_ino; |
| 24 | unsigned short st_mode; |
| 25 | int st_nlink; |
| 26 | int st_uid; |
| 27 | int st_gid; |
| 28 | unsigned long st_rdev; |
| 29 | __int64 st_size; |
| 30 | time_t st_atime; |
| 31 | int st_atime_nsec; |
| 32 | time_t st_mtime; |
| 33 | int st_mtime_nsec; |
| 34 | time_t st_ctime; |
| 35 | int st_ctime_nsec; |
| 36 | unsigned long st_file_attributes; |
| 37 | }; |
| 38 | #else |
| 39 | # define _Py_stat_struct stat |
| 40 | #endif |
| 41 | |
| 42 | PyAPI_FUNC(int) _Py_fstat( |
| 43 | int fd, |
| 44 | struct _Py_stat_struct *status); |
| 45 | |
| 46 | PyAPI_FUNC(int) _Py_fstat_noraise( |
| 47 | int fd, |
| 48 | struct _Py_stat_struct *status); |
| 49 | #endif /* Py_LIMITED_API */ |
| 50 | |
| 51 | PyAPI_FUNC(int) _Py_stat( |
| 52 | PyObject *path, |
| 53 | struct stat *status); |
| 54 | |
| 55 | #ifndef Py_LIMITED_API |
| 56 | PyAPI_FUNC(int) _Py_open( |
| 57 | const char *pathname, |
| 58 | int flags); |
| 59 | |
| 60 | PyAPI_FUNC(int) _Py_open_noraise( |
| 61 | const char *pathname, |
| 62 | int flags); |
| 63 | #endif |
| 64 | |
| 65 | PyAPI_FUNC(FILE *) _Py_wfopen( |
| 66 | const wchar_t *path, |
| 67 | const wchar_t *mode); |
| 68 | |
| 69 | PyAPI_FUNC(FILE*) _Py_fopen( |
| 70 | const char *pathname, |
| 71 | const char *mode); |
| 72 | |
| 73 | PyAPI_FUNC(FILE*) _Py_fopen_obj( |
| 74 | PyObject *path, |
| 75 | const char *mode); |
| 76 | |
| 77 | PyAPI_FUNC(Py_ssize_t) _Py_read( |
| 78 | int fd, |
| 79 | void *buf, |
| 80 | size_t count); |
| 81 | |
| 82 | PyAPI_FUNC(Py_ssize_t) _Py_write( |
| 83 | int fd, |
| 84 | const void *buf, |
| 85 | size_t count); |
| 86 | |
| 87 | PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( |
| 88 | int fd, |
| 89 | const void *buf, |
| 90 | size_t count); |
| 91 | |
| 92 | #ifdef HAVE_READLINK |
| 93 | PyAPI_FUNC(int) _Py_wreadlink( |
| 94 | const wchar_t *path, |
| 95 | wchar_t *buf, |
| 96 | size_t bufsiz); |
| 97 | #endif |
| 98 | |
| 99 | #ifdef HAVE_REALPATH |
| 100 | PyAPI_FUNC(wchar_t*) _Py_wrealpath( |
| 101 | const wchar_t *path, |
| 102 | wchar_t *resolved_path, |
| 103 | size_t resolved_path_size); |
| 104 | #endif |
| 105 | |
| 106 | PyAPI_FUNC(wchar_t*) _Py_wgetcwd( |
| 107 | wchar_t *buf, |
| 108 | size_t size); |
| 109 | |
| 110 | #ifndef Py_LIMITED_API |
| 111 | PyAPI_FUNC(int) _Py_get_inheritable(int fd); |
| 112 | |
| 113 | PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, |
| 114 | int *atomic_flag_works); |
| 115 | |
| 116 | PyAPI_FUNC(int) _Py_dup(int fd); |
| 117 | |
| 118 | #ifndef MS_WINDOWS |
| 119 | PyAPI_FUNC(int) _Py_get_blocking(int fd); |
| 120 | |
| 121 | PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); |
| 122 | #endif /* !MS_WINDOWS */ |
| 123 | |
| 124 | #if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 |
| 125 | /* A routine to check if a file descriptor is valid on Windows. Returns 0 |
| 126 | * and sets errno to EBADF if it isn't. This is to avoid Assertions |
| 127 | * from various functions in the Windows CRT beginning with |
| 128 | * Visual Studio 2005 |
| 129 | */ |
| 130 | int _PyVerify_fd(int fd); |
| 131 | |
| 132 | #else |
| 133 | #define _PyVerify_fd(A) (1) /* dummy */ |
| 134 | #endif |
| 135 | |
| 136 | #endif /* Py_LIMITED_API */ |
| 137 | |
| 138 | #ifdef __cplusplus |
| 139 | } |
| 140 | #endif |
| 141 | |
| 142 | #endif /* !Py_FILEUTILS_H */ |
| 143 | |