/* bsdtrap.c - Deal with 2.11BSD trap instructions.
*
- * $Revision: 1.65 $
- * $Date: 2002/06/10 11:43:24 $
+ * $Revision: 1.66 $
+ * $Date: 2008/05/19 13:26:42 $
*/
#ifdef EMU211
}
case S_READ: /* DONE */
TrapDebug((dbg_file, "%d bytes on %d ",uarg3,sarg1));
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
#ifdef STREAM_BUFFERING
if (ValidFD(sarg1) && stream[sarg1])
i = fread(buf, 1, uarg3, stream[sarg1]);
#endif
i = read(sarg1, buf, uarg3); break;
case S_LINK: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
- buf2 = xlate_filename(&dspace[uarg2]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
+ buf2 = xlate_filename((char *)&dspace[uarg2]);
i = link(buf, buf2); break;
case S_SYMLINK: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
- buf2 = xlate_filename(&dspace[uarg2]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
+ buf2 = xlate_filename((char *)&dspace[uarg2]);
i = symlink(buf, buf2); break;
case S_RENAME: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
- buf2 = xlate_filename(&dspace[uarg2]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
+ buf2 = xlate_filename((char *)&dspace[uarg2]);
i = rename(buf, buf2); break;
case S_READLINK: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
- i = readlink(buf, &dspace[uarg2], sarg3); break;
+ buf = xlate_filename((char *)&dspace[uarg1]);
+ i = readlink(buf, (char *)&dspace[uarg2], sarg3); break;
case S_ACCESS: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = access(buf, sarg2); break;
case S_MKDIR: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = mkdir(buf, sarg2); break;
case S_RMDIR: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = rmdir(buf); break;
case S_ACCT: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = acct(buf); break;
case S_WRITEV: /* DONE */
case S_READV: /* DONE */
free(ivec);
break;
case S_WRITE: /* DONE */
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
TrapDebug((dbg_file, "%d bytes on %d ",uarg3,sarg1));
#ifdef STREAM_BUFFERING
if (ValidFD(sarg1) && stream[sarg1])
case S_FLOCK:
i = flock(sarg1,sarg2); break;
case S_LSTAT: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
tr_stbuf = (struct tr_stat *) &dspace[uarg2];
i = lstat(buf, &stbuf);
TrapDebug((dbg_file, "on %s ",buf));
goto dostat;
case S_STAT: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
tr_stbuf = (struct tr_stat *) &dspace[uarg2];
i = stat(buf, &stbuf);
TrapDebug((dbg_file, "on %s ",buf));
}
break;
case S_UTIMES: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
tr_del = (struct tr_timeval *) &dspace[uarg2];
tr_oldel = (struct tr_timeval *) &dspace[uarg4];
i= utimes(buf, utv);
copylong(tr_oltval->it_value.tv_usec, oltval.it_value.tv_usec);
break;
case S_UNLINK: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = unlink(buf); break;
case S_OPEN: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = stat(buf, &stbuf); /* If file is a directory */
if (i == 0 && (stbuf.st_mode & S_IFDIR)) {
#endif
break;
case S_MKNOD: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = mknod(buf, sarg2, sarg3); break;
case S_CHMOD: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chmod(buf, sarg2); break;
case S_FCHMOD: /* DONE */
i = fchmod(sarg1, sarg2); break;
case S_TRUNCATE: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
larg1 = (sarg2 << 16) | uarg3;
i = truncate(buf, larg1); break;
case S_FTRUNCATE: /* DONE */
case S_KILLPG: /* DONE */
i = killpg(sarg1, sarg2); break;
case S_CHOWN: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chown(buf, sarg2, sarg3); break;
case S_PIPE: /* DONE */
i = pipe(pfd);
if (i == -1) break;
i = pfd[0]; regs[1] = pfd[1]; break;
case S_CHROOT: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
if (buf == NULL) {
errno=ENOENT; i=-1; break;
}
set_apout_root(buf);
i=0; break;
case S_CHDIR: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chdir(buf); break;
case S_FCHDIR: /* DONE */
i = fchdir(sarg1); break;
#ifndef NO_CHFLAGS
case S_CHFLAGS: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chflags(buf,uarg2); break;
case S_FCHFLAGS: /* DONE */
i = fchflags(sarg1,uarg2); break;
#endif
case S_CREAT: /* DONE */
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = creat(buf, sarg2);
#ifdef STREAM_BUFFERING
if (ValidFD(i)) {
*shortptr= pfd[1];
break;
case S_RECV: /* DONE */
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
i = recv(sarg1, buf, sarg3, sarg4); break;
case S_SEND: /* DONE */
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
i = send(sarg1, buf, sarg3, sarg4); break;
case S_ACCEPT: /* DONE */
tr_sock= (struct tr_sockaddr *)&dspace[uarg2];
sock.sa_len=len;
#endif
memcpy(sock.sa_data, tr_sock->sa_data, len);
- i= accept(sarg1, &sock, &len);
+ i= accept(sarg1, &sock, (socklen_t *)&len);
if (i != -1) {
sl_word(uarg3,len);
memcpy(tr_sock->sa_data, sock.sa_data, len);
sock.sa_len=len;
#endif
memcpy(sock.sa_data, tr_sock->sa_data, len);
- i= getpeername(sarg1, &sock, &len);
+ i= getpeername(sarg1, &sock, (socklen_t *)&len);
if (i != -1) {
sl_word(uarg3,len);
memcpy(tr_sock->sa_data, sock.sa_data, len);
sock.sa_len=len;
#endif
memcpy(sock.sa_data, tr_sock->sa_data, len);
- i= getsockname(sarg1, &sock, &len);
+ i= getsockname(sarg1, &sock, (socklen_t *)&len);
if (i != -1) {
sl_word(uarg3,len);
memcpy(tr_sock->sa_data, sock.sa_data, len);
sock.sa_len=len;
#endif
memcpy(sock.sa_data, tr_sock->sa_data, len);
- buf = &dspace[uarg2];
- i= recvfrom(sarg1, buf, sarg3, sarg4, &sock, &len);
+ buf = (char *)&dspace[uarg2];
+ i= recvfrom(sarg1, buf, sarg3, sarg4, &sock, (socklen_t *)&len);
if (i != -1) {
sl_word(uarg6,len);
memcpy(tr_sock->sa_data, sock.sa_data, len);
u_int16_t cptr, cptr2;
char *buf, *name, *origpath;
- origpath = strdup(&dspace[uarg1]);
+ origpath = strdup((char *)&dspace[uarg1]);
name = xlate_filename(origpath);
TrapDebug((dbg_file, "%s Execing %s (%s) ", progname, name, origpath));
ll_word(cptr, cptr2);
if (cptr2 == 0)
break;
- buf = &dspace[cptr2];
+ buf = (char *)&dspace[cptr2];
Argv[Argc++] = strdup(buf);
cptr += 2;
TrapDebug((dbg_file, "%s ", buf));
ll_word(cptr, cptr2);
if (cptr2 == 0)
break;
- buf = &dspace[cptr2];
+ buf = (char *)&dspace[cptr2];
Envp[Envc++] = strdup(buf);
cptr += 2;
}
/* v1trap.c - Deal with 1st Edition trap instructions.
*
- * $Revision: 1.15 $
- * $Date: 2002/06/10 11:43:24 $
+ * $Revision: 1.16 $
+ * $Date: 2008/05/19 13:26:42 $
*/
#ifdef EMUV1
#include "defines.h"
#define EPOCH71 31536000 /* # seconds from 1970 to 1971 */
#define EPOCH72 63072000 /* # seconds from 1970 to 1972 */
case V1_SMDATE:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
if (buf[0] == '\0') buf = "."; /* Not documented anywhere */
if (uarg1 == 0) buf = "."; /* Who knows? for V1 */
i = stat(buf, &stbuf);
regs[0] = i;
break;
case V1_READ:
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
#ifdef STREAM_BUFFERING
if (ValidFD(sarg1) && stream[sarg1])
i = fread(buf, 1, sarg3, stream[sarg1]);
TrapDebug((dbg_file, " on fd %d return %d ", sarg1, i));
regs[0] = i; break;
case V1_LINK:
- buf = xlate_filename(&dspace[uarg1]);
- buf2 = xlate_filename(&dspace[uarg2]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
+ buf2 = xlate_filename((char *)&dspace[uarg2]);
i = link(buf, buf2);
regs[0] = i; break;
case V1_WRITE:
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
#ifdef STREAM_BUFFERING
if (ValidFD(sarg1) && stream[sarg1])
i = fwrite(buf, 1, sarg3, stream[sarg1]);
TrapDebug((dbg_file, " on fd %d return %d ", sarg1, i));
break;
case V1_STAT:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
if (buf[0] == '\0') buf = "."; /* Not documented anywhere */
if (uarg1 == 0) buf = "."; /* Who knows? for V1 */
- buf2 = &dspace[uarg2];
+ buf2 = (char *)&dspace[uarg2];
i = stat(buf, &stbuf);
TrapDebug((dbg_file, " on %s return %d ", buf, i));
goto dostat;
case V1_FSTAT:
- buf2 = &dspace[uarg2];
+ buf2 = (char *)&dspace[uarg2];
i = fstat(sarg1, &stbuf);
TrapDebug((dbg_file, " on fd %d return %d ", sarg1, i));
larg = sectosixty(stbuf.st_mtime); copylong(t1->mtime, larg);
break;
case V1_UNLINK:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = unlink(buf);
break;
case V1_OPEN:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = stat(buf, &stbuf); /* If file is a directory */
if (i == 0 && (stbuf.st_mode & S_IFDIR)) {
}
regs[0] = i;
- if (ValidFD(i) && !strncmp(&dspace[uarg1],"/dev/",5)) {
+ if (ValidFD(i) && !strncmp((char *)&dspace[uarg1],"/dev/",5)) {
TrapDebug((dbg_file, " (device file) "));
isdev[i]=1;
}
#endif
break;
case V1_CHMOD:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
mode = 0;
if (uarg2 & V1_ST_SETUID) mode |= S_ISUID;
if (uarg2 & V1_ST_EXEC) mode |= S_IXUSR | S_IXGRP | S_IXOTH;
i = chmod(buf, mode);
break;
case V1_MKDIR:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
mode = 0;
if (uarg2 & V1_ST_SETUID) mode |= S_ISUID;
if (uarg2 & V1_ST_EXEC) mode |= S_IXUSR | S_IXGRP | S_IXOTH;
i = mkdir(buf, mode);
break;
case V1_CHOWN:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
uarg2&= 0x3fff; /* Why are uids > 16384? */
i = chown(buf, uarg2, 0);
TrapDebug((dbg_file, " %d on %s return %d",uarg2,buf,i));
break;
case V1_CHDIR:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chdir(buf);
break;
case V1_CREAT:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
mode = 0;
if (uarg2 & V1_ST_SETUID) mode |= S_ISUID;
if (uarg2 & V1_ST_EXEC) mode |= S_IXUSR | S_IXGRP | S_IXOTH;
u_int16_t cptr, cptr2;
char *buf, *name, *origpath;
- origpath = strdup(&dspace[uarg1]);
+ origpath = strdup((char *)&dspace[uarg1]);
name = xlate_filename(origpath);
TrapDebug((dbg_file, "%s Execing %s ", progname, name));
ll_word(cptr, cptr2);
if (cptr2 == 0)
break;
- buf = &dspace[cptr2];
+ buf = (char *)&dspace[cptr2];
Argv[Argc++] = strdup(buf);
cptr += 2;
TrapDebug((dbg_file, "%s ", buf));
while ((dent = readdir(d)) != NULL) {
v1dent.d_ino = dent->d_fileno & 0x7fff;
if (v1dent.d_ino<41) v1dent.d_ino+=100;
- strncpy(v1dent.d_name, dent->d_name, 8);
+ strncpy((char *)v1dent.d_name, dent->d_name, 8);
write(i, &v1dent, 10);
}
closedir(d);
/* v7trap.c - Deal with V7 trap instructions. V5 and V6 syscalls are also
* done here, because the syscall interface is nearly the same as V7.
*
- * $Revision: 1.48 $
- * $Date: 2008/05/15 07:52:45 $
+ * $Revision: 1.49 $
+ * $Date: 2008/05/19 13:24:35 $
*/
#include "defines.h"
#include <sys/stat.h>
long larg;
char *buf, *buf2;
char *fmode; /* used with fdopen only */
+ time_t tim;
struct stat stbuf; /* used in STAT */
struct tr_v7stat *t; /* used in STAT */
#endif
break;
case S_TIME:
- i = time(&larg);
+ tim= larg;
+ i = time(&tim);
if ((Binary==IS_A68 || Binary==IS_V6) || (Binary==IS_V5)) {
- fixv6time(&larg); /* Fix annoying bug in V5/V6 ctime() */
+ fixv6time(&tim); /* Fix annoying bug in V5/V6 ctime() */
}
- regs[1] = larg & 0xffff;
- i = larg >> 16;
+ regs[1] = tim & 0xffff;
+ i = tim >> 16;
break;
case S_ALARM:
i = alarm(uarg1); break;
i = i >> 16;
break;
case S_READ:
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
#ifdef STREAM_BUFFERING
if (ValidFD(sarg1) && stream[sarg1])
i = fread(buf, 1, uarg3, stream[sarg1]);
TrapDebug((dbg_file, " on fd %d return %d ",sarg1,i));
break;
case S_LINK:
- buf = xlate_filename(&dspace[uarg1]);
- buf2 = xlate_filename(&dspace[uarg2]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
+ buf2 = xlate_filename((char *)&dspace[uarg2]);
if (!strcmp(buf, buf2)) i=0; /* Happens on mkdir(1) */
else i = link(buf, buf2);
break;
case S_ACCESS:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = access(buf, sarg2);
break;
case S_WRITE:
- buf = &dspace[uarg2];
+ buf = (char *)&dspace[uarg2];
#ifdef STREAM_BUFFERING
if (ValidFD(sarg1) && stream[sarg1])
i = fwrite(buf, 1, uarg3, stream[sarg1]);
}
break;
case S_FTIME:
- buf = &dspace[uarg1];
+ buf = (char *)&dspace[uarg1];
tb = (struct tr_timeb *) buf;
i = gettimeofday(&tv, &tz);
if (i == -1) break;
tb->dstflag = tz.tz_dsttime;
break;
case S_STAT:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
if (buf[0]=='\0') buf="."; /* Not documented anywhere */
if (uarg1==0) buf=".";
- buf2 = &dspace[uarg2];
+ buf2 = (char *)&dspace[uarg2];
i = stat(buf, &stbuf);
TrapDebug((dbg_file, " on %s return %d ",buf,i));
goto dostat;
case S_FSTAT:
- buf2 = &dspace[uarg2];
+ buf2 = (char *)&dspace[uarg2];
i = fstat(sarg1, &stbuf);
TrapDebug((dbg_file, " on fd %d return %d ",sarg1,i));
utv[0].tv_usec = utv[1].tv_usec = 0;
copylong(dspace[uarg2], utv[0].tv_sec);
copylong(dspace[uarg2+4], utv[1].tv_sec);
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
#if 0
buf2 = &dspace[uarg2];
buf3 = (char *) &(utv[0].tv_sec);
i = utimes(buf, utv); break;
case S_UNLINK:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = unlink(buf); break;
case S_OPEN:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = stat(buf, &stbuf); /* If file is a directory */
if (i == 0 && (stbuf.st_mode & S_IFDIR)) {
#endif
break;
case S_MKNOD:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
if ((uarg2 & 077000) == 040000) {
/* It's a directory creation */
i = mknod(buf, uarg2, sarg3);
break;
case S_CHMOD:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chmod(buf, uarg2); break;
case S_KILL:
i = kill(sarg1, sarg2); break;
case S_CHOWN:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chown(buf, sarg2, sarg3); break;
case S_PIPE:
i = pipe(pfd);
#endif
i = pfd[0]; regs[1] = pfd[1]; break;
case S_CHROOT:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
if (buf == NULL) { i=-1; errno=ENOENT; break; }
set_apout_root(buf);
i=0; break;
case S_CHDIR:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = chdir(buf); break;
case S_CREAT:
- buf = xlate_filename(&dspace[uarg1]);
+ buf = xlate_filename((char *)&dspace[uarg1]);
i = creat(buf, sarg2);
#ifdef STREAM_BUFFERING
if (i==-1) break;
u_int16_t cptr, cptr2;
char *buf, *name, *origpath;
- origpath = strdup(&dspace[uarg1]);
+ origpath = strdup((char *)&dspace[uarg1]);
name = xlate_filename(origpath);
TrapDebug((dbg_file, "%s Execing %s ", progname, name));
ll_word(cptr, cptr2);
if (cptr2 == 0)
break;
- buf = &dspace[cptr2];
+ buf = (char *)&dspace[cptr2];
Argv[Argc++] = strdup(buf);
cptr += 2;
TrapDebug((dbg_file, "%s ", buf));
ll_word(cptr, cptr2);
if (cptr2 == 0)
break;
- buf = &dspace[cptr2];
+ buf = (char *)&dspace[cptr2];
Envp[Envc++] = strdup(buf);
cptr += 2;
}
while ((dent = readdir(d)) != NULL) {
odent.d_ino = dent->d_fileno;
- strncpy(odent.d_name, dent->d_name, 14);
+ strncpy((char *)odent.d_name, dent->d_name, 14);
write(i, &odent, 16);
}
closedir(d);