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 | |
Victor Stinner | b306d75 | 2010-10-07 22:09:40 +0000 | [diff] [blame] | 18 | #if defined(HAVE_STAT) && !defined(MS_WINDOWS) |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 19 | PyAPI_FUNC(int) _Py_wstat( |
| 20 | const wchar_t* path, |
| 21 | struct stat *buf); |
| 22 | #endif |
| 23 | |
Steve Dower | f2f373f | 2015-02-21 08:44:05 -0800 | [diff] [blame] | 24 | #if defined(HAVE_FSTAT) || defined(MS_WINDOWS) |
| 25 | |
| 26 | #ifdef MS_WINDOWS |
| 27 | struct _Py_stat_struct { |
| 28 | unsigned long st_dev; |
| 29 | __int64 st_ino; |
| 30 | unsigned short st_mode; |
| 31 | int st_nlink; |
| 32 | int st_uid; |
| 33 | int st_gid; |
| 34 | unsigned long st_rdev; |
| 35 | __int64 st_size; |
| 36 | time_t st_atime; |
| 37 | int st_atime_nsec; |
| 38 | time_t st_mtime; |
| 39 | int st_mtime_nsec; |
| 40 | time_t st_ctime; |
| 41 | int st_ctime_nsec; |
| 42 | unsigned long st_file_attributes; |
| 43 | }; |
| 44 | #else |
| 45 | # define _Py_stat_struct stat |
| 46 | #endif |
| 47 | |
| 48 | PyAPI_FUNC(int) _Py_fstat( |
| 49 | int fd, |
| 50 | struct _Py_stat_struct *stat); |
| 51 | #endif /* HAVE_FSTAT || MS_WINDOWS */ |
| 52 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 53 | #ifdef HAVE_STAT |
| 54 | PyAPI_FUNC(int) _Py_stat( |
Victor Stinner | a4a7595 | 2010-10-07 22:23:10 +0000 | [diff] [blame] | 55 | PyObject *path, |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 56 | struct stat *statbuf); |
Steve Dower | f2f373f | 2015-02-21 08:44:05 -0800 | [diff] [blame] | 57 | #endif /* HAVE_STAT */ |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 58 | |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 59 | #ifndef Py_LIMITED_API |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 60 | PyAPI_FUNC(int) _Py_open( |
| 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 | |
| 77 | #ifdef HAVE_READLINK |
| 78 | PyAPI_FUNC(int) _Py_wreadlink( |
| 79 | const wchar_t *path, |
| 80 | wchar_t *buf, |
| 81 | size_t bufsiz); |
| 82 | #endif |
| 83 | |
| 84 | #ifdef HAVE_REALPATH |
| 85 | PyAPI_FUNC(wchar_t*) _Py_wrealpath( |
| 86 | const wchar_t *path, |
Victor Stinner | 015f4d8 | 2010-10-07 22:29:53 +0000 | [diff] [blame] | 87 | wchar_t *resolved_path, |
| 88 | size_t resolved_path_size); |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 89 | #endif |
| 90 | |
| 91 | PyAPI_FUNC(wchar_t*) _Py_wgetcwd( |
| 92 | wchar_t *buf, |
| 93 | size_t size); |
| 94 | |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 95 | #ifndef Py_LIMITED_API |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 96 | PyAPI_FUNC(int) _Py_get_inheritable(int fd); |
| 97 | |
| 98 | PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable, |
| 99 | int *atomic_flag_works); |
| 100 | |
| 101 | PyAPI_FUNC(int) _Py_dup(int fd); |
Victor Stinner | 1db9e7b | 2014-07-29 22:32:47 +0200 | [diff] [blame] | 102 | |
| 103 | #ifndef MS_WINDOWS |
| 104 | PyAPI_FUNC(int) _Py_get_blocking(int fd); |
| 105 | |
| 106 | PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking); |
| 107 | #endif /* !MS_WINDOWS */ |
| 108 | |
| 109 | #endif /* Py_LIMITED_API */ |
Victor Stinner | daf4555 | 2013-08-28 00:53:59 +0200 | [diff] [blame] | 110 | |
Victor Stinner | 4e31443 | 2010-10-07 21:45:39 +0000 | [diff] [blame] | 111 | #ifdef __cplusplus |
| 112 | } |
| 113 | #endif |
| 114 | |
| 115 | #endif /* !Py_FILEUTILS_H */ |