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
12 /*******************************************************************\
14 * Information Technology Center *
15 * Carnegie-Mellon University *
17 \*******************************************************************/
18 #include <afs/param.h>
20 #ifdef AFS_LINUX20_ENV
29 #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV)
30 int PRE_Block = 0; /* used in lwp.c and process.s */
32 char PRE_Block = 0; /* used in lwp.c and process.s */
35 static void AlarmHandler(sig, st, scp)
40 if (PRE_Block == 0 && lwp_cpptr->level == 0)
43 sigprocmask(SIG_SETMASK, &scp->uc_sigmask, NULL);
44 LWP_DispatchProcess();
50 int PRE_InitPreempt(slice)
51 struct timeval *slice;
54 struct sigaction action;
56 if (lwp_cpptr == 0) return (LWP_EINIT);
60 itv.it_interval.tv_sec = itv.it_value.tv_sec = DEFAULTSLICE;
61 itv.it_interval.tv_usec = itv.it_value.tv_usec = 0;
65 itv.it_interval = itv.it_value = *slice;
68 bzero((char *)&action, sizeof(action));
69 action.sa_sigaction = AlarmHandler;
70 action.sa_flags = SA_SIGINFO;
72 if ((sigaction(SIGALRM, &action, (struct sigaction *)0) == -1) ||
73 (setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1))
82 struct sigaction action;
84 if (lwp_cpptr == 0) return (LWP_EINIT);
86 itv.it_value.tv_sec = itv.it_value.tv_usec = 0;
88 bzero((char *)&action, sizeof(action));
89 action.sa_handler = SIG_DFL;
91 if ((setitimer(ITIMER_REAL, &itv, (struct itimerval *) 0) == -1) ||
92 (sigaction(SIGALRM, &action, (struct sigaction *)0) == -1))
98 #endif /* AFS_LINUX20_ENV */