blob: b933e985392e73b4785873d3c69de174482e04cc [file] [log] [blame]
Victor Stinner4e314432010-10-07 21:45:39 +00001#ifndef Py_FILEUTILS_H
2#define Py_FILEUTILS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Serhiy Storchaka34d0ac82016-12-27 14:57:39 +02008#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
Victor Stinnerf6a271a2014-08-01 12:28:48 +02009PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
Victor Stinner168e1172010-10-16 23:16:16 +000010 const char *arg,
11 size_t *size);
Victor Stinner4e314432010-10-07 21:45:39 +000012
Victor Stinnerf6a271a2014-08-01 12:28:48 +020013PyAPI_FUNC(char*) Py_EncodeLocale(
Victor Stinner2f02a512010-11-08 22:43:46 +000014 const wchar_t *text,
15 size_t *error_pos);
Serhiy Storchaka34d0ac82016-12-27 14:57:39 +020016#endif
Victor Stinner4e314432010-10-07 21:45:39 +000017
Serhiy Storchaka12ebbc72015-02-22 19:39:36 +020018#ifndef Py_LIMITED_API
Steve Dowerf2f373f2015-02-21 08:44:05 -080019
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +030020PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
21
Steve Dowerf2f373f2015-02-21 08:44:05 -080022#ifdef MS_WINDOWS
23struct _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
44PyAPI_FUNC(int) _Py_fstat(
45 int fd,
Victor Stinnere134a7f2015-03-30 10:09:31 +020046 struct _Py_stat_struct *status);
47
48PyAPI_FUNC(int) _Py_fstat_noraise(
49 int fd,
50 struct _Py_stat_struct *status);
Steve Dowerf2f373f2015-02-21 08:44:05 -080051
Victor Stinner4e314432010-10-07 21:45:39 +000052PyAPI_FUNC(int) _Py_stat(
Victor Stinnera4a75952010-10-07 22:23:10 +000053 PyObject *path,
Victor Stinnere134a7f2015-03-30 10:09:31 +020054 struct stat *status);
Victor Stinner4e314432010-10-07 21:45:39 +000055
Victor Stinnerdaf45552013-08-28 00:53:59 +020056PyAPI_FUNC(int) _Py_open(
57 const char *pathname,
58 int flags);
Victor Stinnera555cfc2015-03-18 00:22:14 +010059
60PyAPI_FUNC(int) _Py_open_noraise(
61 const char *pathname,
62 int flags);
Victor Stinnerdaf45552013-08-28 00:53:59 +020063
Victor Stinner4e314432010-10-07 21:45:39 +000064PyAPI_FUNC(FILE *) _Py_wfopen(
65 const wchar_t *path,
66 const wchar_t *mode);
67
68PyAPI_FUNC(FILE*) _Py_fopen(
Victor Stinnerdaf45552013-08-28 00:53:59 +020069 const char *pathname,
70 const char *mode);
71
72PyAPI_FUNC(FILE*) _Py_fopen_obj(
Victor Stinnera4a75952010-10-07 22:23:10 +000073 PyObject *path,
Victor Stinner4e314432010-10-07 21:45:39 +000074 const char *mode);
75
Victor Stinner66aab0c2015-03-19 22:53:20 +010076PyAPI_FUNC(Py_ssize_t) _Py_read(
77 int fd,
78 void *buf,
79 size_t count);
80
81PyAPI_FUNC(Py_ssize_t) _Py_write(
82 int fd,
83 const void *buf,
84 size_t count);
85
Victor Stinner82c3e452015-04-01 18:34:45 +020086PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
87 int fd,
88 const void *buf,
89 size_t count);
90
Victor Stinner4e314432010-10-07 21:45:39 +000091#ifdef HAVE_READLINK
92PyAPI_FUNC(int) _Py_wreadlink(
93 const wchar_t *path,
94 wchar_t *buf,
95 size_t bufsiz);
96#endif
97
98#ifdef HAVE_REALPATH
99PyAPI_FUNC(wchar_t*) _Py_wrealpath(
100 const wchar_t *path,
Victor Stinner015f4d82010-10-07 22:29:53 +0000101 wchar_t *resolved_path,
102 size_t resolved_path_size);
Victor Stinner4e314432010-10-07 21:45:39 +0000103#endif
104
105PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
106 wchar_t *buf,
107 size_t size);
108
Victor Stinnerdaf45552013-08-28 00:53:59 +0200109PyAPI_FUNC(int) _Py_get_inheritable(int fd);
110
111PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
112 int *atomic_flag_works);
113
114PyAPI_FUNC(int) _Py_dup(int fd);
Victor Stinner1db9e7b2014-07-29 22:32:47 +0200115
116#ifndef MS_WINDOWS
117PyAPI_FUNC(int) _Py_get_blocking(int fd);
118
119PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
120#endif /* !MS_WINDOWS */
121
122#endif /* Py_LIMITED_API */
Victor Stinnerdaf45552013-08-28 00:53:59 +0200123
Victor Stinner4e314432010-10-07 21:45:39 +0000124#ifdef __cplusplus
125}
126#endif
127
128#endif /* !Py_FILEUTILS_H */