mescc: Support gcc-3.2: Reset errno.

* lib/linux-gcc.c (_sys_call, _sys_call1, _sys_call2, _sys_call3):
  Reset errno.
* lib/linux-mes.c (__sys_call, __sys_call1, __sys_call2 ,
  __sys_call3): Rename from _*.
   (_sys_call, _sys_call1, _sys_call2, _sys_call3): New function.
  Reset errno.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-07 07:16:43 +02:00
parent cc466662b9
commit d1e3a786aa
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 57 additions and 5 deletions

View file

@ -35,6 +35,8 @@ _sys_call (int sys_call)
);
if (r < 0)
errno = -r;
else
errno = 0
return r;
#endif
}
@ -55,6 +57,8 @@ _sys_call1 (int sys_call, int one)
);
if (r < 0)
errno = -r;
else
errno = 0
return r;
#endif
}
@ -76,6 +80,8 @@ _sys_call2 (int sys_call, int one, int two)
);
if (r < 0)
errno = -r;
else
errno = 0
return r;
#endif
}
@ -98,6 +104,8 @@ _sys_call3 (int sys_call, int one, int two, int three)
);
if (r < 0)
errno = -r;
else
errno = 0
return r;
#endif
}

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* Mes --- Maxwell Equations of Software
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of Mes.
*
@ -21,14 +21,14 @@
#include <errno.h>
int
_sys_call (int sys_call)
__sys_call (int sys_call)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("int____$0x80");
}
int
_sys_call1 (int sys_call, int one)
__sys_call1 (int sys_call, int one)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
@ -36,7 +36,7 @@ _sys_call1 (int sys_call, int one)
}
int
_sys_call2 (int sys_call, int one, int two)
__sys_call2 (int sys_call, int one, int two)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
@ -45,7 +45,7 @@ _sys_call2 (int sys_call, int one, int two)
}
int
_sys_call3 (int sys_call, int one, int two, int three)
__sys_call3 (int sys_call, int one, int two, int three)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
@ -53,3 +53,47 @@ _sys_call3 (int sys_call, int one, int two, int three)
asm ("mov____0x8(%ebp),%edx !20");
asm ("int____$0x80");
}
int
_sys_call (int sys_call)
{
int r = __sys_call (sys_call);
if (r < 0)
errno = -r;
else
errno = 0
return r;
}
int
_sys_call1 (int sys_call, int one)
{
int r = __sys_call1 (sys_call, one);
if (r < 0)
errno = -r;
else
errno = 0
return r;
}
int
_sys_call2 (int sys_call, int one, int two)
{
int r = __sys_call2 (sys_call, one, two);
if (r < 0)
errno = -r;
else
errno = 0
return r;
}
int
_sys_call3 (int sys_call, int one, int two, int three)
{
int r = __sys_call3 (sys_call, one, two, three);
if (r < 0)
errno = -r;
else
errno = 0
return r;
}