6 ****************************************************************************
7 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
9 * Permission to use, copy, modify, and distribute this software and its *
10 * documentation for any purpose and without fee is hereby granted, *
11 * provided that the above copyright notice appear in all copies and *
12 * that both that copyright notice and this permission notice appear in *
13 * supporting documentation, and that the name of IBM not be used in *
14 * advertising or publicity pertaining to distribution of the software *
15 * without specific, written prior permission. *
17 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
19 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
20 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
21 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
22 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
23 ****************************************************************************
26 /*******************************************************************\
28 * Information Technology Center *
29 * Carnegie-Mellon University *
31 \*******************************************************************/
32 #include <afs/param.h>
34 #ifdef AFS_LINUX20_ENV
44 int PRE_Block = 0; /* used in lwp.c and process.s */
46 char PRE_Block = 0; /* used in lwp.c and process.s */
49 static void AlarmHandler(sig, st, scp)
54 if (PRE_Block == 0 && lwp_cpptr->level == 0)
57 sigprocmask(SIG_SETMASK, &scp->uc_sigmask, NULL);
58 LWP_DispatchProcess();
64 int PRE_InitPreempt(slice)
65 struct timeval *slice;
68 struct sigaction action;
70 if (lwp_cpptr == 0) return (LWP_EINIT);
74 itv.it_interval.tv_sec = itv.it_value.tv_sec = DEFAULTSLICE;
75 itv.it_interval.tv_usec = itv.it_value.tv_usec = 0;
79 itv.it_interval = itv.it_value = *slice;
82 bzero((char *)&action, sizeof(action));
83 action.sa_sigaction = AlarmHandler;
84 action.sa_flags = SA_SIGINFO;
86 if ((sigaction(SIGALRM, &action, (struct sigaction *)0) == -1) ||
87 (setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1))
96 struct sigaction action;
98 if (lwp_cpptr == 0) return (LWP_EINIT);
100 itv.it_value.tv_sec = itv.it_value.tv_usec = 0;
102 bzero((char *)&action, sizeof(action));
103 action.sa_handler = SIG_DFL;
105 if ((setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1) ||
106 (sigaction(SIGALRM, &action, (struct sigaction *)0) == -1))
112 #endif /* AFS_I386_LINUX20_ENV */