EntryPoint="Mono_Posix_Syscall_get_at_fdcwd")]
private static extern int get_at_fdcwd ();
- public static int AT_FDCWD { get { return get_at_fdcwd (); } }
+ public static readonly int AT_FDCWD = get_at_fdcwd ();
#endregion
[DllImport (MPH, EntryPoint="Mono_Posix_Syscall_L_ctermid")]
private static extern int _L_ctermid ();
- public static int L_ctermid { get { return _L_ctermid (); } }
+ public static readonly int L_ctermid = _L_ctermid ();
[DllImport (MPH, EntryPoint="Mono_Posix_Syscall_L_cuserid")]
private static extern int _L_cuserid ();
- public static int L_cuserid { get { return _L_cuserid (); } }
+ public static readonly int L_cuserid = _L_cuserid ();
internal static object getlogin_lock = new object ();
EntryPoint="Mono_Posix_Syscall_get_utime_omit")]
private static extern long get_utime_omit ();
- public static long UTIME_NOW { get { return get_utime_now (); } }
+ public static readonly long UTIME_NOW = get_utime_now ();
- public static long UTIME_OMIT { get { return get_utime_omit (); } }
+ public static readonly long UTIME_OMIT = get_utime_omit ();
[DllImport (MPH, SetLastError=true,
EntryPoint="Mono_Posix_Syscall_futimens")]
Mono_Posix_Stdlib_strlen\r
Mono_Posix_Stdlib_tmpfile\r
Mono_Posix_Stdlib_ungetc\r
+Mono_Posix_Syscall_L_ctermid\r
+Mono_Posix_Syscall_L_cuserid\r
+Mono_Posix_Syscall_get_at_fdcwd\r
+Mono_Posix_Syscall_get_utime_now\r
+Mono_Posix_Syscall_get_utime_omit\r
Mono_Posix_ToAccessModes\r
Mono_Posix_ToConfstrName\r
Mono_Posix_ToDirectoryNotifyFlags\r
<ClCompile Include="..\support\crc32.c" />\r
<ClCompile Include="..\support\deflate.c" />\r
<ClCompile Include="..\support\errno.c" />\r
+ <ClCompile Include="..\support\fcntl.c" />\r
<ClCompile Include="..\support\infback.c" />\r
<ClCompile Include="..\support\inffast.c" />\r
<ClCompile Include="..\support\inflate.c" />\r
<ClCompile Include="..\support\stdio.c" />\r
<ClCompile Include="..\support\stdlib.c" />\r
<ClCompile Include="..\support\string.c" />\r
+ <ClCompile Include="..\support\sys-stat.c" />\r
<ClCompile Include="..\support\trees.c" />\r
<ClCompile Include="..\support\uncompr.c" />\r
<ClCompile Include="..\support\zlib-helper.c" />\r
<ClCompile Include="..\support\minizip\ioapi.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\support\fcntl.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\support\sys-stat.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\support\crc32.h">\r
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <fcntl.h>
#include <errno.h>
+#ifdef HOST_WIN32
+#include <corecrt_io.h>
+#endif
#include "map.h"
#include "mph.h"
G_BEGIN_DECLS
+#ifndef HOST_WIN32
gint32
Mono_Posix_Syscall_fcntl (gint32 fd, gint32 cmd)
{
return r;
}
+#endif
gint32
Mono_Posix_Syscall_open (const char *pathname, gint32 flags)
int Mono_Posix_FromSeekFlags (short x, short *r)
{
*r = 0;
-#ifdef L_INCR
if (x == Mono_Posix_SeekFlags_L_INCR)
+#ifdef L_INCR
{*r = L_INCR; return 0;}
-#endif /* def L_INCR */
-#ifdef L_SET
+#else /* def L_INCR */
+ {errno = EINVAL; return -1;}
+#endif /* ndef L_INCR */
if (x == Mono_Posix_SeekFlags_L_SET)
+#ifdef L_SET
{*r = L_SET; return 0;}
-#endif /* def L_SET */
-#ifdef L_XTND
+#else /* def L_SET */
+ {errno = EINVAL; return -1;}
+#endif /* ndef L_SET */
if (x == Mono_Posix_SeekFlags_L_XTND)
+#ifdef L_XTND
{*r = L_XTND; return 0;}
-#endif /* def L_XTND */
-#ifdef SEEK_CUR
+#else /* def L_XTND */
+ {errno = EINVAL; return -1;}
+#endif /* ndef L_XTND */
if (x == Mono_Posix_SeekFlags_SEEK_CUR)
+#ifdef SEEK_CUR
{*r = SEEK_CUR; return 0;}
-#endif /* def SEEK_CUR */
-#ifdef SEEK_END
+#else /* def SEEK_CUR */
+ {errno = EINVAL; return -1;}
+#endif /* ndef SEEK_CUR */
if (x == Mono_Posix_SeekFlags_SEEK_END)
+#ifdef SEEK_END
{*r = SEEK_END; return 0;}
-#endif /* def SEEK_END */
-#ifdef SEEK_SET
+#else /* def SEEK_END */
+ {errno = EINVAL; return -1;}
+#endif /* ndef SEEK_END */
if (x == Mono_Posix_SeekFlags_SEEK_SET)
+#ifdef SEEK_SET
{*r = SEEK_SET; return 0;}
-#endif /* def SEEK_SET */
+#else /* def SEEK_SET */
+ {errno = EINVAL; return -1;}
+#endif /* ndef SEEK_SET */
+ if (x == 0)
+ return 0;
errno = EINVAL; return -1;
}
int Mono_Posix_ToSeekFlags (short x, short *r)
{
*r = 0;
+ if (x == 0)
+ return 0;
#ifdef L_INCR
if (x == L_INCR)
{*r = Mono_Posix_SeekFlags_L_INCR; return 0;}
# endif
#endif /* !defined(EOVERFLOW) */
-#if !defined (HOST_WIN32)
-
/*
- * Solaris doesn't define these BSD values, and if they're not present then
- * map.c:Mono_Posix_FromSeekFlags() breaks badly; see:
+ * Solaris/Windows don't define these BSD values, and if they're not present
+ * then map.c:Mono_Posix_FromSeekFlags() breaks badly; see:
* http://bugzilla.gnome.org/show_bug.cgi?id=370081
*/
#define L_XTND SEEK_END
#endif /* ndef L_XTND */
+#if !defined (HOST_WIN32)
+
/*
* OS X doesn't define MAP_ANONYMOUS, but it does define MAP_ANON.
* Alias them to fix: https://bugzilla.xamarin.com/show_bug.cgi?id=3419
G_BEGIN_DECLS
-#ifndef HOST_WIN32
gint32
Mono_Posix_Syscall_L_ctermid (void)
{
+#ifndef HOST_WIN32
return L_ctermid;
+#else
+ return -1;
+#endif
}
gint32
Mono_Posix_Syscall_L_cuserid (void)
{
-#if defined(__APPLE__) || defined (__OpenBSD__)
+#if defined(__APPLE__) || defined (__OpenBSD__) || defined (HOST_WIN32)
return -1;
#else
return L_cuserid;
#endif
}
-#endif /* ndef HOST_WIN32 */
mph_size_t
Mono_Posix_Stdlib_fread (unsigned char *ptr, mph_size_t size, mph_size_t nmemb, void *stream)
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <fcntl.h>
#include <errno.h>
to->st_gid = from->st_gid;
to->st_rdev = from->st_rdev;
to->st_size = from->st_size;
+#ifndef HOST_WIN32
to->st_blksize = from->st_blksize;
to->st_blocks = from->st_blocks;
+#endif
to->st_atime = from->st_atime_;
to->st_mtime = from->st_mtime_;
to->st_ctime = from->st_ctime_;
to->st_gid = from->st_gid;
to->st_rdev = from->st_rdev;
to->st_size = from->st_size;
+#ifndef HOST_WIN32
to->st_blksize = from->st_blksize;
to->st_blocks = from->st_blocks;
+#endif
to->st_atime_ = from->st_atime;
to->st_mtime_ = from->st_mtime;
to->st_ctime_ = from->st_ctime;
return r;
}
+#ifndef HOST_WIN32
gint32
Mono_Posix_Syscall_lstat (const char *file_name, struct Mono_Posix_Stat *buf)
{
r = -1;
return r;
}
+#endif
#ifdef HAVE_FSTATAT
gint32
}
#endif
+#ifndef HOST_WIN32
gint32
Mono_Posix_Syscall_mknod (const char *pathname, guint32 mode, mph_dev_t dev)
{
return -1;
return mknod (pathname, mode, dev);
}
+#endif
#ifdef HAVE_MKNODAT
gint32
#endif
}
+#if defined(HAVE_FUTIMENS) || defined(HAVE_UTIMENSAT)
static inline struct timespec*
copy_utimens (struct timespec* to, struct Mono_Posix_Timespec *from)
{
return NULL;
}
+#endif
#ifdef HAVE_FUTIMENS
gint32