2009-12-29 Eric Blake <ebb9@byu.net>
+ tests: test more substitute headers
+ * modules/ctype-tests: New file.
+ * modules/dirent-tests: Likewise.
+ * modules/spawn-tests: Likewise.
+ * modules/sys_file-tests: Likewise.
+ * modules/sys_ioctl-tests: Likewise.
+ * modules/sys_wait-tests: Likewise.
+ * tests/test-ctype.c: Likewise.
+ * tests/test-dirent.c: Likewise.
+ * tests/test-spawn.c: Likewise.
+ * tests/test-sys_file.c: Likewise.
+ * tests/test-sys_ioctl.c: Likewise.
+ * tests/test-sys_wait.c: Likewise.
+ * m4/spawn_h.m4 (gl_SPAWN_H): Replace header if it is missing.
+ * lib/sys_file.in.h (LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB): Provide
+ whether or not flock is in use.
+
tests: remove License section from module
* modules/arpa_inet-tests: Remove unneeded section.
* modules/byteswap-tests: Likewise.
#ifndef _GL_SYS_FILE_H
#define _GL_SYS_FILE_H
+#ifndef LOCK_SH
+/* Operations for the 'flock' call (same as Linux kernel constants). */
+# define LOCK_SH 1 /* Shared lock. */
+# define LOCK_EX 2 /* Exclusive lock. */
+# define LOCK_UN 8 /* Unlock. */
+
+/* Can be OR'd in to one of the above. */
+# define LOCK_NB 4 /* Don't block when locking. */
+#endif
#if @GNULIB_FLOCK@
/* Apply or remove advisory locks on an open file.
Return 0 if successful, otherwise -1 and errno set. */
# if !@HAVE_FLOCK@
extern int flock (int fd, int operation);
-
-/* Operations for the 'flock' call (same as Linux kernel constants). */
-#define LOCK_SH 1 /* Shared lock. */
-#define LOCK_EX 2 /* Exclusive lock. */
-#define LOCK_UN 8 /* Unlock. */
-
-/* Can be OR'd in to one of the above. */
-#define LOCK_NB 4 /* Don't block when locking. */
-
# endif
#elif defined GNULIB_POSIXCHECK
# undef flock
-# spawn_h.m4 serial 2
+# spawn_h.m4 serial 3
dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
HAVE_SPAWN_H=1
else
HAVE_SPAWN_H=0
+ gl_REPLACE_SPAWN_H
fi
AC_SUBST([HAVE_SPAWN_H])
--- /dev/null
+Files:
+tests/test-ctype.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-ctype
+check_PROGRAMS += test-ctype
--- /dev/null
+Files:
+tests/test-dirent.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-dirent
+check_PROGRAMS += test-dirent
--- /dev/null
+Files:
+tests/test-spawn.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-spawn
+check_PROGRAMS += test-spawn
--- /dev/null
+Files:
+tests/test-sys_file.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_file
+check_PROGRAMS += test-sys_file
--- /dev/null
+Files:
+tests/test-sys_ioctl.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_ioctl
+check_PROGRAMS += test-sys_ioctl
--- /dev/null
+Files:
+tests/test-sys_wait.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_wait
+check_PROGRAMS += test-sys_wait
--- /dev/null
+/* Test of <ctype.h> substitute.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009. */
+
+#include <config.h>
+
+#include <ctype.h>
+
+int
+main (void)
+{
+ return 0;
+}
--- /dev/null
+/* Test of <dirent.h> substitute.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009. */
+
+#include <config.h>
+
+#include <dirent.h>
+
+/* Check for existence of required types. */
+static DIR *dir _GL_UNUSED;
+static struct dirent d;
+static ino_t i;
+
+int
+main (void)
+{
+ return d.d_name[0] + i;
+}
--- /dev/null
+/* Test of <spawn.h> substitute.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009. */
+
+#include <config.h>
+
+#include <spawn.h>
+
+/* Check for existence of required types. */
+struct check
+{
+ posix_spawnattr_t a;
+ posix_spawn_file_actions_t b;
+ mode_t c;
+ pid_t d;
+ sigset_t e;
+} s;
+
+/* struct sched_param is allowed to be an incomplete type without
+ <sched.h>, but must have a forward declaration to avoid a
+ compilation error in the following usage. */
+extern void f (struct sched_param *g);
+#include <sched.h>
+extern void f (struct sched_param *g);
+
+int
+main (void)
+{
+ switch (0)
+ {
+ case POSIX_SPAWN_RESETIDS:
+ case POSIX_SPAWN_SETPGROUP:
+ case POSIX_SPAWN_SETSIGDEF:
+ case POSIX_SPAWN_SETSIGMASK:
+ case POSIX_SPAWN_SETSCHEDPARAM:
+ case POSIX_SPAWN_SETSCHEDULER:
+ ;
+ }
+ return s.c + s.d;
+}
--- /dev/null
+/* Test of <sys/file.h> substitute.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009. */
+
+#include <config.h>
+
+#include <sys/file.h>
+
+int
+main (void)
+{
+ switch (0)
+ {
+ case LOCK_SH:
+ case LOCK_EX:
+ case LOCK_NB:
+ case LOCK_UN:
+ ;
+ }
+ return 0;
+}
--- /dev/null
+/* Test of <sys/ioctl.h> substitute.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009. */
+
+#include <config.h>
+
+#include <sys/ioctl.h>
+
+int
+main (void)
+{
+ return 0;
+}
--- /dev/null
+/* Test of <sys/wait.h> substitute.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009. */
+
+#include <config.h>
+
+#include <sys/wait.h>
+
+/* Check for existence of required types. */
+static pid_t a;
+
+int
+main (void)
+{
+ return a;
+}