2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 /*******************************************************************\
12 * Information Technology Center *
13 * Carnegie-Mellon University *
15 \*******************************************************************/
16 #include <afsconfig.h>
17 #include <afs/param.h>
25 #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DJGPP_ENV)
29 int PRE_InitPreempt(slice)
30 struct timeval *slice;
45 #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV)
46 int PRE_Block = 0; /* used in lwp.c and process.s */
48 char PRE_Block = 0; /* used in lwp.c and process.s */
51 static void AlarmHandler(sig, st, scp)
56 if (PRE_Block == 0 && lwp_cpptr->level == 0)
59 sigprocmask(SIG_SETMASK, &scp->uc_sigmask, NULL);
60 LWP_DispatchProcess();
66 int PRE_InitPreempt(slice)
67 struct timeval *slice;
70 struct sigaction action;
72 if (lwp_cpptr == 0) return (LWP_EINIT);
76 itv.it_interval.tv_sec = itv.it_value.tv_sec = DEFAULTSLICE;
77 itv.it_interval.tv_usec = itv.it_value.tv_usec = 0;
81 itv.it_interval = itv.it_value = *slice;
84 memset((char *)&action, 0, sizeof(action));
85 action.sa_sigaction = AlarmHandler;
86 action.sa_flags = SA_SIGINFO;
88 if ((sigaction(SIGALRM, &action, NULL) == -1) ||
89 (setitimer(ITIMER_REAL, &itv, NULL) == -1))
98 struct sigaction action;
100 if (lwp_cpptr == 0) return (LWP_EINIT);
102 itv.it_value.tv_sec = itv.it_value.tv_usec = 0;
104 memset((char *)&action, 0, sizeof(action));
105 action.sa_handler = SIG_DFL;
107 if ((setitimer(ITIMER_REAL, &itv, NULL) == -1) ||
108 (sigaction(SIGALRM, &action, NULL) == -1))
114 #endif /* AFS_LINUX20_ENV */