Use _ versions of system-calls

This commit is contained in:
ceriel 1991-02-22 16:57:42 +00:00
parent cf10cabb6f
commit 1118da779b
13 changed files with 43 additions and 44 deletions

View file

@ -88,10 +88,8 @@ extern char **_penvp;
extern char *_hol0();
extern _trp();
extern exit();
extern int open();
extern int read();
extern int write();
extern _exit();
extern int _write();
_catch(erno) unsigned erno; {
register struct errm *ep = &errors[0];
@ -146,10 +144,10 @@ _catch(erno) unsigned erno; {
p = q;
while (*p)
p++;
if (write(2,q,p-q) < 0)
if (_write(2,q,p-q) < 0)
;
}
exit(erno);
_exit(erno);
error:
_trp(erno);
}

View file

@ -20,7 +20,7 @@
/* function clock:integer; extern; */
extern int times();
extern int _times();
struct tbuf {
long utime;
@ -36,7 +36,7 @@ struct tbuf {
int clock() {
struct tbuf t;
times(&t);
_times(&t);
return( (int)(t.utime + t.stime) &
#if EM_WSIZE <= 2
077777

View file

@ -25,7 +25,7 @@ extern struct file *_curfil;
extern _trp();
extern _flush();
extern _outcpt();
extern int close();
extern int _close();
_xcls(f) struct file *f; {
@ -61,7 +61,7 @@ _cls(f) struct file *f; {
return;
#endif
_xcls(f);
if (close(f->ufd) != 0)
if (_close(f->ufd) != 0)
_trp(ECLOSE);
f->flags = 0;
}

View file

@ -23,7 +23,7 @@
extern struct file **_extfl;
extern int _extflc;
extern _cls();
extern exit();
extern _exit();
_hlt(ecode) int ecode; {
int i;
@ -31,5 +31,5 @@ _hlt(ecode) int ecode; {
for (i = 0; i < _extflc; i++)
if (_extfl[i] != (struct file *) 0)
_cls(_extfl[i]);
exit(ecode);
_exit(ecode);
}

View file

@ -25,7 +25,7 @@
extern int errno;
extern _trp();
extern int read();
extern int _read();
_incpt(f) struct file *f; {
@ -40,7 +40,7 @@ _incpt(f) struct file *f; {
if (f->count == 0) {
f->ptr = f->bufadr;
for(;;) {
f->count=read(f->ufd,f->bufadr,f->buflen);
f->count=_read(f->ufd,f->bufadr,f->buflen);
if ( f->count<0 ) {
if (errno != EINTR) _trp(EREAD) ;
continue ;

View file

@ -24,7 +24,7 @@
extern (*_sig())();
extern _catch();
#ifndef CPM
extern int gtty();
extern int _gtty();
#endif
struct file **_extfl;
@ -34,6 +34,7 @@ struct file *_curfil; /* points to file struct in case of errors */
int _pargc;
char **_pargv;
char **_penvp;
int _fp_hook = 1; /* This is for Minix, but does not harm others */
_ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
struct file *f;
@ -65,7 +66,7 @@ _ini(args,c,p,mainlb) char *args,*mainlb; int c; struct file **p; {
#ifdef CPM
f->count = 1;
#else
f->count = (gtty(1,buf) >= 0 ? 1 : PC_BUFLEN);
f->count = (_gtty(1,buf) >= 0 ? 1 : PC_BUFLEN);
#endif
f->buflen = f->count;
}

View file

@ -31,32 +31,32 @@ extern char **_penvp;
extern _cls();
extern _xcls();
extern _trp();
extern int getpid();
extern int creat();
extern int open();
extern int close();
extern int unlink();
extern long lseek();
extern int _getpid();
extern int _creat();
extern int _open();
extern int _close();
extern int _unlink();
extern long _lseek();
static int tmpfil() {
int i; char *p,*q;
i = getpid();
i = _getpid();
p = "/usr/tmp/plf.xxxxx";
q = p + 13;
do
*q++ = (i & 07) + '0';
while (i >>= 3);
*q = '\0';
if ((i = creat(p,0644)) < 0)
if ((i = creat(p += 4,0644)) < 0)
if ((i = creat(p += 5,0644)) < 0)
if ((i = _creat(p,0644)) < 0)
if ((i = _creat(p += 4,0644)) < 0)
if ((i = _creat(p += 5,0644)) < 0)
goto error;
if (close(i) != 0)
if (_close(i) != 0)
goto error;
if ((i = open(p,2)) < 0)
if ((i = _open(p,2)) < 0)
goto error;
if (unlink(p) != 0)
if (_unlink(p) != 0)
error: _trp(EREWR);
return(i);
}
@ -76,7 +76,7 @@ static int initfl(descr,sz,f) int descr; int sz; struct file *f; {
f->fname = "LOCAL";
if ((descr & WRBIT) == 0 && (f->flags & 0377) == MAGIC) {
_xcls(f);
if (lseek(f->ufd,(long)0,0) == -1)
if (_lseek(f->ufd,(long)0,0) == -1)
_trp(ERESET);
} else {
_cls(f);
@ -90,10 +90,10 @@ static int initfl(descr,sz,f) int descr; int sz; struct file *f; {
f->fname = _pargv[i];
_cls(f);
if ((descr & WRBIT) == 0) {
if ((f->ufd = open(f->fname,0)) < 0)
if ((f->ufd = _open(f->fname,0)) < 0)
_trp(ERESET);
} else {
if ((f->ufd = creat(f->fname,0644)) < 0)
if ((f->ufd = _creat(f->fname,0644)) < 0)
_trp(EREWR);
}
}

View file

@ -25,7 +25,7 @@
extern int errno;
extern _trp();
extern int write();
extern int _write();
_flush(f) struct file *f; {
int i,n;
@ -35,7 +35,7 @@ _flush(f) struct file *f; {
if (n <= 0)
return;
f->count = f->buflen;
if ((i = write(f->ufd,f->bufadr,n)) < 0 && errno == EINTR)
if ((i = _write(f->ufd,f->bufadr,n)) < 0 && errno == EINTR)
return;
if (i != n)
_trp(EWRITE);

View file

@ -23,7 +23,7 @@
extern _cls();
extern _trp();
extern int creat();
extern int _creat();
/* procedure pcreat(var f:text; s:string); */
@ -36,6 +36,6 @@ pcreat(f,s) struct file *f; char *s; {
f->size = 1;
f->count = PC_BUFLEN;
f->buflen = PC_BUFLEN;
if ((f->ufd = creat(s,0644)) < 0)
if ((f->ufd = _creat(s,0644)) < 0)
_trp(EREWR);
}

View file

@ -23,7 +23,7 @@
extern _cls();
extern _trp();
extern int open();
extern int _open();
/* procedure popen(var f:text; s:string); */
@ -36,6 +36,6 @@ popen(f,s) struct file *f; char *s; {
f->size = 1;
f->count = 0;
f->buflen = PC_BUFLEN;
if ((f->ufd = open(s,0)) < 0)
if ((f->ufd = _open(s,0)) < 0)
_trp(ERESET);
}

View file

@ -8,7 +8,7 @@
#include <em_abs.h>
extern trp();
extern _trp();
struct array_descr {
int lbound;
@ -21,5 +21,5 @@ struct array_descr *descr;
{
if( index < descr->lbound ||
index > (int) descr->n_elts_min_one + descr->lbound )
_trp(ERANGE);
_trp(EARRAY);
}

View file

@ -18,8 +18,8 @@
/* function uread(fd:integer; var b:buf; n:integer):integer; */
extern int read();
extern int _read();
int uread(fd,b,n) char *b; int fd,n; {
return(read(fd,b,n));
return(_read(fd,b,n));
}

View file

@ -18,8 +18,8 @@
/* function uwrite(fd:integer; var b:buf; n:integer):integer; */
extern int write();
extern int _write();
int uwrite(fd,b,n) char *b; int fd,n; {
return(write(fd,b,n));
return(_write(fd,b,n));
}