Enable jobserver on W32 when using configure.

Some W32 cleanups: see Savannah bug #34830
Forgot to modify the config.h.W32.template file for jobserver support.
This commit is contained in:
Paul Smith 2011-11-15 21:12:53 +00:00
parent 4f47fbf953
commit dc2a6ceb81
7 changed files with 34 additions and 17 deletions

View file

@ -1,3 +1,14 @@
2011-11-15 Paul Smith <psmith@gnu.org>
* main.c (main): Use %ld when printing DWORD values.
* job.c (new_job): Ditto.
* w32/include/sub_proc.h: Use const.
* w32/subproc/sub_proc.c (open_jobserver_semaphore): Use const.
Fixes Savannah bug #34830. Patches suggested by Ozkan Sezer.
* configure.in (MAKE_JOBSERVER): Enable jobserver on W32 systems.
* config.h.W32.template (MAKE_JOBSERVER): Ditto.
2011-11-14 Paul Smith <psmith@gnu.org>
* read.c (eval): parse_file_seq() might shorten the string due to

View file

@ -332,7 +332,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define MAKE_HOST "Windows32"
/* Define this to enable job server support in GNU make. */
/* #undef MAKE_JOBSERVER */
#define MAKE_JOBSERVER 1
/* Define to 1 if your `struct nlist' has an `n_un' member. Obsolete, depend
on `HAVE_STRUCT_NLIST_N_UN_N_NAME */

View file

@ -301,18 +301,21 @@ if test "$make_cv_sa_restart" != no; then
[Define to 1 if <signal.h> defines the SA_RESTART constant.])
fi
# enable make_cv_sa_restart for OS/2 so that the jobserver will be enabled,
# but do it after HAVE_SA_RESTART has been defined.
case "$host_os" in
os2*) make_cv_sa_restart=yes ;;
# Only allow jobserver on systems that support it
case "/$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/" in
*/no/*) make_cv_job_server=no ;;
esac
case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$make_cv_sa_restart/$has_wait_nohang/$make_cv_job_server" in
yes/yes/yes/yes/yes)
AC_DEFINE(MAKE_JOBSERVER, 1,
[Define to 1 to enable job server support in GNU make.]);;
# Also supported on OS2 and W32
case "$host_os" in
os2*|mingw32) make_cv_sa_restart=yes ;;
esac
if test "$make_cv_job_server" != no; then
AC_DEFINE(MAKE_JOBSERVER, 1,
[Define to 1 to enable job server support in GNU make.])
fi
# if we have both lstat() and readlink() then we can support symlink
# timechecks.
case "$ac_cv_func_lstat/$ac_cv_func_readlink" in

8
job.c
View file

@ -946,7 +946,7 @@ free_child (struct child *child)
if (! release_jobserver_semaphore())
{
DWORD err = GetLastError();
fatal (NILF,_("release jobserver semaphore: (Error %d: %s)"),
fatal (NILF, _("release jobserver semaphore: (Error %ld: %s)"),
err, map_windows32_error_to_string(err));
}
@ -1775,9 +1775,11 @@ new_job (struct file *file)
#endif
while (1)
{
char token;
int got_token;
#ifndef WINDOWS32
char token;
int saved_errno;
#endif
DB (DB_JOBS, ("Need a job token; we %shave children\n",
children ? "" : "don't "));
@ -1842,7 +1844,7 @@ new_job (struct file *file)
if (got_token < 0)
{
DWORD err = GetLastError();
fatal (NILF,_("semaphore or child process wait: (Error %d: %s)"),
fatal (NILF, _("semaphore or child process wait: (Error %ld: %s)"),
err, map_windows32_error_to_string(err));
}
#else

7
main.c
View file

@ -36,6 +36,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# include <io.h>
# include "pathstuff.h"
# include "sub_proc.h"
# include "w32err.h"
#endif
#ifdef __EMX__
# include <sys/types.h>
@ -988,7 +989,7 @@ main (int argc, char **argv, char **envp)
fatal_signal_mask = 0;
#define ADD_SIG(sig) fatal_signal_mask |= sigmask (sig)
#else
#define ADD_SIG(sig) (void)sig /* Needed to avoid warnings in MSVC. */
#define ADD_SIG(sig) (void)sig
#endif
#endif
@ -1728,7 +1729,7 @@ main (int argc, char **argv, char **envp)
if (! open_jobserver_semaphore(cp))
{
DWORD err = GetLastError();
fatal (NILF,_("internal error: unable to open jobserver semaphore `%s': (Error %d: %s)"),
fatal (NILF, _("internal error: unable to open jobserver semaphore `%s': (Error %ld: %s)"),
cp, err, map_windows32_error_to_string(err));
}
DB (DB_JOBS, (_("Jobserver client (semaphore %s)\n"), cp));
@ -1804,7 +1805,7 @@ main (int argc, char **argv, char **envp)
if (! create_jobserver_semaphore(job_slots - 1))
{
DWORD err = GetLastError();
fatal (NILF,_("creating jobserver semaphore: (Error %d: %s)"),
fatal (NILF, _("creating jobserver semaphore: (Error %ld: %s)"),
err, map_windows32_error_to_string(err));
}
#else

View file

@ -58,7 +58,7 @@ EXTERN_DECL(int process_errcnt, (HANDLE proc));
EXTERN_DECL(void process_pipes, (HANDLE proc, int pipes[3]));
/* jobserver routines */
EXTERN_DECL(int open_jobserver_semaphore, (char* name));
EXTERN_DECL(int open_jobserver_semaphore, (const char* name));
EXTERN_DECL(int create_jobserver_semaphore, (int tokens));
EXTERN_DECL(void free_jobserver_semaphore, (VOID_DECL));
EXTERN_DECL(int acquire_jobserver_semaphore, (VOID_DECL));

View file

@ -63,7 +63,7 @@ static char jobserver_semaphore_name[MAX_PATH + 1];
static HANDLE jobserver_semaphore = NULL;
/* Open existing jobserver semaphore */
int open_jobserver_semaphore(char* name)
int open_jobserver_semaphore(const char* name)
{
jobserver_semaphore = OpenSemaphore(
SEMAPHORE_ALL_ACCESS, // Semaphore access setting