/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include "sfhdr.h"
/* Function to handle io exceptions.
** Written by Kiem-Phong Vo
*/
#if __STD_C
#else
Sfio_t* f; /* stream where the exception happened */
int type; /* io type that was performed */
#endif
{
SFMTXDECL(f); /* declare a local stream variable for multithreading */
SFMTXENTER(f,-1);
{ /* let the stream be generally accessible for this duration */
SFOPEN(f,0);
/* so that exception handler knows what we are asking for */
/* relock if necessary */
SFLOCK(f,0);
SFMTXRETURN(f, ev);
if(ev < 0)
SFMTXRETURN(f, SF_EDONE);
if(ev > 0)
SFMTXRETURN(f, SF_EDISC);
}
goto chk_stack;
SFMTXRETURN(f, SF_EDONE);
goto chk_stack;
/* extend buffer */
size = 0;
if(f->size > 0)
if(!data)
goto chk_stack;
}
SFMTXRETURN(f, SF_EDISC);
}
SFMTXRETURN(f, SF_EDONE);
/* a normal interrupt, we can continue */
errno = 0;
SFMTXRETURN(f, SF_ECONT);
}
{ /* pop the stack */
if(lock)
SFOPEN(f,0);
/* pop and close */
if(lock)
SFLOCK(f,0);
}
SFMTXRETURN(f, ev);
}