Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
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 00038 #pragma ident "@(#) libf/fio/fffcntl.c 92.1 06/18/99 16:08:47" 00039 00040 /* 00041 * Provide access to fffcntl call for FORTRAN units 00042 * 00043 * >=0 OK (depends on fffcntl return) 00044 * <0 bad call. (-2 means too few params) 00045 * if *ustat = -1, unit was not open as FDC, or not open. 00046 */ 00047 00048 #include <foreign.h> 00049 #include <errno.h> 00050 #include "fio.h" 00051 00052 long 00053 FFFCNTL(unitnum, cmd, arg, len, ustat) 00054 long *unitnum; 00055 long *len; 00056 long *cmd; 00057 long *arg; 00058 long *ustat; 00059 { 00060 unit *cup; 00061 int ret; 00062 struct ffsw stat; 00063 00064 if (_numargs() < 5) 00065 return(-2); /* too few parameters */ 00066 00067 *ustat = -1; /* assume unit not open...*/ 00068 STMT_BEGIN(*unitnum, 0, T_MISC, NULL, NULL, cup); /* lock unit */ 00069 if (cup == NULL) 00070 return(-1); /* invalid or unconnected unit */ 00071 00072 if (cup->ufs != FS_FDC) { 00073 ret = -1; 00074 goto done; 00075 } 00076 00077 *ustat = 0; 00078 /* 00079 * If command code is zero, just return fdinfo pointer. 00080 */ 00081 if (*cmd == 0) { 00082 *arg = (long)cup->ufp.fdc; 00083 ret = 0; 00084 goto done; 00085 } 00086 00087 ret = XRCALL(cup->ufp.fdc, fcntlrtn) cup->ufp.fdc, *cmd, arg, &stat); 00088 if (ret < 0) 00089 *ustat = stat.sw_error; 00090 00091 done: 00092 STMT_END(cup, T_MISC, NULL, NULL); 00093 return(ret); 00094 }