blob: 6effd88f3d69a88b88acf14c886ef3cd483555e5 [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
Brett Cannonefb00c02012-02-29 18:31:31 -05008PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
9
Victor Stinnerf6a271a2014-08-01 12:28:48 +020010PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
Victor Stinner168e1172010-10-16 23:16:16 +000011 const char *arg,
12 size_t *size);
Victor Stinner4e314432010-10-07 21:45:39 +000013
Victor Stinnerf6a271a2014-08-01 12:28:48 +020014PyAPI_FUNC(char*) Py_EncodeLocale(
Victor Stinner2f02a512010-11-08 22:43:46 +000015 const wchar_t *text,
16 size_t *error_pos);
Victor Stinner4e314432010-10-07 21:45:39 +000017
Victor Stinnerb306d752010-10-07 22:09:40 +000018#if defined(HAVE_STAT) && !defined(MS_WINDOWS)
Victor Stinner4e314432010-10-07 21:45:39 +000019PyAPI_FUNC(int) _Py_wstat(
20 const wchar_t* path,
21 struct stat *buf);
22#endif
23
Steve Dowerf2f373f2015-02-21 08:44:05 -080024#if defined(HAVE_FSTAT) || defined(MS_WINDOWS)
25
26#ifdef MS_WINDOWS
27struct _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
48PyAPI_FUNC(int) _Py_fstat(
49 int fd,
50 struct _Py_stat_struct *stat);
51#endif /* HAVE_FSTAT || MS_WINDOWS */
52
Victor Stinner4e314432010-10-07 21:45:39 +000053#ifdef HAVE_STAT
54PyAPI_FUNC(int) _Py_stat(
Victor Stinnera4a75952010-10-07 22:23:10 +000055 PyObject *path,
Victor Stinner4e314432010-10-07 21:45:39 +000056 struct stat *statbuf);
Steve Dowerf2f373f2015-02-21 08:44:05 -080057#endif /* HAVE_STAT */
Victor Stinner4e314432010-10-07 21:45:39 +000058
Martin v. Löwis1c0689c2014-01-03 21:36:49 +010059#ifndef Py_LIMITED_API
Victor Stinnerdaf45552013-08-28 00:53:59 +020060PyAPI_FUNC(int) _Py_open(
61 const char *pathname,
62 int flags);
Martin v. Löwis1c0689c2014-01-03 21:36:49 +010063#endif
Victor Stinnerdaf45552013-08-28 00:53:59 +020064
Victor Stinner4e314432010-10-07 21:45:39 +000065PyAPI_FUNC(FILE *) _Py_wfopen(
66 const wchar_t *path,
67 const wchar_t *mode);
68
69PyAPI_FUNC(FILE*) _Py_fopen(
Victor Stinnerdaf45552013-08-28 00:53:59 +020070 const char *pathname,
71 const char *mode);
72
73PyAPI_FUNC(FILE*) _Py_fopen_obj(
Victor Stinnera4a75952010-10-07 22:23:10 +000074 PyObject *path,
Victor Stinner4e314432010-10-07 21:45:39 +000075 const char *mode);
76
77#ifdef HAVE_READLINK
78PyAPI_FUNC(int) _Py_wreadlink(
79 const wchar_t *path,
80 wchar_t *buf,
81 size_t bufsiz);
82#endif
83
84#ifdef HAVE_REALPATH
85PyAPI_FUNC(wchar_t*) _Py_wrealpath(
86 const wchar_t *path,
Victor Stinner015f4d82010-10-07 22:29:53 +000087 wchar_t *resolved_path,
88 size_t resolved_path_size);
Victor Stinner4e314432010-10-07 21:45:39 +000089#endif
90
91PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
92 wchar_t *buf,
93 size_t size);
94
Martin v. Löwis1c0689c2014-01-03 21:36:49 +010095#ifndef Py_LIMITED_API
Victor Stinnerdaf45552013-08-28 00:53:59 +020096PyAPI_FUNC(int) _Py_get_inheritable(int fd);
97
98PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
99 int *atomic_flag_works);
100
101PyAPI_FUNC(int) _Py_dup(int fd);
Victor Stinner1db9e7b2014-07-29 22:32:47 +0200102
103#ifndef MS_WINDOWS
104PyAPI_FUNC(int) _Py_get_blocking(int fd);
105
106PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
107#endif /* !MS_WINDOWS */
108
109#endif /* Py_LIMITED_API */
Victor Stinnerdaf45552013-08-28 00:53:59 +0200110
Victor Stinner4e314432010-10-07 21:45:39 +0000111#ifdef __cplusplus
112}
113#endif
114
115#endif /* !Py_FILEUTILS_H */