Permalink
Browse files

* configure.in: Add header, structure member, and function checks as

	  Android doesn't provide all the headers, structure members, and 
	  functions that a "full" Linux distro includes.
	* support/dirent.c, support/grp.c, support/macros.c, support/pwd.c, 
	  support/signal.c, support/sys-statvfs.c, support/sys-time.c,
	  support/unistd.c: Add #if HAVE_XXX checks for functions which aren't
	  provided on Android.

svn path=/trunk/mono/; revision=155753
  • Loading branch information...
1 parent 0b02929 commit 34977c6415b49165f2fcfa3632025733e530fe41 Jonathan Pryor committed Apr 19, 2010
Showing with 94 additions and 5 deletions.
  1. +6 −0 ChangeLog
  2. +22 −5 configure.in
  3. +6 −0 support/ChangeLog
  4. +4 −0 support/dirent.c
  5. +8 −0 support/grp.c
  6. +3 −0 support/macros.c
  7. +10 −0 support/pwd.c
  8. +2 −0 support/signal.c
  9. +10 −0 support/sys-statvfs.c
  10. +2 −0 support/sys-time.c
  11. +21 −0 support/unistd.c
View
@@ -1,3 +1,9 @@
+2010-04-19 Jonathan Pryor <jpryor@novell.com>
+
+ * configure.in: Add header, structure member, and function checks as
+ Android doesn't provide all the headers, structure members, and
+ functions that a "full" Linux distro includes.
+
2010-04-19 Zoltan Varga <vargaz@gmail.com>
* configure.in: Add a --enable-minimal=normalization option to disable support
View
@@ -1633,6 +1633,7 @@ if test x$target_win32 = xno; then
dnl *** Checks for MonoPosixHelper ***
dnl **********************************
AC_CHECK_HEADERS(checklist.h)
+ AC_CHECK_HEADERS(pathconf.h)
AC_CHECK_HEADERS(fstab.h)
AC_CHECK_HEADERS(attr/xattr.h)
AC_CHECK_HEADERS(sys/extattr.h)
@@ -1644,28 +1645,36 @@ if test x$target_win32 = xno; then
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/mount.h)
+ AC_CHECK_FUNCS(confstr)
+ AC_CHECK_FUNCS(seekdir telldir)
AC_CHECK_FUNCS(getdomainname)
AC_CHECK_FUNCS(setdomainname)
- AC_CHECK_FUNCS(fgetgrent)
- AC_CHECK_FUNCS(fgetpwent)
- AC_CHECK_FUNCS(fgetpwent)
+ AC_CHECK_FUNCS(endgrent getgrent fgetgrent setgrent)
+ AC_CHECK_FUNCS(setgroups)
+ AC_CHECK_FUNCS(endpwent getpwent fgetpwent setpwent)
AC_CHECK_FUNCS(getfsstat)
- AC_CHECK_FUNCS(lutimes)
+ AC_CHECK_FUNCS(lutimes futimes)
AC_CHECK_FUNCS(mremap)
AC_CHECK_FUNCS(remap_file_pages)
AC_CHECK_FUNCS(posix_fadvise)
AC_CHECK_FUNCS(posix_fallocate)
AC_CHECK_FUNCS(posix_madvise)
AC_CHECK_FUNCS(vsnprintf)
AC_CHECK_FUNCS(sendfile)
- AC_CHECK_FUNCS(sethostid)
+ AC_CHECK_FUNCS(gethostid sethostid)
+ AC_CHECK_FUNCS(sethostname)
AC_CHECK_FUNCS(statfs)
AC_CHECK_FUNCS(fstatfs)
AC_CHECK_FUNCS(statvfs)
AC_CHECK_FUNCS(fstatvfs)
AC_CHECK_FUNCS(stime)
AC_CHECK_FUNCS(strerror_r)
AC_CHECK_FUNCS(ttyname_r)
+ AC_CHECK_FUNCS(psignal)
+ AC_CHECK_FUNCS(getlogin_r)
+ AC_CHECK_FUNCS(lockf)
+ AC_CHECK_FUNCS(swab)
+ AC_CHECK_FUNCS(setusershell endusershell)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], ,
[#include <sys/types.h>
@@ -1701,6 +1710,14 @@ if test x$target_win32 = xno; then
[struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
[#include <sys/types.h>
#include <dirent.h>])
+ AC_CHECK_MEMBERS(
+ [struct passwd.pw_gecos],,,
+ [#include <sys/types.h>
+ #include <pwd.h>])
+ AC_CHECK_MEMBERS(
+ [struct statfs.f_flags],,,
+ [#include <sys/types.h>
+ #include <sys/vfs.h>])
dnl Favour xattr through glibc, but use libattr if we have to
AC_CHECK_FUNC(lsetxattr, ,
View
@@ -1,3 +1,9 @@
+2010-04-19 Jonathan Pryor <jpryor@novell.com>
+
+ * dirent.c, grp.c, macros.c, pwd.c, signal.c, sys-statvfs.c, sys-time.c,
+ unistd.c: Add #if HAVE_XXX checks for functions which aren't
+ provided on Android.
+
2010-04-15 Jonathan Pryor <jpryor@novell.com>
* Makefile.am: Revert previous linkage against libmono.so, as lupus
View
@@ -29,6 +29,7 @@
G_BEGIN_DECLS
+#if HAVE_SEEKDIR
gint32
Mono_Posix_Syscall_seekdir (void *dir, mph_off_t offset)
{
@@ -38,12 +39,15 @@ Mono_Posix_Syscall_seekdir (void *dir, mph_off_t offset)
return 0;
}
+#endif /* def HAVE_SEEKDIR */
+#if HAVE_TELLDIR
mph_off_t
Mono_Posix_Syscall_telldir (void *dir)
{
return telldir ((DIR*) dir);
}
+#endif /* def HAVE_TELLDIR */
static void
copy_dirent (struct Mono_Posix_Syscall__Dirent *to, struct dirent *from)
View
@@ -226,6 +226,7 @@ Mono_Posix_Syscall_getgrgid_r (mph_gid_t gid,
}
#endif /* ndef HAVE_GETGRGID_R */
+#if HAVE_GETGRENT
gint32
Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf)
{
@@ -247,6 +248,7 @@ Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf)
}
return 0;
}
+#endif /* def HAVE_GETGRENT */
#ifdef HAVE_FGETGRENT
gint32
@@ -272,13 +274,16 @@ Mono_Posix_Syscall_fgetgrent (void *stream, struct Mono_Posix_Syscall__Group *gr
}
#endif /* ndef HAVE_FGETGRENT */
+#if HAVE_SETGROUPS
gint32
Mono_Posix_Syscall_setgroups (mph_size_t size, mph_gid_t *list)
{
mph_return_if_size_t_overflow (size);
return setgroups ((size_t) size, list);
}
+#endif /* def HAVE_SETGROUPS */
+#if HAVE_SETGRENT
int
Mono_Posix_Syscall_setgrent (void)
{
@@ -289,13 +294,16 @@ Mono_Posix_Syscall_setgrent (void)
mph_return_if_val_in_list5(errno, EIO, EMFILE, ENFILE, ENOMEM, ERANGE);
return 0;
}
+#endif /* def HAVE_SETGRENT */
+#if HAVE_ENDGRENT
int
Mono_Posix_Syscall_endgrent (void)
{
endgrent();
return 0;
}
+#endif /* def HAVE_ENDGRENT */
G_END_DECLS
View
@@ -99,6 +99,7 @@ char *helper_Mono_Posix_readdir(void *dir) {
return strdup (e->d_name);
}
+#if HAVE_GETPWNAM_R
int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
char **account,
char **password,
@@ -145,3 +146,5 @@ int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
return 0;
}
+#endif /* def HAVE_GETPWNAM_R */
+
View
@@ -22,7 +22,9 @@ static const mph_string_offset_t
passwd_offsets[] = {
MPH_STRING_OFFSET (struct passwd, pw_name, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct passwd, pw_passwd, MPH_STRING_OFFSET_PTR),
+#if HAVE_STRUCT_PASSWD_PW_GECOS
MPH_STRING_OFFSET (struct passwd, pw_gecos, MPH_STRING_OFFSET_PTR),
+#endif /* def HAVE_STRUCT_PASSWD_PW_GECOS */
MPH_STRING_OFFSET (struct passwd, pw_dir, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct passwd, pw_shell, MPH_STRING_OFFSET_PTR)
};
@@ -31,7 +33,9 @@ static const mph_string_offset_t
mph_passwd_offsets[] = {
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_name, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_passwd, MPH_STRING_OFFSET_PTR),
+#if HAVE_STRUCT_PASSWD_PW_GECOS
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_gecos, MPH_STRING_OFFSET_PTR),
+#endif /* def HAVE_STRUCT_PASSWD_PW_GECOS */
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_dir, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_shell, MPH_STRING_OFFSET_PTR)
};
@@ -187,6 +191,7 @@ Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid,
}
#endif /* ndef HAVE_GETPWUID_R */
+#if HAVE_GETPWENT
gint32
Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd *pwbuf)
{
@@ -208,6 +213,7 @@ Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd *pwbuf)
}
return 0;
}
+#endif /* def HAVE_GETPWENT */
#ifdef HAVE_FGETPWENT
gint32
@@ -233,6 +239,7 @@ Mono_Posix_Syscall_fgetpwent (void *stream, struct Mono_Posix_Syscall__Passwd *p
}
#endif /* ndef HAVE_FGETPWENT */
+#if HAVE_SETPWENT
int
Mono_Posix_Syscall_setpwent (void)
{
@@ -243,7 +250,9 @@ Mono_Posix_Syscall_setpwent (void)
mph_return_if_val_in_list5(errno, EIO, EMFILE, ENFILE, ENOMEM, ERANGE);
return 0;
}
+#endif /* def HAVE_SETPWENT */
+#if HAVE_ENDPWENT
int
Mono_Posix_Syscall_endpwent (void)
{
@@ -253,6 +262,7 @@ Mono_Posix_Syscall_endpwent (void)
return -1;
return 0;
}
+#endif /* def HAVE_ENDPWENT */
G_END_DECLS
View
@@ -120,13 +120,15 @@ int Mono_Posix_FromRealTimeSignum (int offset, int *r)
#define mph_int_set(p,o,n) do { *(p) = n; } while (0)
#endif
+#if HAVE_PSIGNAL
int
Mono_Posix_Syscall_psignal (int sig, const char* s)
{
errno = 0;
psignal (sig, s);
return errno == 0 ? 0 : -1;
}
+#endif /* def HAVE_PSIGNAL */
#define NUM_SIGNALS 64
static signal_info signals[NUM_SIGNALS];
View
@@ -14,8 +14,14 @@
#include "mph.h"
#include "map.h"
+#ifdef HAVE_PATHCONF_H
+#include <pathconf.h>
+#endif
+
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
+#elif defined (HAVE_STATFS) || defined (HAVE_FSTATFS)
+#include <sys/vfs.h>
#endif /* def HAVE_SYS_STATVFS_H */
#ifdef HAVE_GETFSSTAT
@@ -142,8 +148,10 @@ Mono_Posix_ToStatvfs (void *_from, struct Mono_Posix_Statvfs *to)
// so this shouldn't lose anything.
memcpy (&to->f_fsid, &from->f_fsid, sizeof(to->f_fsid));
+#if HAVE_STRUCT_STATFS_F_FLAGS
if (Mono_Posix_ToMountFlags (from->f_flags, &to->f_flag) != 0)
return -1;
+#endif /* def HAVE_STRUCT_STATFS_F_FLAGS */
return 0;
}
@@ -165,9 +173,11 @@ Mono_Posix_FromStatvfs (struct Mono_Posix_Statvfs *from, void *_to)
// so this shouldn't lose anything.
memcpy (&to->f_fsid, &from->f_fsid, sizeof(to->f_fsid));
+#if HAVE_STRUCT_STATFS_F_FLAGS
if (Mono_Posix_FromMountFlags (from->f_flag, &flag) != 0)
return -1;
to->f_flags = flag;
+#endif /* def HAVE_STRUCT_STATFS_F_FLAGS */
return 0;
}
View
@@ -124,6 +124,7 @@ Mono_Posix_Syscall_lutimes(const char *filename, struct Mono_Posix_Timeval *tv)
}
#endif /* def HAVE_LUTIMES */
+#if HAVE_FUTIMES
gint32
Mono_Posix_Syscall_futimes(int fd, struct Mono_Posix_Timeval *tv)
{
@@ -134,6 +135,7 @@ Mono_Posix_Syscall_futimes(int fd, struct Mono_Posix_Timeval *tv)
return futimes (fd, ptv);
}
+#endif /* def HAVE_FUTIMES */
G_END_DECLS
Oops, something went wrong.

0 comments on commit 34977c6

Please sign in to comment.