compile on Darwin.
svn path=/trunk/mono/; revision=35725
* support/Makefile.am: Add new INCLUDE directives (for glib headers),
source; bump library version (so we don't clobber previous versions of
libMonoPosixHelper.so).
- * support/dirent.c: New file; <dirent.h> wrapper functions
+ * support/dirent.c: New file; <dirent.h> wrapper functions;
+ BSD portability fixes.
* support/errno.c: New file; <errno.h> wrapper functions
- * support/fcntl.c: New file; <fcntl.h> wrapper functions
- * support/grp.c: New file; <grp.h> wrapper functions
+ * support/fcntl.c: New file; <fcntl.h> wrapper functions;
+ BSD portability fixes.
+ * support/grp.c: New file; <grp.h> wrapper functions;
+ BSD portability fixes.
* support/map.c: Updated macro mapping functions (more enums mapped, more
error checking, etc.).
* support/map.h: Updated macro mapping functions
* support/old-map.c: Previous map.c implementation, for backward compatibility
+ Remove spurious warning about redefining _GNU_SOURCE.
* support/old-map.h: Previous map.h implementation, for backward compatibility
- * support/mph.h: New file; Utility types, macros
- * support/pwd.c: New file; <pwd.h> wrapper functions
+ * support/mph.h: New file; Utility types, macros;
+ BSD portability fixes.
+ * support/pwd.c: New file; <pwd.h> wrapper functions;
+ BSD portability fixes.
* support/stdio.c: New file; <stdio.h> wrapper functions
* support/stdlib.c: New file; <stdlib.h> wrapper functions
* support/sys-mman.c: New file; <sys/mman.h> wrapper functions
- * support/sys-mount.c: New file; <sys/mount.h> wrapper functions
- * support/sys-sendfile.c: New file; <sys/sendfile.h> wrapper functions
+ * support/sys-mount.c: New file; <sys/mount.h> wrapper functions;
+ BSD portability fixes.
+ * support/sys-sendfile.c: New file; <sys/sendfile.h> wrapper functions;
+ BSD portability fixes.
* support/sys-stat.c: New file; <sys/stat.h> wrapper functions
* support/sys-wait.c: New file; <sys/wait.h> wrapper functions
- * support/time.c: New file; <time.h> wrapper functions
- * support/unistd.c: New file; <unistd.h> wrapper functions
+ * support/time.c: New file; <time.h> wrapper functions;
+ BSD portability fixes.
+ * support/unistd.c: New file; <unistd.h> wrapper functions;
+ BSD portability fixes.
2004-10-31 Zoltan Varga <vargaz@freemail.hu>
)
{
to->d_ino = from->d_ino;
+#ifdef MPH_ON_BSD
+ to->d_off = 0;
+#else
to->d_off = from->d_off;
+#endif
to->d_reclen = from->d_reclen;
to->d_type = from->d_type;
to->d_name = strdup (from->d_name);
Mono_Posix_Syscall_fcntl_arg (gint32 fd, gint32 cmd, gint64 arg)
{
long _arg;
- int _argi;
gint32 _cmd;
mph_return_if_long_overflow (arg);
#ifdef F_NOTIFY
if (cmd == F_NOTIFY) {
+ int _argi;
if (Mono_Posix_FromDirectoryNotifyFlags (arg, &_argi) == -1) {
return -1;
}
#endif
}
+#ifdef HAVE_POSIX_FADVISE
gint32
Mono_Posix_Syscall_posix_fadvise (gint32 fd, mph_off_t offset, mph_off_t len,
gint32 advice)
return posix_fadvise (fd, (off_t) offset, (off_t) len, advice);
#endif
}
+#endif /* ndef HAVE_POSIX_FADVISE */
+#ifdef HAVE_POSIX_FALLOCATE
gint32
Mono_Posix_Syscall_posix_fallocate (gint32 fd, mph_off_t offset, mph_size_t len)
{
return posix_fadvise (fd, (off_t) offset, (size_t) len);
#endif
}
+#endif /* ndef HAVE_POSIX_FALLOCATE */
G_END_DECLS
* Copyright (C) 2004 Jonathan Pryor
*/
+#include <sys/types.h>
+#include <sys/param.h>
#include <grp.h>
+#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <unistd.h> /* for setgroups on Mac OS X */
#include "mph.h"
return 0;
}
+#ifdef HAVE_FGETGRENT
gint32
Mono_Posix_Syscall_fgetgrent (FILE *stream, struct Mono_Posix_Syscall__Group *grbuf)
{
}
return 0;
}
+#endif /* ndef HAVE_FGETGRENT */
gint32
Mono_Posix_Syscall_setgroups (mph_size_t size, mph_gid_t *list)
#define MPH_USE_64_API
#endif
+#if __APPLE__ || __BSD__
+#define MPH_ON_BSD
+#endif
+
typedef gint64 mph_blkcnt_t;
typedef gint64 mph_blksize_t;
typedef guint64 mph_dev_t;
/* This file was automatically generated by make-map from Mono.Posix.dll */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
return 0;
}
+#ifdef HAVE_FGETPWENT
gint32
Mono_Posix_Syscall_fgetpwent (FILE *stream, struct Mono_Posix_Syscall__Passwd *pwbuf)
{
}
return 0;
}
+#endif /* ndef FGETPWENT */
G_END_DECLS
#include <sys/mount.h>
#include <glib/gtypes.h>
+#include "mph.h"
#include "map.h"
G_BEGIN_DECLS
gint32
Mono_Posix_Syscall_mount (const char *source, const char *target,
- const char *filesystemtype, guint64 mountflags, const void *data)
+ const char *filesystemtype, guint64 mountflags, void *data)
{
if (Mono_Posix_FromMountFlags (mountflags, &mountflags) == -1)
return -1;
+#ifdef MPH_ON_BSD
+ return mount (filesystemtype, target, mountflags, data);
+#else
return mount (source, target, filesystemtype, (unsigned long) mountflags, data);
+#endif
+}
+
+gint32
+Mono_Posix_Syscall_umount (const char *source)
+{
+#ifdef MPH_ON_BSD
+ return unmount (source, MNT_FORCE);
+#else
+ return umount (source);
+#endif
+}
+
+gint32
+Mono_Posix_Syscall_umount2 (const char *source, gint32 flags)
+{
+#ifdef MPH_ON_BSD
+ return unmount (source, flags);
+#else
+ return umount2 (source, flags);
+#endif
}
G_END_DECLS
* Copyright (C) 2004 Jonathan Pryor
*/
-#include <sys/sendfile.h>
+#include <sys/types.h>
#include <errno.h>
+#ifdef HAVE_SYS_SENDFILE_H
+#include <sys/sendfile.h>
+#endif /* ndef HAVE_SYS_SENDFILE_H */
+
#include "mph.h"
G_BEGIN_DECLS
+#ifdef HAVE_SENDFILE
mph_ssize_t
Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_t count)
{
return r;
}
+#endif /* ndef HAVE_SENDFILE */
G_END_DECLS
G_BEGIN_DECLS
+#ifdef HAVE_STIME
gint32
Mono_Posix_Syscall_stime (mph_time_t *t)
{
_t = (time_t) *t;
return stime (&_t);
}
+#endif /* ndef HAVE_STIME */
mph_time_t
Mono_Posix_Syscall_time (mph_time_t *t)
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
+#include <string.h> /* for swab(3) on Mac OS X */
#include <glib/gtypes.h>
return confstr (name, buf, (size_t) len);
}
+#ifdef HAVE_TTYNAME_R
gint32
Mono_Posix_Syscall_ttyname_r (int fd, char *buf, mph_size_t len)
{
mph_return_if_size_t_overflow (len);
return ttyname_r (fd, buf, (size_t) len);
}
+#endif /* ndef HAVE_TTYNAME_R */
gint32
Mono_Posix_Syscall_readlink (const char *path, char *buf, mph_size_t len)
Mono_Posix_Syscall_sethostid (gint64 hostid)
{
mph_return_if_long_overflow (hostid);
+#ifdef MPH_ON_BSD
+ sethostid ((long) hostid);
+ return 0;
+#else
return sethostid ((long) hostid);
+#endif
}
gint32