msguser.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-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> *
* *
***********************************************************************/
#pragma prototyped
/*
* syscall message user side call and return
*
* NOTE: errno and the st_mode bits are not yet canonical
*/
#include "msglib.h"
#include <cs.h>
static char msg_buf[MSG_SIZE_BUF];
/*
* ap version of msgcall()
* if xp!=0 then it replaces the first MSG_ARG_file or MSG_ARG_string args
* message size is returned
*/
msgvcall(int fd, unsigned long channel, unsigned long call, Msg_return_t* ret, void** xp, va_list ap)
{
register long at;
register long n;
register char* p;
unsigned long rtime;
int i;
int nv;
ssize_t r;
Msg_file_t* ip;
char* b;
char* e;
char** vp;
void** oxp;
int* zp;
long* np;
static struct
{
unsigned long addr;
unsigned long port;
short fd;
} msg_ack;
static unsigned long msg_stamp;
static int msg_write;
if (MSG_CALL(call) == MSG_write && !msg_write && (MSG_PURE(call) == MSG_PURE(MSG_write) || MSG_PURE(call) == (MSG_write|MSG_EXT(MSG_ARG_number, 4))))
{
size_t c;
ssize_t z;
ssize_t t;
off_t o;
/*
* long MSG_write messages may be split up
*/
msg_write = 1;
r = 0;
while (c > 0)
{
z = c > MSG_SIZE_IO ? MSG_SIZE_IO : c;
{
r = -1;
break;
}
c -= z;
b += z;
o += z;
r += t;
}
msg_write = 0;
return r;
}
b = msg_buf + MSG_SIZE_SIZE;
msgputu(&b, e, MSG_VERSION);
{
return -1;
{
return -1;
}
}
nv = 0;
{
case 0:
break;
case MSG_ARG_file:
if (ret)
{
}
msgputu(&b, e, 0);
break;
default:
break;
}
for (;;)
{
{
case MSG_ARG_array:
msgputu(&b, e, n);
while (n-- > 0)
continue;
case MSG_ARG_file:
continue;
case MSG_ARG_input:
msgputz(&b, e, p, n);
at >>= MSG_ARG_TYPE;
continue;
case MSG_ARG_number:
msgputu(&b, e, n);
continue;
case MSG_ARG_output:
{
case MSG_CALL(MSG_getdents):
at >>= MSG_ARG_TYPE;
{
#else
#endif
}
msgputu(&b, e, 0);
msgputu(&b, e, n);
break;
for (i = 0; i < 2; i++)
{
ip++;
}
break;
#else
msgputu(&b, e, 1024);
#endif
#else
#endif
break;
case MSG_CALL(MSG_statfs):
#else
msgputu(&b, e, 0);
#endif
#else
#endif
#endif
break;
default:
msgputz(&b, e, p, n);
break;
}
continue;
case MSG_ARG_string:
else msgputu(&b, e, 0);
continue;
case MSG_ARG_vector:
{
int m;
static char* coexport;
coexport = "";
n = 0;
{
if (nv > 1)
{
char* tx;
char* tp;
tp = p;
{
tp++;
tx++;
}
{
while (*tx)
if (*tx++ == ':')
goto again;
continue;
}
}
msgputz(&b, e, p, m + 1);
}
}
continue;
}
break;
}
n = b - msg_buf;
msgsetsize(msg_buf, n);
{
return -1;
}
r = n;
{
msgsetsize(msg_buf, 0);
{
return -1;
}
}
{
for (;;)
{
{
case -1:
/*FALLTHROUGH*/
case 0:
r = -1;
break;
default:
{
r = -1;
break;
}
{
r = -1;
}
break;
}
break;
}
}
else if (call & MSG_RETURN)
return r;
}
/*
* construct a call and send it to fd
* message size is returned
*/
{
ssize_t n;
return n;
}
/*
* ap version of msgreturn
* if xp!=0 then it replaces the first MSG_ARG_file or MSG_ARG_string args
*/
long
{
register long n;
register unsigned long at;
int i;
long r;
char* b;
char* e;
char* p;
Msg_file_t* ip;
{
return -1;
}
b = msg_buf + MSG_SIZE_SIZE;
e = msg_buf + n;
{
return -1;
}
if ((r = msggetu(&b, e)) == -1)
{
return -1;
}
return r;
for (;;)
{
{
case MSG_ARG_array:
continue;
case MSG_ARG_file:
continue;
case MSG_ARG_input:
continue;
case MSG_ARG_number:
continue;
case MSG_ARG_output:
{
case MSG_CALL(MSG_getdents):
{
n--;
#endif
#endif
msggetu(&b, e);
#endif
#endif
}
break;
for (i = 0; i < 2; i++)
{
ip++;
}
break;
#else
msggetu(&b, e);
#endif
#else
msggetu(&b, e);
#endif
break;
case MSG_CALL(MSG_statfs):
#endif
msggetu(&b, e);
#else
#endif
#endif
break;
default:
if (e - b >= r)
{
memcpy(p, b, r);
b += r;
}
break;
}
continue;
case MSG_ARG_string:
continue;
case MSG_ARG_vector:
continue;
}
break;
}
return r;
}
/*
* read a return from a previous call on fd
*/
long
{
long n;
return n;
}