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/pxfsigsuspend.c 92.1 06/29/99 11:36:06" 00038 00039 00040 /* 00041 * PXFSIGSIGSUSPEND -- Wait for a signal. 00042 * (section 3.3.7 of Posix 1003.9-1992) 00043 * 00044 * Synopsis: 00045 * 00046 * SUBROUTINE PXFSIGSUSPEND(jsigset, ierror) 00047 * INTEGER jsigset, ierror 00048 * 00049 * Where: 00050 * 00051 * jsigset - default integer input variable containing a 00052 * handle created by PXFSTRUCTCREATE('sigset',...) 00053 * ierror - default integer output variable containing 00054 * status: 00055 * 00056 * zero - PXFSIGSUSPEND was successful. 00057 * 00058 * nonzero - PXFSIGSUSPEND was not successful. 00059 * 00060 * PXFSIGSUSPEND returns the following error: 00061 * 00062 * EINTR - Signal is caught by the calling process and 00063 * control is returned from the signal-catching 00064 * function. 00065 * 00066 * EBADHANDLE - The jsigset argument is invalid. 00067 * 00068 * DESCRIPTION: 00069 * 00070 * Subroutine procedure PXFSIGSUSPEND calls the sigsuspend() 00071 * function to replace the signal mask of the process with the 00072 * jsigset set of signals and to suspend the process indefinitely. 00073 * PXFSIGSUSPEND always returns an error if control is returned. 00074 * 00075 */ 00076 00077 #include <errno.h> 00078 #include <fortran.h> 00079 #include <liberrno.h> 00080 #include <string.h> 00081 #include <sys/signal.h> 00082 #include "pxfstruct.h" 00083 #include "pxfstructtable.h" 00084 #include "table.h" 00085 00086 #ifndef _UNICOS 00087 #include <stddef.h> 00088 #endif 00089 00090 #ifdef _UNICOS 00091 void 00092 PXFSIGSUSPEND( 00093 #else /* _UNICOS */ 00094 void 00095 _PXFSIGSUSPEND( 00096 #endif /* _UNICOS */ 00097 _f_int *jsigset, 00098 _f_int *ierror 00099 ) 00100 { 00101 int stat; 00102 sigset_t mask; 00103 struct pxfhandle pxfhand; 00104 *ierror = 0; 00105 pxfhand = _pxfhandle_table_lookup(&_pxfhandle_table, *jsigset); 00106 if (pxfhand.pxfstructptr == NULL || pxfhand.pxftype != PXF_SIGSET) { 00107 *ierror = EBADHANDLE; 00108 return; 00109 } 00110 mask = ((struct sig_set *)(pxfhand.pxfstructptr))->samask; 00111 if ((stat = (_f_int) sigsuspend(&mask)) == -1) { 00112 *ierror = errno; 00113 } 00114 return; 00115 } 00116 00117 #ifndef _UNICOS 00118 void 00119 pxfsigsuspend_( 00120 _f_int *jsigset, 00121 _f_int *ierror 00122 ) 00123 { 00124 _PXFSIGSUSPEND(jsigset, ierror); 00125 } 00126 #endif /* not _UNICOS */
1.5.6