blob: 4016431daa731647daa66950bb116176907b4ff8 [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
Victor Stinnerf6a271a2014-08-01 12:28:48 +02008PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
Victor Stinner168e1172010-10-16 23:16:16 +00009 const char *arg,
10 size_t *size);
Victor Stinner4e314432010-10-07 21:45:39 +000011
Victor Stinnerf6a271a2014-08-01 12:28:48 +020012PyAPI_FUNC(char*) Py_EncodeLocale(
Victor Stinner2f02a512010-11-08 22:43:46 +000013 const wchar_t *text,
14 size_t *error_pos);
Victor Stinner4e314432010-10-07 21:45:39 +000015
Serhiy Storchaka12ebbc72015-02-22 19:39:36 +020016#ifndef Py_LIMITED_API
Steve Dowerf2f373f2015-02-21 08:44:05 -080017
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +030018PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
19
Steve Dowerf2f373f2015-02-21 08:44:05 -080020#ifdef MS_WINDOWS
21struct _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
42PyAPI_FUNC(int) _Py_fstat(
43 int fd,
Victor Stinnere134a7f2015-03-30 10:09:31 +020044 struct _Py_stat_struct *status);
45
46PyAPI_FUNC(int) _Py_fstat_noraise(
47 int fd,
48 struct _Py_stat_struct *status);
Steve Dowerf2f373f2015-02-21 08:44:05 -080049
Victor Stinner4e314432010-10-07 21:45:39 +000050PyAPI_FUNC(int) _Py_stat(
Victor Stinnera4a75952010-10-07 22:23:10 +000051 PyObject *path,
Victor Stinnere134a7f2015-03-30 10:09:31 +020052 struct stat *status);
Victor Stinner4e314432010-10-07 21:45:39 +000053
Victor Stinnerdaf45552013-08-28 00:53:59 +020054PyAPI_FUNC(int) _Py_open(
55 const char *pathname,
56 int flags);
Victor Stinnera555cfc2015-03-18 00:22:14 +010057
58PyAPI_FUNC(int) _Py_open_noraise(
59 const char *pathname,
60 int flags);
Victor Stinnerdaf45552013-08-28 00:53:59 +020061
Victor Stinner4e314432010-10-07 21:45:39 +000062PyAPI_FUNC(FILE *) _Py_wfopen(
63 const wchar_t *path,
64 const wchar_t *mode);
65
66PyAPI_FUNC(FILE*) _Py_fopen(
Victor Stinnerdaf45552013-08-28 00:53:59 +020067 const char *pathname,
68 const char *mode);
69
70PyAPI_FUNC(FILE*) _Py_fopen_obj(
Victor Stinnera4a75952010-10-07 22:23:10 +000071 PyObject *path,
Victor Stinner4e314432010-10-07 21:45:39 +000072 const char *mode);
73
Victor Stinner66aab0c2015-03-19 22:53:20 +010074PyAPI_FUNC(Py_ssize_t) _Py_read(
75 int fd,
76 void *buf,
77 size_t count);
78
79PyAPI_FUNC(Py_ssize_t) _Py_write(
80 int fd,
81 const void *buf,
82 size_t count);
83
Victor Stinner82c3e452015-04-01 18:34:45 +020084PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
85 int fd,
86 const void *buf,
87 size_t count);
88
Victor Stinner4e314432010-10-07 21:45:39 +000089#ifdef HAVE_READLINK
90PyAPI_FUNC(int) _Py_wreadlink(
91 const wchar_t *path,
92 wchar_t *buf,
93 size_t bufsiz);
94#endif
95
96#ifdef HAVE_REALPATH
97PyAPI_FUNC(wchar_t*) _Py_wrealpath(
98 const wchar_t *path,
Victor Stinner015f4d82010-10-07 22:29:53 +000099 wchar_t *resolved_path,
100 size_t resolved_path_size);
Victor Stinner4e314432010-10-07 21:45:39 +0000101#endif
102
103PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
104 wchar_t *buf,
105 size_t size);
106
Victor Stinnerdaf45552013-08-28 00:53:59 +0200107PyAPI_FUNC(int) _Py_get_inheritable(int fd);
108
109PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
110 int *atomic_flag_works);
111
112PyAPI_FUNC(int) _Py_dup(int fd);
Victor Stinner1db9e7b2014-07-29 22:32:47 +0200113
114#ifndef MS_WINDOWS
115PyAPI_FUNC(int) _Py_get_blocking(int fd);
116
117PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
118#endif /* !MS_WINDOWS */
119
120#endif /* Py_LIMITED_API */
Victor Stinnerdaf45552013-08-28 00:53:59 +0200121
Victor Stinner4e314432010-10-07 21:45:39 +0000122#ifdef __cplusplus
123}
124#endif
125
126#endif /* !Py_FILEUTILS_H */