summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/os/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/os/utils.c')
-rw-r--r--xc/programs/Xserver/os/utils.c175
1 files changed, 20 insertions, 155 deletions
diff --git a/xc/programs/Xserver/os/utils.c b/xc/programs/Xserver/os/utils.c
index 9dde7b6a4..0aa349f83 100644
--- a/xc/programs/Xserver/os/utils.c
+++ b/xc/programs/Xserver/os/utils.c
@@ -45,7 +45,8 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.69 2001/05/04 19:05:52 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.73 2001/08/17 16:58:42 dawes Exp $ */
+
#ifdef __CYGWIN__
#include <stdlib.h>
#include <signal.h>
@@ -59,6 +60,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "X.h"
#include "input.h"
+#include "dixfont.h"
+#include "osdep.h"
#ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
#include <signal.h>
@@ -73,39 +76,20 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#endif
#include <sys/wait.h>
-#if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4)
+#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4)
#include <sys/resource.h>
#endif
#include <time.h>
#include <sys/stat.h>
#include <ctype.h> /* for isspace */
-#if NeedVarargsPrototypes
#include <stdarg.h>
-#endif
#if defined(DGUX)
#include <sys/resource.h>
#include <netdb.h>
#endif
-#ifdef AMOEBA
-#include "osdep.h"
-#include <amoeba.h>
-#include <module/mutex.h>
-
-static mutex print_lock;
-#endif
-
-#if defined(__STDC__) || defined(AMOEBA)
-/* DHD: SVR4.0 has a prototype for abs() in stdlib.h */
-/* DHD: might be better to move this include higher up? */
-#ifdef abs
-#undef abs
-#endif
-#ifndef NOSTDHDRS
#include <stdlib.h> /* for malloc() */
-#endif
-#endif
#if defined(TCPCONN) || defined(STREAMSCONN)
# ifndef WIN32
@@ -119,6 +103,14 @@ static mutex print_lock;
#include "dixstruct.h"
#endif
+#ifdef XKB
+#include "XKBsrv.h"
+#endif
+#ifdef XCSECURITY
+#define _SECURITY_SERVER
+#include "security.h"
+#endif
+
#include <errno.h>
extern int errno;
@@ -155,10 +147,8 @@ extern int SelectWaitTime;
#ifdef MEMBUG
#define MEM_FAIL_SCALE 100000
long Memory_fail = 0;
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h> /* for random() */
#endif
-#endif
#ifdef sgi
int userdefinedfontpath = 0;
@@ -209,10 +199,6 @@ OsSignal(sig, handler)
#include <sys/param.h>
#endif
-#ifdef _MINIX
-#include <limits.h> /* For PATH_MAX */
-#endif
-
#ifdef __EMX__
#define link rename
#endif
@@ -245,7 +231,6 @@ static Bool nolock = FALSE;
void
LockServer()
{
-#ifndef AMOEBA
char tmp[PATH_MAX], pid_str[12];
int lfd, i, haslock, l_pid, t;
char *tmppath = NULL;
@@ -374,7 +359,6 @@ LockServer()
if (!haslock)
FatalError("Could not create server lock file: %s\n", LockFile);
StillLocking = FALSE;
-#endif /* !AMOEBA */
}
/*
@@ -384,7 +368,6 @@ LockServer()
void
UnlockServer()
{
-#ifndef AMOEBA
if (nolock) return;
if (!StillLocking){
@@ -394,8 +377,6 @@ UnlockServer()
#endif /* __EMX__ */
(void) unlink(LockFile);
}
-#endif
-
}
#endif /* SERVER_LOCK */
@@ -415,9 +396,6 @@ AutoResetServer (sig)
#if defined(SYSV) && defined(X_NOT_POSIX)
OsSignal (SIGHUP, AutoResetServer);
#endif
-#ifdef AMOEBA
- WakeUpMainThread();
-#endif
}
/* Force connections to close and then exit on SIGTERM, SIGINT */
@@ -433,9 +411,6 @@ GiveUp(sig)
if (sig)
OsSignal(sig, SIG_IGN);
#endif
-#ifdef AMOEBA
- WakeUpMainThread();
-#endif
}
#if __GNUC__
@@ -448,9 +423,6 @@ AbortServer()
OsCleanup();
AbortDDX();
fflush(stderr);
-#ifdef AMOEBA
- IOPCleanUp();
-#endif
if (CoreDump)
abort();
exit (1);
@@ -460,27 +432,17 @@ void
Error(str)
char *str;
{
-#ifdef AMOEBA
- mu_lock(&print_lock);
-#endif
perror(str);
-#ifdef AMOEBA
- mu_unlock(&print_lock);
-#endif
}
#ifndef DDXTIME
CARD32
GetTimeInMillis()
{
-#ifndef AMOEBA
struct timeval tp;
X_GETTIMEOFDAY(&tp);
return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
-#else
- return sys_milli();
-#endif
}
#endif
@@ -513,11 +475,7 @@ AdjustWaitForDelay (waitTime, newdelay)
void UseMsg()
{
#if !defined(AIXrt) && !defined(AIX386)
-#ifndef AMOEBA
ErrorF("use: X [:<display>] [option]\n");
-#else
- ErrorF("use: X [[<host>]:<display>] [option]\n");
-#endif
ErrorF("-a # mouse acceleration (pixels)\n");
ErrorF("-ac disable access control restrictions\n");
#ifdef MEMBUG
@@ -576,9 +534,6 @@ void UseMsg()
#endif
ErrorF("-su disable any save under support\n");
ErrorF("-t # mouse threshold (pixels)\n");
-#ifdef AMOEBA
- ErrorF("-tcp capability specify TCP/IP server capability\n");
-#endif
ErrorF("-terminate terminate at server reset\n");
ErrorF("-to # connection time out\n");
ErrorF("-tst disable testing extensions\n");
@@ -632,10 +587,6 @@ char *argv[];
{
int i, skip;
-#ifdef AMOEBA
- mu_init(&print_lock);
-#endif
-
defaultKeyboardControl.autoRepeat = TRUE;
#ifdef PART_NET
@@ -660,27 +611,6 @@ char *argv[];
exit(1);
}
}
-#ifdef AMOEBA
- else if (strchr(argv[i], ':') != NULL) {
- char *p;
-
- XServerHostName = argv[i];
- if ((p = strchr(argv[i], ':')) != NULL) {
- *p++ = '\0';
- display = p;
- if( ! VerifyDisplayName( display ) ) {
- ErrorF("Bad display name: %s\n", display);
- UseMsg();
- exit(1);
- }
- }
- } else if (strcmp( argv[i], "-tcp") == 0) {
- if (++i < argc)
- XTcpServerName = argv[i];
- else
- UseMsg();
- }
-#endif /* AMOEBA */
else if ( strcmp( argv[i], "-a") == 0)
{
if(++i < argc)
@@ -1208,9 +1138,6 @@ void *
Xalloc (amount)
unsigned long amount;
{
-#if !defined(__STDC__) && !defined(AMOEBA)
- char *malloc();
-#endif
register pointer ptr;
if ((long)amount <= 0) {
@@ -1240,9 +1167,6 @@ void *
XNFalloc (amount)
unsigned long amount;
{
-#if !defined(__STDC__) && !defined(AMOEBA)
- char *malloc();
-#endif
register pointer ptr;
if ((long)amount <= 0)
@@ -1302,11 +1226,6 @@ Xrealloc (ptr, amount)
register pointer ptr;
unsigned long amount;
{
-#if !defined(__STDC__) && !defined(AMOEBA)
- char *malloc();
- char *realloc();
-#endif
-
#ifdef MEMBUG
if (!Must_have_memory && Memory_fail &&
((random() % MEM_FAIL_SCALE) < Memory_fail))
@@ -1408,13 +1327,9 @@ XNFstrdup(const char *s)
void
AuditPrefix(f)
- char *f;
+ const char *f;
{
-#ifdef X_NOT_STDC_ENV
- long tm;
-#else
time_t tm;
-#endif
char *autime, *s;
if (*f != ' ')
{
@@ -1430,46 +1345,22 @@ AuditPrefix(f)
}
}
-/*VARARGS1*/
void
-AuditF(
-#if NeedVarargsPrototypes
- const char * f, ...)
-#else
- f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
- char *f;
- char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
-#endif
+AuditF(const char * f, ...)
{
-#if NeedVarargsPrototypes
va_list args;
-#endif
AuditPrefix(f);
-#if NeedVarargsPrototypes
va_start(args, f);
VErrorF(f, args);
va_end(args);
-#else
- ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-#endif
}
-/*VARARGS1*/
void
-FatalError(
-#if NeedVarargsPrototypes
- const char *f, ...)
-#else
-f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
- const char *f;
- char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
-#endif
+FatalError(const char *f, ...)
{
-#if NeedVarargsPrototypes
va_list args;
-#endif
static Bool beenhere = FALSE;
if (beenhere)
@@ -1477,13 +1368,9 @@ f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
else
ErrorF("\nFatal server error:\n");
-#if NeedVarargsPrototypes
va_start(args, f);
VErrorF(f, args);
va_end(args);
-#else
- ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-#endif
ErrorF("\n");
#ifdef DDXOSFATALERROR
if (!beenhere)
@@ -1500,7 +1387,6 @@ f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
/*NOTREACHED*/
}
-#if NeedVarargsPrototypes
void
VErrorF(f, args)
const char *f;
@@ -1532,38 +1418,14 @@ VFatalError(const char *msg, va_list args)
AbortServer();
/*NOTREACHED*/
}
-#endif /* NeedVarargsPrototypes */
-/*VARARGS1*/
void
-ErrorF(
-#if NeedVarargsPrototypes
- const char * f, ...)
-#else
- f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */
- char *f;
- char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
-#endif
+ErrorF(const char * f, ...)
{
-#if NeedVarargsPrototypes
va_list args;
va_start(args, f);
VErrorF(f, args);
va_end(args);
-#else
-#ifdef AIXV3
- if (SyncOn)
- sync();
-#else /* not AIXV3 */
-#ifdef AMOEBA
- mu_lock(&print_lock);
-#endif
- fprintf( stderr, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-#ifdef AMOEBA
- mu_unlock(&print_lock);
-#endif
-#endif /* AIXV3 */
-#endif
}
#ifdef SMART_SCHEDULE
@@ -1717,6 +1579,9 @@ OsReleaseSignals (void)
* all privs before running a command.
*
* This is based on the code in FreeBSD 2.2 libc.
+ *
+ * XXX It'd be good to redirect stderr so that it ends up in the log file
+ * as well. As it is now, xkbcomp messages don't end up in the log file.
*/
int