Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 1 | #ifndef Py_FILEUTILS_H |
| 2 | #define Py_FILEUTILS_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
Brett Cannon | efb00c0 | 2012-02-29 18:31:31 -0500 | [diff] [blame] | 8 | PyAPI_FUNC(PyObject *) _Py_device_encoding(int); |
| 9 | |
Victor Stinner | f6a271a | 2014-08-01 12:28:48 +0200 | [diff] [blame] | 10 | PyAPI_FUNC(wchar_t *) Py_DecodeLocale( |
Victor Stinner | 168e117 | 2010-10-16 23:16:16 +0000 | [diff] [blame] | 11 | const char *arg, |
| 12 | size_t *size); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 13 | |
Victor Stinner | f6a271a | 2014-08-01 12:28:48 +0200 | [diff] [blame] | 14 | PyAPI_FUNC(char*) Py_EncodeLocale( |
Victor Stinner | 2f02a51 | 2010-11-08 22:43:46 +0000 | [diff] [blame] | 15 | const wchar_t *text, |
| 16 | size_t *error_pos); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 17 | |
Serhiy Storchaka | 12ebbc7 | 2015-02-22 19:39:36 +0200 | [diff] [blame] | 18 | #ifndef Py_LIMITED_API |
Steve Dower | f2f373f | 2015-02-21 08:44:05 -0800 | [diff] [blame] | 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, |
Victor Stinner | e134a7f | 2015-03-30 10:09:31 +0200 | [diff] [blame] | 44 | struct _Py_stat_struct *status); |
| 45 | |
| 46 | PyAPI_FUNC(int) _Py_fstat_noraise( |
| 47 | int fd, |
| 48 | struct _Py_stat_struct *status); |
Serhiy Storchaka | 12ebbc7 | 2015-02-22 19:39:36 +0200 | [diff] [blame] | 49 | #endif /* Py_LIMITED_API */ |
Steve Dower | f2f373f | 2015-02-21 08:44:05 -0800 | [diff] [blame] | 50 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 51 | PyAPI_FUNC(int) _Py_stat( |
Victor Stinner | a4a7595 | 2010-10-07 22:23:10 +0000 | [diff] [blame] | 52 | PyObject *path, |
Victor Stinner | e134a7f | 2015-03-30 10:09:31 +0200 | [diff] [blame] | 53 | struct stat *status); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 54 | |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 55 | #ifndef Py_LIMITED_API |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 56 | PyAPI_FUNC(int) _Py_open( |
| 57 | const char *pathname, |
| 58 | int flags); |
Victor Stinner | a555cfc | 2015-03-18 00:22:14 +0100 | [diff] [blame] | 59 | |
| 60 | PyAPI_FUNC(int) _Py_open_noraise( |
| 61 | const char *pathname, |
| 62 | int flags); |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 63 | #endif |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 64 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 65 | PyAPI_FUNC(FILE *) _Py_wfopen( |
| 66 | const wchar_t *path, |
| 67 | const wchar_t *mode); |
| 68 | |
| 69 | PyAPI_FUNC(FILE*) _Py_fopen( |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 70 | const char *pathname, |
| 71 | const char *mode); |
| 72 | |
| 73 | PyAPI_FUNC(FILE*) _Py_fopen_obj( |
Victor Stinner | a4a7595 | 2010-10-07 22:23:10 +0000 | [diff] [blame] | 74 | PyObject *path, |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 75 | const char *mode); |
| 76 | |
Victor Stinner | 66aab0c | 2015-03-19 22:53:20 +0100 | [diff] [blame] | 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 | |
Victor Stinner | 82c3e45 | 2015-04-01 18:34:45 +0200 | [diff] [blame] | 87 | PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( |
| 88 | int fd, |
| 89 | const void *buf, |
| 90 | size_t count); |
| 91 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 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, |
Victor Stinner | 015f4d8 | 2010-10-07 22:29:53 +0000 | [diff] [blame] | 102 | wchar_t *resolved_path, |
| 103 | size_t resolved_path_size); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 104 | #endif |
| 105 | |
| 106 | PyAPI_FUNC(wchar_t*) _Py_wgetcwd( |
| 107 | wchar_t *buf, |
| 108 | size_t size); |
| 109 | |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 110 | #ifndef Py_LIMITED_API |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 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); |
Victor Stinner | 1db9e7b | 2014-07-29 22:32:47 +0200 | [diff] [blame] | 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 | |
Steve Dower | 8fc8980 | 2015-04-12 00:26:27 -0400 | [diff] [blame] | 124 | #if defined _MSC_VER && _MSC_VER >= 1400 && _MSC_VER < 1900 |
Steve Dower | d81431f | 2015-03-06 14:47:02 -0800 | [diff] [blame] | 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 | |
Victor Stinner | 1db9e7b | 2014-07-29 22:32:47 +0200 | [diff] [blame] | 136 | #endif /* Py_LIMITED_API */ |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 137 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 138 | #ifdef __cplusplus |
| 139 | } |
| 140 | #endif |
| 141 | |
| 142 | #endif /* !Py_FILEUTILS_H */ |