Assume unix platforms support the original POSIX.1 standard.
Specifically, assume that if G_OS_UNIX, then we have chown(),
getcwd(), getgrgid(), getpwuid(), link(), <grp.h>, <pwd.h>,
<sys/types.h>, <sys/uio.h>, <sys/wait.h>, and <unistd.h>.
Additionally, since all versions of Windows that we care about also
have <sys/types.h>, we can remove HAVE_SYS_TYPES_H checks everywhere.
Also remove one include of <sys/times.h>, and the corresponding
configure check, since the include is not currently needed (and may
always have just been a typo for <sys/time.h>).
https://bugzilla.gnome.org/show_bug.cgi?id=710519
13 files changed:
/* define to 1 if Carbon is available */
/* #undef HAVE_CARBON */
/* define to 1 if Carbon is available */
/* #undef HAVE_CARBON */
-/* Define to 1 if you have the `chown' function. */
-/* #undef HAVE_CHOWN */
-
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* we have the futex(2) system call */
/* #undef HAVE_FUTEX */
/* we have the futex(2) system call */
/* #undef HAVE_FUTEX */
-/* Define to 1 if you have the `getcwd' function. */
-#define HAVE_GETCWD 1
-
/* Define to 1 if you have the `getc_unlocked' function. */
/* #undef HAVE_GETC_UNLOCKED */
/* Define to 1 if you have the `getfsstat' function. */
/* #undef HAVE_GETFSSTAT */
/* Define to 1 if you have the `getc_unlocked' function. */
/* #undef HAVE_GETC_UNLOCKED */
/* Define to 1 if you have the `getfsstat' function. */
/* #undef HAVE_GETFSSTAT */
-/* Define to 1 if you have the `getgrgid' function. */
-/* #undef HAVE_GETGRGID */
-
/* Define to 1 if you have the `getmntent_r' function. */
/* #undef HAVE_GETMNTENT_R */
/* Define to 1 if you have the `getprotobyname_r' function. */
/* #undef HAVE_GETPROTOBYNAME_R */
/* Define to 1 if you have the `getmntent_r' function. */
/* #undef HAVE_GETMNTENT_R */
/* Define to 1 if you have the `getprotobyname_r' function. */
/* #undef HAVE_GETPROTOBYNAME_R */
-/* Define to 1 if you have the `getpwuid' function. */
-/* #undef HAVE_GETPWUID */
-
/* Define to 1 if you have the `getresuid' function. */
/* #undef HAVE_GETRESUID */
/* Define to 1 if you have the `getresuid' function. */
/* #undef HAVE_GETRESUID */
/* define to use system printf */
/* #undef HAVE_GOOD_PRINTF */
/* define to use system printf */
/* #undef HAVE_GOOD_PRINTF */
-/* Define to 1 if you have the <grp.h> header file. */
-/* #undef HAVE_GRP_H */
-
/* Define to 1 if you have the `hasmntopt' function. */
/* #undef HAVE_HASMNTOPT */
/* Define to 1 if you have the `hasmntopt' function. */
/* #undef HAVE_HASMNTOPT */
/* Define if libelf is available */
/* #undef HAVE_LIBELF */
/* Define if libelf is available */
/* #undef HAVE_LIBELF */
-/* Define to 1 if you have the `link' function. */
-/* #undef HAVE_LINK */
-
/* Define to 1 if you have the <linux/magic.h> header file. */
/* #undef HAVE_LINUX_MAGIC_H */
/* Define to 1 if you have the <linux/magic.h> header file. */
/* #undef HAVE_LINUX_MAGIC_H */
/* Define to 1 if the system has the type `ptrdiff_t'. */
#define HAVE_PTRDIFF_T 1
/* Define to 1 if the system has the type `ptrdiff_t'. */
#define HAVE_PTRDIFF_T 1
-/* Define to 1 if you have the <pwd.h> header file. */
-/* #undef HAVE_PWD_H */
-
/* Define to 1 if you have the `readlink' function. */
/* #undef HAVE_READLINK */
/* Define to 1 if you have the `readlink' function. */
/* #undef HAVE_READLINK */
/* Define to 1 if you have the <sys/sysctl.h> header file. */
/* #undef HAVE_SYS_SYSCTL_H */
/* Define to 1 if you have the <sys/sysctl.h> header file. */
/* #undef HAVE_SYS_SYSCTL_H */
-/* Define to 1 if you have the <sys/times.h> header file. */
-/* #undef HAVE_SYS_TIMES_H */
-
/* Define to 1 if you have the <sys/time.h> header file. */
#ifndef _MSC_VER
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#ifndef _MSC_VER
#define HAVE_SYS_TIME_H 1
/* #undef HAVE_SYS_TIME_H */
#endif /* _MSC_VER */
/* #undef HAVE_SYS_TIME_H */
#endif /* _MSC_VER */
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <sys/uio.h> header file. */
-/* #undef HAVE_SYS_UIO_H */
-
/* Define to 1 if you have the <sys/vfstab.h> header file. */
/* #undef HAVE_SYS_VFSTAB_H */
/* Define to 1 if you have the <sys/vfstab.h> header file. */
/* #undef HAVE_SYS_VFSTAB_H */
/* Define to 1 if you have the <sys/vmount.h> header file. */
/* #undef HAVE_SYS_VMOUNT_H */
/* Define to 1 if you have the <sys/vmount.h> header file. */
/* #undef HAVE_SYS_VMOUNT_H */
-/* Define to 1 if you have the <sys/wait.h> header file. */
-/* #undef HAVE_SYS_WAIT_H */
-
/* Define to 1 if you have the <sys/xattr.h> header file. */
/* #undef HAVE_SYS_XATTR_H */
/* Define to 1 if you have the <sys/xattr.h> header file. */
/* #undef HAVE_SYS_XATTR_H */
-AC_CHECK_HEADERS([dirent.h pwd.h grp.h sys/param.h sys/poll.h sys/resource.h])
-AC_CHECK_HEADERS([sys/time.h sys/times.h sys/wait.h unistd.h])
-AC_CHECK_HEADERS([sys/select.h sys/types.h stdint.h inttypes.h sched.h malloc.h])
+AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
+AC_CHECK_HEADERS([sys/select.h stdint.h inttypes.h sched.h malloc.h])
AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
-AC_CHECK_HEADERS([sys/uio.h])
-AC_CHECK_HEADERS([linux/magic.h])
-AC_CHECK_HEADERS([sys/prctl.h])
+AC_CHECK_HEADERS([linux/magic.h sys/prctl.h])
+
+# Some versions of MSC lack these
+AC_CHECK_HEADERS([dirent.h sys/time.h unistd.h])
# We don't care about this, but we need to keep including it in
# glibconfig.h for backward compatibility
# We don't care about this, but we need to keep including it in
# glibconfig.h for backward compatibility
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
int main ()
{
ssize_t s = 1;
int main ()
{
ssize_t s = 1;
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
int main ()
{
ssize_t s = 1;
int main ()
{
ssize_t s = 1;
AC_MSG_RESULT($glib_ssize_type)
# Check for some functions
AC_MSG_RESULT($glib_ssize_type)
# Check for some functions
-AC_CHECK_FUNCS(lstat strsignal vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
-AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid getresuid)
+AC_CHECK_FUNCS(lstat strsignal vsnprintf stpcpy strcasecmp strncasecmp poll vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
+AC_CHECK_FUNCS(lchmod lchown fchmod fchown utimes getresuid)
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
-# Check for high-resolution sleep functions
case $host_os in aix*) ac_cv_func_splice=no ;; esac # AIX splice() is something else
AC_CHECK_FUNCS(splice)
AC_CHECK_FUNCS(prlimit)
case $host_os in aix*) ac_cv_func_splice=no ;; esac # AIX splice() is something else
AC_CHECK_FUNCS(splice)
AC_CHECK_FUNCS(prlimit)
AC_CHECK_FUNCS(newlocale uselocale strtod_l strtoll_l strtoull_l)
AC_CHECK_FUNCS(newlocale uselocale strtod_l strtoll_l strtoull_l)
-AC_FUNC_VSNPRINTF_C99
-AC_FUNC_PRINTF_UNIX98
-
# Internet address families
if test $glib_native_win32 = yes; then
glib_inet_includes=["
# Internet address families
if test $glib_native_win32 = yes; then
glib_inet_includes=["
#
# Check whether to use an included printf
#
#
# Check whether to use an included printf
#
+AC_FUNC_VSNPRINTF_C99
+AC_FUNC_PRINTF_UNIX98
AC_ARG_ENABLE(included-printf,
[AS_HELP_STRING([--enable-included-printf],
AC_ARG_ENABLE(included-printf,
[AS_HELP_STRING([--enable-included-printf],
# to always be linked with the thread libs on some platforms.
# LIBS="$LIBS $G_THREAD_LIBS"
AC_CHECK_FUNCS(localtime_r gmtime_r)
# to always be linked with the thread libs on some platforms.
# LIBS="$LIBS $G_THREAD_LIBS"
AC_CHECK_FUNCS(localtime_r gmtime_r)
-AS_IF([ test "$ac_cv_header_pwd_h" = "yes"], [
+AS_IF([ test "$glib_native_win32" != "yes"], [
AC_CACHE_CHECK([for posix getpwuid_r],
ac_cv_func_posix_getpwuid_r,
[AC_TRY_RUN([
AC_CACHE_CHECK([for posix getpwuid_r],
ac_cv_func_posix_getpwuid_r,
[AC_TRY_RUN([
-AS_IF([ test "$ac_cv_header_grp_h" = "yes"], [
+AS_IF([ test "$glib_native_win32" != "yes"], [
AC_CACHE_CHECK([for posix getgrgid_r],
ac_cv_func_posix_getgrgid_r,
[AC_TRY_RUN([
AC_CACHE_CHECK([for posix getgrgid_r],
ac_cv_func_posix_getgrgid_r,
[AC_TRY_RUN([
#include <string.h>
#include <sys/types.h>
#include <string.h>
#include <sys/types.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
#include "gfile.h"
#include "glib/gstdio.h"
#include "gfile.h"
#include "glib/gstdio.h"
G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE |
G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED);
G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE |
G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED);
g_file_attribute_info_list_add (list,
G_FILE_ATTRIBUTE_UNIX_UID,
G_FILE_ATTRIBUTE_TYPE_UINT32,
g_file_attribute_info_list_add (list,
G_FILE_ATTRIBUTE_UNIX_UID,
G_FILE_ATTRIBUTE_TYPE_UINT32,
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#endif
#include <fcntl.h>
#include <errno.h>
#endif
#include <fcntl.h>
#include <errno.h>
-#endif
-#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_SELINUX
#include <pwd.h>
#endif
#ifdef HAVE_SELINUX
static gboolean
set_unix_uid_gid (char *filename,
const GFileAttributeValue *uid_value,
static gboolean
set_unix_uid_gid (char *filename,
const GFileAttributeValue *uid_value,
if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) == 0)
return set_unix_mode (filename, flags, &value, error);
if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) == 0)
return set_unix_mode (filename, flags, &value, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_UID) == 0)
return set_unix_uid_gid (filename, &value, NULL, flags, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_GID) == 0)
else if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_UID) == 0)
return set_unix_uid_gid (filename, &value, NULL, flags, error);
else if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_GID) == 0)
GError **error)
{
GFileAttributeValue *value;
GError **error)
{
GFileAttributeValue *value;
GFileAttributeValue *uid, *gid;
GFileAttributeValue *uid, *gid;
#ifdef HAVE_UTIMES
GFileAttributeValue *mtime, *mtime_usec, *atime, *atime_usec;
#endif
#ifdef HAVE_UTIMES
GFileAttributeValue *mtime, *mtime_usec, *atime, *atime_usec;
#endif
-#if defined (HAVE_CHOWN) || defined (HAVE_UTIMES)
GFileAttributeStatus status;
#endif
gboolean res;
GFileAttributeStatus status;
#endif
gboolean res;
/* Group uid and gid setting into one call
* Change ownership before permissions, since ownership changes can
change permissions (e.g. setuid)
/* Group uid and gid setting into one call
* Change ownership before permissions, since ownership changes can
change permissions (e.g. setuid)
#include <gio/gfileinfo.h>
#include <gio/gfile.h>
#include <sys/stat.h>
#include <gio/gfileinfo.h>
#include <gio/gfile.h>
#include <sys/stat.h>
if (g_cancellable_set_error_if_cancelled (cancellable, error))
goto err_out;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
goto err_out;
/* create original -> backup link, the original is then renamed over */
if (g_unlink (file->priv->backup_filename) != 0 &&
errno != ENOENT)
/* create original -> backup link, the original is then renamed over */
if (g_unlink (file->priv->backup_filename) != 0 &&
errno != ENOENT)
#include "gvfs.h"
#include <gio/gdummyfile.h>
#include <sys/types.h>
#include "gvfs.h"
#include <gio/gdummyfile.h>
#include <sys/types.h>
#include <pwd.h>
#endif
#include <string.h>
#include <pwd.h>
#endif
#include <string.h>
user_prefix = g_strdup (g_get_home_dir ());
else
{
user_prefix = g_strdup (g_get_home_dir ());
else
{
struct passwd *passwd_file_entry;
char *user_name;
struct passwd *passwd_file_entry;
char *user_name;
# include <sys/filio.h>
#endif
# include <sys/filio.h>
#endif
#include <sys/uio.h>
#endif
#include <sys/uio.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef HAVE_SYS_TIMES_H
-#include <sys/times.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#ifdef G_OS_UNIX
+#include <unistd.h>
+#include <sys/wait.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
-#include <string.h> /* for bzero on BSD systems */
#ifdef G_OS_WIN32
# define STRICT /* Strict typing, please */
#ifdef G_OS_WIN32
# define STRICT /* Strict typing, please */
if (max_len == 0)
max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH;
if (max_len == 0)
max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH;
-#if !defined(HAVE_GETCWD)
- buffer = g_new (gchar, max_len + 1);
- *buffer = 0;
- dir = getwd (buffer);
-#else
while (max_len < G_MAXULONG / 2)
{
g_free (buffer);
while (max_len < G_MAXULONG / 2)
{
g_free (buffer);
-#endif /* !sun || !HAVE_GETCWD */
#include <errno.h>
#include <pthread.h>
#include <errno.h>
#include <pthread.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <sys/time.h>
+#include <unistd.h>
+
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#endif
#include <sys/types.h>
#include <pwd.h>
#endif
#include <sys/types.h>
{
static UserDatabaseEntry e;
{
static UserDatabaseEntry e;
{
struct passwd *pw = NULL;
gpointer buffer = NULL;
{
struct passwd *pw = NULL;
gpointer buffer = NULL;
}
#endif /* G_OS_WIN32 */
}
#endif /* G_OS_WIN32 */
-#endif /* !HAVE_PWD_H */
-
if (!e.user_name)
e.user_name = g_strdup ("somebody");
if (!e.real_name)
if (!e.user_name)
e.user_name = g_strdup ("somebody");
if (!e.real_name)