Commit 1ed4984a authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

check for sched_yield in the standard lib and then in -lrt, and don't use

Mon Jul 28 10:36:52 2003  George Lebl <jirka@5z.com>

	* confiugure.in, acconfig.h, daemon/slave.c, daemon/gdm.c:  check
	  for sched_yield in the standard lib and then in -lrt, and don't
	  use it if we can't find it.  Also remove its usage from places
	  where we're going to yield the processor very soon anyway.
parent 3c93a08c
Mon Jul 28 10:36:52 2003 George Lebl <jirka@5z.com>
* confiugure.in, acconfig.h, daemon/slave.c, daemon/gdm.c: check
for sched_yield in the standard lib and then in -lrt, and don't
use it if we can't find it. Also remove its usage from places
where we're going to yield the processor very soon anyway.
Mon Jul 28 09:19:38 2003 George Lebl <jirka@5z.com>
* configure.in: Fix #118404, we don't need TCP Wrappers if compiling
......
......@@ -36,3 +36,4 @@
#undef GETTEXT_PACKAGE
#undef HAVE_LOGINCAP
#undef HAVE_SYS_SOCKIO_H
#undef HAVE_SCHED_YIELD
......@@ -171,12 +171,20 @@ AM_GLIB_GNU_GETTEXT
EXTRA_DAEMON_LIBS=""
EXTRA_CHOOSER_LIBS=""
AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket, [
AC_CHECK_FUNC(socket,,[
AC_CHECK_LIB(socket,socket, [
EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lsocket"
EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lsocket"])])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname, [
AC_CHECK_FUNC(gethostbyname,,[
AC_CHECK_LIB(nsl,gethostbyname, [
EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lnsl"
EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lnsl"])])
AC_CHECK_FUNC(sched_yield,[
AC_DEFINE(HAVE_SCHED_YIELD)],[
AC_CHECK_LIB(rt,sched_yield, [
AC_DEFINE(HAVE_SCHED_YIELD)
EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lrt"], [
echo "No sched_yield found"])])
dnl ## gdmopen building
dnl There are perhaps others where this works
......
......@@ -22,7 +22,7 @@
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef _POSIX_PRIORITY_SCHEDULING
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
#include <sched.h>
#endif
#include <sys/types.h>
......@@ -1978,7 +1978,7 @@ send_slave_ack (GdmDisplay *d, const char *resp)
kill (d->slavepid, SIGUSR2);
/* now yield the CPU as the other process has more
useful work to do then we do */
#ifdef _POSIX_PRIORITY_SCHEDULING
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
sched_yield ();
#endif
}
......@@ -2000,7 +2000,7 @@ send_slave_command (GdmDisplay *d, const char *command)
kill (d->slavepid, SIGUSR2);
/* now yield the CPU as the other process has more
useful work to do then we do */
#ifdef _POSIX_PRIORITY_SCHEDULING
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
sched_yield ();
#endif
}
......
......@@ -26,7 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef _POSIX_PRIORITY_SCHEDULING
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
#include <sched.h>
#endif
#ifdef HAVE_LOGINCAP
......@@ -986,9 +986,6 @@ gdm_slave_run (GdmDisplay *display)
if (d->dsp == NULL) {
gdm_debug ("gdm_slave_run: Sleeping %d on a retry", 1+openretries*2);
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield ();
#endif
sleep (1+openretries*2);
openretries++;
}
......@@ -1048,9 +1045,6 @@ gdm_slave_run (GdmDisplay *display)
* which will in fact just exit, so
* this code is a little bit too anal */
while (d->servpid > 0) {
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield ();
#endif
pause ();
}
gdm_slave_quick_exit (DISPLAY_REMANAGE);
......@@ -1378,10 +1372,6 @@ run_config (GdmDisplay *display, struct passwd *pwent)
configurator = TRUE;
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield ();
#endif
gdm_sigchld_block_push ();
wp = slave_waitpid_setpid (display->sesspid);
gdm_sigchld_block_pop ();
......@@ -2335,7 +2325,7 @@ gdm_slave_send (const char *str, gboolean wait_for_ack)
if (fd != slave_fifo_pipe_fd)
close (fd);
#ifdef _POSIX_PRIORITY_SCHEDULING
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
if (wait_for_ack && ! gdm_got_ack) {
/* let the other process do its stuff */
sched_yield ();
......@@ -2348,11 +2338,6 @@ gdm_slave_send (const char *str, gboolean wait_for_ack)
parent_exists () &&
i < 10;
i++) {
#ifdef _POSIX_PRIORITY_SCHEDULING
/* let the other process do its stuff */
sched_yield ();
#endif
if (in_usr2_signal > 0) {
fd_set rfds;
struct timeval tv;
......@@ -2591,10 +2576,6 @@ gdm_slave_chooser (void)
/* wait for the chooser to die */
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield ();
#endif
gdm_sigchld_block_push ();
wp = slave_waitpid_setpid (d->chooserpid);
gdm_sigchld_block_pop ();
......@@ -3360,10 +3341,6 @@ gdm_slave_session_start (void)
gdm_slave_send_num (GDM_SOP_SESSPID, pid);
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield ();
#endif
gdm_sigchld_block_push ();
wp = slave_waitpid_setpid (d->sesspid);
gdm_sigchld_block_pop ();
......@@ -3990,7 +3967,7 @@ gdm_slave_greeter_ctl (char cmd, const char *str)
gdm_fdprintf (greeter_fd_out, "%c%c\n", STX, cmd);
}
#ifdef _POSIX_PRIORITY_SCHEDULING
#if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
/* let the other process (greeter) do its stuff */
sched_yield ();
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment