changed system-calls to avoid namespace pollution

This commit is contained in:
eck 1990-01-22 13:00:13 +00:00
parent a816b64b86
commit 0ab62357ce
4 changed files with 18 additions and 14 deletions

View file

@ -6,13 +6,13 @@
#include <signal.h>
int kill(int pid, int sig);
int getpid(void);
int _kill(int pid, int sig);
int _getpid(void);
int
raise(int sig)
{
if (sig < 0 || sig > _NSIG)
return -1;
return kill(getpid(), sig);
return _kill(_getpid(), sig);
}

View file

@ -7,9 +7,12 @@
#include <signal.h>
#include <stdlib.h>
extern void (*_clean)(void);
void
abort(void)
{
if (_clean) _clean(); /* flush all output files */
raise(SIGABRT);
}

View file

@ -13,8 +13,9 @@ void (*__functab[NEXITS])(void);
int __funccnt = 0;
extern void _exit(int);
/* only fflush when there is output */
int (*_fflush)(FILE *stream) = NULL;
/* only flush output buffers when necessary */
int (*_clean)(void) = NULL;
static void
_calls(void)
@ -30,6 +31,6 @@ void
exit(int status)
{
_calls();
if (_fflush) _fflush((FILE *)NULL) ;
if (_clean) _clean();
_exit(status) ;
}

View file

@ -7,11 +7,11 @@
#include <stdlib.h>
#include <signal.h>
extern int fork(void);
extern int wait(int *);
extern int _fork(void);
extern int _wait(int *);
extern void _exit(int);
extern void execl(char *, ...);
extern void close(int);
extern void _execl(char *, ...);
extern void _close(int);
#define FAIL 127
@ -21,17 +21,17 @@ system(const char *str)
int pid, exitstatus, waitval;
int i;
if ((pid = fork()) < 0) return str ? -1 : 0;
if ((pid = _fork()) < 0) return str ? -1 : 0;
if (pid == 0) {
for (i = 3; i <= 20; i++)
close(i);
_close(i);
if (!str) str = "cd ."; /* just testing for a shell */
execl("/bin/sh", "sh", "-c", str, (char *) NULL);
_execl("/bin/sh", "sh", "-c", str, (char *) NULL);
/* get here if execl fails ... */
_exit(FAIL); /* see manual page */
}
while ((waitval = wait(&exitstatus)) != pid) {
while ((waitval = _wait(&exitstatus)) != pid) {
if (waitval == -1) break;
}
if (waitval == -1) {