eio.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1994 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "uucp.h"
#ifdef E_PROTOCOL
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#endif /* BSD4_2 || ATTSVR4 */
#define EBUFSIZ 1024
#define EMESGLEN 20
#define TBUFSIZE 1024
#define TPACKSIZE 512
extern long lseek(); /* Find offset into the file. */
extern int erdblk();
extern unsigned msgtime;
static int Erdlen;
/*
* error-free channel protocol
*/
/* ARGSUSED */
static void
int sig;
{
}
static void (*esig)();
/*
* turn on protocol timer
*/
int
eturnon()
{
return(0);
}
int
eturnoff()
{
return(0);
}
/*
* write message across link
* type -> message type
* str -> message body (ascii string)
* fn -> link file descriptor
* return
* FAIL -> write failed
* SUCCESS -> write succeeded
*/
int
register char *str;
int fn;
char type;
{
}
/*
* read message from link
* str -> message buffer
* fn -> file descriptor
* return
* FAIL -> read timed out
* SUCCESS -> ok message in str
*/
int
register char *str;
{
}
/*
* read data from file fp1 and write
* on link
* fp1 -> file descriptor
* fn -> link descriptor
* returns:
* FAIL ->failure in link
* SUCCESS -> ok
*/
int
int fn;
{
register int ret;
int fd1;
int len;
unsigned long bytes;
* case we are restarting from a check
* point.
*/
return(FAIL);
}
bytes = 0L;
if (startPoint < 0)
{
return(FAIL);
}
if (msglen < 0)
{
return(FAIL);
}
alarm(0);
return(FAIL);
alarm(0);
return(FAIL);
break;
}
return(SUCCESS);
}
/*
* read data from link and
* write into file
* fp2 -> file descriptor
* fn -> link descriptor
* returns:
* SUCCESS -> ok
* FAIL -> failure on link
*/
int
{
register int ret;
int fd2;
int len;
if (Erdlen > 0) {
} else {
Erdlen = 0;
}
} else {
}
return(FAIL);
if (Erdlen > 0) {
return(FAIL);
Erdlen = 0;
}
for (;;) {
if (len < 0) {
return(FAIL);
}
return(FAIL);
}
/* this write is to file -- use write(2), not (*Write) */
}
if (msglen == 0)
break;
}
return(ret);
}
/*
* read block from link
* reads are timed
* blk -> address of buffer
* len -> size to read
* fn -> link descriptor
* returns:
* FAIL -> link error timeout on link
* i -> # of bytes read (must not be 0)
*/
int
register char *blk;
{
register int i, ret;
return(FAIL);
}
alarm(0);
return(FAIL);
}
if (ret == 0)
break;
}
alarm(0);
return(i);
}
struct tbuf {
long t_nbytes;
};
/*
* read message from link
* str -> message buffer
* fn -> file descriptor
* return
* FAIL -> read timed out
* SUCCESS -> ok message in str
*/
char *str;
{
}
/*
* write message across link
* type -> message type
* str -> message body (ascii string)
* fn -> link file descriptor
* return
* FAIL -> write failed
* SUCCESS -> write succeeded
*/
char type;
char *str;
{
}
/*
* read data from file fp1 and write on link
* fp1 -> file descriptor
* fn -> link descriptor
* returns:
* FAIL ->failure in link
* SUCCESS -> ok
*/
int fn;
{
register int ret;
int len;
unsigned long bytes;
return(FAIL);
}
bytes = 0L;
len += sizeof(long);
alarm(0);
return(FAIL);
break;
}
alarm(0);
if (ret != sizeof(long))
return FAIL;
return(SUCCESS);
}
/*
* read data from link and write into file
* fp2 -> file descriptor
* fn -> link descriptor
* returns:
* SUCCESS -> ok
* FAIL -> failure on link
*/
{
long Nbytes;
unsigned long bytes = 0L;
for (;;) {
return(FAIL);
if (nread == 0)
break;
return(FAIL);
return(FAIL);
}
return(SUCCESS);
}
/*
* read message from link
* str -> message buffer
* fn -> file descriptor
* i -> if non-zero, amount to read; o.w., read up to '\0'
* return
* FAIL -> read timed out
* SUCCESS -> ok message in str
*
* 'e' is fatally flawed -- in a byte stream world, rdmsg can pick up
* the cmsglen on a R request. if this happens, we stash the excess
* where rddata can pick it up.
*/
register char *str;
register int i;
{
register int len;
int nullterm = 0;
if (i == 0) {
nullterm++;
i = EBUFSIZ;
}
return(FAIL);
}
for (;;) {
if (len == 0)
continue; /* timeout will get this */
if (len < 0) {
alarm(0);
return(FAIL);
}
i -= len;
if (nullterm) {
/* no way can a msg be as long as EBUFSIZ-1 ... */
*str = 0;
null++; /* start of stash */
break;
} else
} else {
if (i == 0)
break;
}
}
alarm(0);
return(SUCCESS);
}
/*
* write message across link
* type -> message type
* str -> message body (ascii string)
* fn -> link file descriptor
* len -> if non-zero, amount to write;
o.w., write up to '\0' (inclusive)
* return
* FAIL -> write failed
* SUCCESS -> write succeeded
*/
char type;
register char *str;
{
int ret;
/* point endstr to last character to be sent */
*endstr = 0;
else
if (len == 0)
else
return(FAIL);
}
alarm(0);
return(FAIL);
return(SUCCESS);
}
#endif /* E_PROTOCOL */