Mes C Library: m2/ioctl.c: Remove specialization.

* lib/stub/ioctl.c (ioctl3): Move to...
* lib/stub/ioctl3.c: ...new file.
* lib/m2/ioctl3.c: Move to...
* lib/linux/ioctl3.c: ...here.
* include/mes/lib.h (ioctl3): Declare it.
* lib/m2/isatty.c (isatty): Use it.
* build-aux/configure-lib.sh (libc_SOURCES): Include it; move
lib/linux/ioctl.c to ...
(libc_gnu_SOURCES): ... here.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
* simple.sh (compiler): Likewise.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-12-29 18:41:45 +01:00
parent a4e56aac56
commit fca14d27ad
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
10 changed files with 49 additions and 35 deletions

View file

@ -188,7 +188,7 @@ lib/stub/execve.c
lib/stub/fork.c
lib/stub/_getcwd.c
lib/stub/gettimeofday.c
lib/stub/ioctl.c
lib/stub/ioctl3.c
lib/stub/time.c
lib/stub/unlink.c
lib/stub/waitpid.c
@ -208,7 +208,7 @@ lib/linux/fork.c
lib/linux/fsync.c
lib/linux/_getcwd.c
lib/linux/gettimeofday.c
lib/linux/ioctl.c
lib/linux/ioctl3.c
lib/linux/_open3.c
lib/linux/malloc.c
lib/linux/_read.c
@ -413,6 +413,7 @@ lib/linux/getgid.c
lib/linux/getppid.c
lib/linux/getrusage.c
lib/linux/getuid.c
lib/linux/ioctl.c
lib/linux/link.c
lib/linux/lstat.c
lib/linux/mkdir.c

View file

@ -50,6 +50,7 @@ int fdputc (int c, int fd);
int fdputs (char const *s, int fd);
int fdungetc (int c, int fd);
char *_getcwd (char *buffer, size_t size);
int ioctl3 (int filedes, size_t command, long data);
int isnumber (int c, int base);
int mes_open (char const *file_name, int flags, int mask);
int _open2 (char const *file_name, int flags);

View file

@ -80,7 +80,7 @@ M2-Planet \
-f lib/posix/setenv.c \
-f lib/linux/access.c \
-f lib/m2/chmod.c \
-f lib/m2/ioctl.c \
-f lib/linux/ioctl3.c \
-f lib/m2/isatty.c \
-f lib/linux/fork.c \
-f lib/m2/execve.c \

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -33,10 +33,3 @@ ioctl (int filedes, unsigned long command, ...)
va_end (ap);
return r;
}
int
ioctl3 (int filedes, unsigned long command, long data)
{
int r = _sys_call3 (SYS_ioctl, filedes, command, data);
return r;
}

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,15 +20,12 @@
#include <linux/syscall.h>
#include <syscall.h>
#include <stdarg.h>
#include <sys/ioctl.h>
#include <mes/lib.h>
int
ioctl (int filedes, long command, int data)
ioctl3 (int filedes, size_t command, long data)
{
long long_filedes = filedes;
long long_command = command;
long long_data = data;
int r = _sys_call3 (SYS_ioctl, long_filedes, long_command, long_data);
long long_filedes = cast_int_to_long (filedes);
int r = _sys_call3 (SYS_ioctl, long_filedes, command, data);
return r;
}

View file

@ -46,6 +46,6 @@ isatty (int filedes)
{
if (__isatty_kernel_termios == 0)
__isatty_kernel_termios = malloc (sizeof (struct ktermios));
int r = ioctl (filedes, TCGETS, __isatty_kernel_termios);
int r = ioctl3 (filedes, TCGETS, __isatty_kernel_termios);
return r == 0;
}

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -32,14 +32,3 @@ ioctl (int filedes, unsigned long command, ...)
errno = 0;
return 0;
}
int
ioctl3 (int filedes, unsigned long command, long data)
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("ioctl3 stub\n");
stub = 1;
errno = 0;
return 0;
}

33
lib/stub/ioctl3.c Normal file
View file

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <errno.h>
int
ioctl3 (int filedes, unsigned long command, long data)
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("ioctl3 stub\n");
stub = 1;
errno = 0;
return 0;
}

View file

@ -119,7 +119,7 @@ M2_SOURCES = \
lib/posix/setenv.c \
lib/linux/access.c \
lib/m2/chmod.c \
lib/m2/ioctl.c \
lib/linux/ioctl3.c \
lib/m2/isatty.c \
lib/linux/fork.c \
lib/m2/execve.c \

View file

@ -247,7 +247,7 @@ $CC -g -D HAVE_CONFIG_H=1 -I include -I include/$mes_kernel/$mes_cpu\
lib/linux/fsync.c\
lib/linux/_getcwd.c\
lib/linux/gettimeofday.c\
lib/linux/ioctl.c\
lib/linux/ioctl3.c\
lib/linux/_open3.c\
lib/linux/read.c\
lib/linux/_read.c\