File indexing completed on 2024-11-15 09:42:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef __G_STDIO_H__
0022 #define __G_STDIO_H__
0023
0024 #include <glib/gprintf.h>
0025
0026 #include <errno.h>
0027 #include <sys/stat.h>
0028
0029 G_BEGIN_DECLS
0030
0031 #if (defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)) && !defined(_WIN64)
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 typedef struct _stat32 GStatBuf;
0049
0050 #elif defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
0051
0052 typedef struct _stat64 GStatBuf;
0053
0054 #else
0055
0056 typedef struct stat GStatBuf;
0057
0058 #endif
0059
0060 #if defined(G_OS_UNIX) && !defined(G_STDIO_WRAP_ON_UNIX)
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071 #ifndef __GTK_DOC_IGNORE__
0072 #define g_chmod chmod
0073 #define g_open open
0074 #define g_creat creat
0075 #define g_rename rename
0076 #define g_mkdir mkdir
0077 #define g_stat stat
0078 #define g_lstat lstat
0079 #define g_remove remove
0080 #define g_fopen fopen
0081 #define g_freopen freopen
0082 #define g_fsync fsync
0083 #define g_utime utime
0084 #endif
0085
0086 GLIB_AVAILABLE_IN_ALL
0087 int g_access (const gchar *filename,
0088 int mode);
0089
0090 GLIB_AVAILABLE_IN_ALL
0091 int g_chdir (const gchar *path);
0092
0093 GLIB_AVAILABLE_IN_ALL
0094 int g_unlink (const gchar *filename);
0095
0096 GLIB_AVAILABLE_IN_ALL
0097 int g_rmdir (const gchar *filename);
0098
0099 #else
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 GLIB_AVAILABLE_IN_ALL
0112 int g_access (const gchar *filename,
0113 int mode);
0114
0115 GLIB_AVAILABLE_IN_ALL
0116 int g_chmod (const gchar *filename,
0117 int mode);
0118
0119 GLIB_AVAILABLE_IN_ALL
0120 int g_open (const gchar *filename,
0121 int flags,
0122 int mode);
0123
0124 GLIB_AVAILABLE_IN_ALL
0125 int g_creat (const gchar *filename,
0126 int mode);
0127
0128 GLIB_AVAILABLE_IN_ALL
0129 int g_rename (const gchar *oldfilename,
0130 const gchar *newfilename);
0131
0132 GLIB_AVAILABLE_IN_ALL
0133 int g_mkdir (const gchar *filename,
0134 int mode);
0135
0136 GLIB_AVAILABLE_IN_ALL
0137 int g_chdir (const gchar *path);
0138
0139 GLIB_AVAILABLE_IN_ALL
0140 int g_stat (const gchar *filename,
0141 GStatBuf *buf);
0142
0143 GLIB_AVAILABLE_IN_ALL
0144 int g_lstat (const gchar *filename,
0145 GStatBuf *buf);
0146
0147 GLIB_AVAILABLE_IN_ALL
0148 int g_unlink (const gchar *filename);
0149
0150 GLIB_AVAILABLE_IN_ALL
0151 int g_remove (const gchar *filename);
0152
0153 GLIB_AVAILABLE_IN_ALL
0154 int g_rmdir (const gchar *filename);
0155
0156 GLIB_AVAILABLE_IN_ALL
0157 FILE *g_fopen (const gchar *filename,
0158 const gchar *mode);
0159
0160 GLIB_AVAILABLE_IN_ALL
0161 FILE *g_freopen (const gchar *filename,
0162 const gchar *mode,
0163 FILE *stream);
0164
0165 GLIB_AVAILABLE_IN_2_64
0166 gint g_fsync (gint fd);
0167
0168 struct utimbuf;
0169
0170
0171
0172 GLIB_AVAILABLE_IN_ALL
0173 int g_utime (const gchar *filename,
0174 struct utimbuf *utb);
0175
0176 #endif
0177
0178 GLIB_AVAILABLE_IN_2_36
0179 gboolean g_close (gint fd,
0180 GError **error);
0181
0182 GLIB_AVAILABLE_STATIC_INLINE_IN_2_76
0183 static inline gboolean
0184 g_clear_fd (int *fd_ptr,
0185 GError **error)
0186 {
0187 int fd = *fd_ptr;
0188
0189 *fd_ptr = -1;
0190
0191 if (fd < 0)
0192 return TRUE;
0193
0194
0195 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
0196 return g_close (fd, error);
0197 G_GNUC_END_IGNORE_DEPRECATIONS
0198 }
0199
0200
0201
0202 #ifdef g_autofree
0203 #ifndef __GTK_DOC_IGNORE__
0204
0205 static inline void
0206 _g_clear_fd_ignore_error (int *fd_ptr)
0207 {
0208
0209 int errsv = errno;
0210
0211
0212 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
0213
0214 if (!g_clear_fd (fd_ptr, NULL))
0215 {
0216
0217
0218 }
0219
0220 G_GNUC_END_IGNORE_DEPRECATIONS
0221
0222 errno = errsv;
0223 }
0224 #endif
0225
0226 #define g_autofd _GLIB_CLEANUP(_g_clear_fd_ignore_error) GLIB_AVAILABLE_MACRO_IN_2_76
0227 #endif
0228
0229 G_END_DECLS
0230
0231 #endif