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 | |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 8 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 |
Victor Stinner | f6a271a | 2014-08-01 12:28:48 +0200 | [diff] [blame] | 9 | PyAPI_FUNC(wchar_t *) Py_DecodeLocale( |
Victor Stinner | 168e117 | 2010-10-16 23:16:16 +0000 | [diff] [blame] | 10 | const char *arg, |
| 11 | size_t *size); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 12 | |
Victor Stinner | f6a271a | 2014-08-01 12:28:48 +0200 | [diff] [blame] | 13 | PyAPI_FUNC(char*) Py_EncodeLocale( |
Victor Stinner | 2f02a51 | 2010-11-08 22:43:46 +0000 | [diff] [blame] | 14 | const wchar_t *text, |
| 15 | size_t *error_pos); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 16 | #endif |
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 | |
Serhiy Storchaka | 9fab79b | 2016-09-11 11:03:14 +0300 | [diff] [blame] | 20 | PyAPI_FUNC(PyObject *) _Py_device_encoding(int); |
| 21 | |
Steve Dower | f2f373f | 2015-02-21 08:44:05 -0800 | [diff] [blame] | 22 | #ifdef MS_WINDOWS |
| 23 | struct _Py_stat_struct { |
| 24 | unsigned long st_dev; |
| 25 | __int64 st_ino; |
| 26 | unsigned short st_mode; |
| 27 | int st_nlink; |
| 28 | int st_uid; |
| 29 | int st_gid; |
| 30 | unsigned long st_rdev; |
| 31 | __int64 st_size; |
| 32 | time_t st_atime; |
| 33 | int st_atime_nsec; |
| 34 | time_t st_mtime; |
| 35 | int st_mtime_nsec; |
| 36 | time_t st_ctime; |
| 37 | int st_ctime_nsec; |
| 38 | unsigned long st_file_attributes; |
| 39 | }; |
| 40 | #else |
| 41 | # define _Py_stat_struct stat |
| 42 | #endif |
| 43 | |
| 44 | PyAPI_FUNC(int) _Py_fstat( |
| 45 | int fd, |
Victor Stinner | e134a7f | 2015-03-30 10:09:31 +0200 | [diff] [blame] | 46 | struct _Py_stat_struct *status); |
| 47 | |
| 48 | PyAPI_FUNC(int) _Py_fstat_noraise( |
| 49 | int fd, |
| 50 | struct _Py_stat_struct *status); |
Steve Dower | f2f373f | 2015-02-21 08:44:05 -0800 | [diff] [blame] | 51 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 52 | PyAPI_FUNC(int) _Py_stat( |
Victor Stinner | a4a7595 | 2010-10-07 22:23:10 +0000 | [diff] [blame] | 53 | PyObject *path, |
Victor Stinner | e134a7f | 2015-03-30 10:09:31 +0200 | [diff] [blame] | 54 | struct stat *status); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 55 | |
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); |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 63 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 64 | PyAPI_FUNC(FILE *) _Py_wfopen( |
| 65 | const wchar_t *path, |
| 66 | const wchar_t *mode); |
| 67 | |
| 68 | PyAPI_FUNC(FILE*) _Py_fopen( |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 69 | const char *pathname, |
| 70 | const char *mode); |
| 71 | |
| 72 | PyAPI_FUNC(FILE*) _Py_fopen_obj( |
Victor Stinner | a4a7595 | 2010-10-07 22:23:10 +0000 | [diff] [blame] | 73 | PyObject *path, |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 74 | const char *mode); |
| 75 | |
Victor Stinner | 66aab0c | 2015-03-19 22:53:20 +0100 | [diff] [blame] | 76 | PyAPI_FUNC(Py_ssize_t) _Py_read( |
| 77 | int fd, |
| 78 | void *buf, |
| 79 | size_t count); |
| 80 | |
| 81 | PyAPI_FUNC(Py_ssize_t) _Py_write( |
| 82 | int fd, |
| 83 | const void *buf, |
| 84 | size_t count); |
| 85 | |
Victor Stinner | 82c3e45 | 2015-04-01 18:34:45 +0200 | [diff] [blame] | 86 | PyAPI_FUNC(Py_ssize_t) _Py_write_noraise( |
| 87 | int fd, |
| 88 | const void *buf, |
| 89 | size_t count); |
| 90 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 91 | #ifdef HAVE_READLINK |
| 92 | PyAPI_FUNC(int) _Py_wreadlink( |
| 93 | const wchar_t *path, |
| 94 | wchar_t *buf, |
| 95 | size_t bufsiz); |
| 96 | #endif |
| 97 | |
| 98 | #ifdef HAVE_REALPATH |
| 99 | PyAPI_FUNC(wchar_t*) _Py_wrealpath( |
| 100 | const wchar_t *path, |
Victor Stinner | 015f4d8 | 2010-10-07 22:29:53 +0000 | [diff] [blame] | 101 | wchar_t *resolved_path, |
| 102 | size_t resolved_path_size); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 103 | #endif |
| 104 | |
| 105 | PyAPI_FUNC(wchar_t*) _Py_wgetcwd( |
| 106 | wchar_t *buf, |
| 107 | size_t size); |
| 108 | |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 109 | PyAPI_FUNC(int) _Py_get_inheritable(int fd); |
| 110 | |
| 111 | PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, |
| 112 | int *atomic_flag_works); |
| 113 | |
| 114 | PyAPI_FUNC(int) _Py_dup(int fd); |
Victor Stinner | 1db9e7b | 2014-07-29 22:32:47 +0200 | [diff] [blame] | 115 | |
| 116 | #ifndef MS_WINDOWS |
| 117 | PyAPI_FUNC(int) _Py_get_blocking(int fd); |
| 118 | |
| 119 | PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); |
| 120 | #endif /* !MS_WINDOWS */ |
| 121 | |
| 122 | #endif /* Py_LIMITED_API */ |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 123 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 124 | #ifdef __cplusplus |
| 125 | } |
| 126 | #endif |
| 127 | |
| 128 | #endif /* !Py_FILEUTILS_H */ |