00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 00037 #pragma ident "@(#) libf/pxf/pxfalarm.c 92.1 06/29/99 11:36:06" 00038 00039 00040 /* 00041 * PXFALARM -- Schedule alarm. 00042 * (section 3.4.1 of Posix 1003.9-1992) 00043 * 00044 * Synopsis: 00045 * 00046 * SUBROUTINE PXFALARM(iseconds, isecleft, ierror) 00047 * INTEGER iseconds, isecleft, ierror 00048 * 00049 * Where: 00050 * 00051 * iseconds - default integer input variable containing 00052 * the number of real-time seconds to wait before 00053 * sending the calling process a SIGALRM signal. 00054 * isecleft - default integer output variable containing 00055 * the number of seconds left until a previous 00056 * request would have generated a SIGALRM signal. 00057 * ierror - default integer output variable containing 00058 * status: 00059 * 00060 * zero - PXFALARM was successful. 00061 * 00062 * DESCRIPTION: 00063 * 00064 * The subroutine procedure PXFALARM uses alarm() system call to 00065 * wait iseconds before generating SIGALRM signal. If a previous 00066 * PXFALARM has time remaining, isecleft contains the number of 00067 * seconds until the SIGALRM would have been generated. 00068 * 00069 * NOTE: 00070 * 00071 * Replace the use of subprocedure ALARM() with the PXFALARM() 00072 * interface in Fortran programs for portability. 00073 * 00074 * On UNICOS and UNICOS/mk systems, alarm() can be a subroutine 00075 * or a function reference. On IRIX systems, alarm() is a 00076 * function reference that calls a procedure after so many 00077 * seconds. 00078 */ 00079 00080 #include <errno.h> 00081 #include <fortran.h> 00082 #include <sys/types.h> 00083 #include <sys/signal.h> 00084 #include <unistd.h> 00085 00086 #ifdef _UNICOS 00087 void 00088 PXFALARM( 00089 #else /* _UNICOS */ 00090 void 00091 _PXFALARM( 00092 #endif /* _UNICOS */ 00093 _f_int *iseconds, 00094 _f_int *isecleft, 00095 _f_int *ierror 00096 ) 00097 { 00098 unsigned int stat; 00099 *ierror = 0; 00100 stat = alarm(*iseconds); 00101 *isecleft = (_f_int) stat; 00102 return; 00103 } 00104 00105 #ifndef _UNICOS 00106 void 00107 pxfalarm_( 00108 _f_int *iseconds, 00109 _f_int *isecleft, 00110 _f_int *ierror 00111 ) 00112 { 00113 _PXFALARM(iseconds, isecleft, ierror); 00114 } 00115 #endif /* not _UNICOS */
1.5.6