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:
parent
a4e56aac56
commit
fca14d27ad
|
@ -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
|
||||
|
|
|
@ -49,7 +49,8 @@ char * fdgets (char *s, int count, int fd);
|
|||
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);
|
||||
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);
|
||||
|
|
2
kaem.run
2
kaem.run
|
@ -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 \
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
33
lib/stub/ioctl3.c
Normal 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;
|
||||
}
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue