adds missing symbols and sources for libwrap

This commit is contained in:
Eyck Jentzsch 2023-09-28 11:51:20 +02:00
parent e91ce0148b
commit aab4d1f2a0
7 changed files with 43 additions and 4 deletions

View File

@ -24,16 +24,36 @@ LIBWRAP_SRCS := \
sys/times.c \ sys/times.c \
sys/sbrk.c \ sys/sbrk.c \
sys/_exit.c \ sys/_exit.c \
sys/puts.c \
misc/write_hex.c \ misc/write_hex.c \
sys/printf.c sys/printf.c
LIBWRAP_SRCS := $(foreach f,$(LIBWRAP_SRCS),$(LIBWRAP_DIR)/$(f)) LIBWRAP_SRCS := $(foreach f,$(LIBWRAP_SRCS),$(LIBWRAP_DIR)/$(f))
LIBWRAP_OBJS := $(LIBWRAP_SRCS:.c=.o) LIBWRAP_OBJS := $(LIBWRAP_SRCS:.c=.o)
LIBWRAP_SYMS := malloc free \ LIBWRAP_SYMS := \
open lseek read write fstat stat close link unlink \ malloc \
execve fork getpid kill wait \ open \
isatty times sbrk _exit lseek _lseek\
read _read\
write _write\
fstat _fstat\
stat \
close _close\
link \
unlink \
execve \
fork \
getpid \
kill \
wait \
isatty \
times \
sbrk _sbrk\
_exit \
puts _puts\
printf \
sprintf
LIBWRAP := libwrap.a LIBWRAP := libwrap.a

View File

@ -2,8 +2,12 @@
#include <errno.h> #include <errno.h>
#include "stub.h" #include "stub.h"
#include "weak_under_alias.h"
int __wrap_close(int fd) int __wrap_close(int fd)
{ {
return _stub(EBADF); return _stub(EBADF);
} }
weak_under_alias(close);

View File

@ -4,6 +4,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "stub.h" #include "stub.h"
#include "weak_under_alias.h"
int __wrap_fstat(int fd, struct stat* st) int __wrap_fstat(int fd, struct stat* st)
{ {
@ -14,3 +15,5 @@ int __wrap_fstat(int fd, struct stat* st)
return _stub(EBADF); return _stub(EBADF);
} }
weak_under_alias(fstat);

View File

@ -4,6 +4,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include "stub.h" #include "stub.h"
#include "weak_under_alias.h"
off_t __wrap_lseek(int fd, off_t ptr, int dir) off_t __wrap_lseek(int fd, off_t ptr, int dir)
{ {
@ -12,3 +13,6 @@ off_t __wrap_lseek(int fd, off_t ptr, int dir)
return _stub(EBADF); return _stub(EBADF);
} }
weak_under_alias(lseek);

View File

@ -7,6 +7,7 @@
#include "platform.h" #include "platform.h"
#include "stub.h" #include "stub.h"
#include "weak_under_alias.h"
ssize_t __wrap_read(int fd, void* ptr, size_t len) ssize_t __wrap_read(int fd, void* ptr, size_t len)
{ {
@ -28,3 +29,5 @@ ssize_t __wrap_read(int fd, void* ptr, size_t len)
return _stub(EBADF); return _stub(EBADF);
} }
weak_under_alias(read);

View File

@ -1,6 +1,7 @@
/* See LICENSE of license details. */ /* See LICENSE of license details. */
#include <stddef.h> #include <stddef.h>
#include "weak_under_alias.h"
void *__wrap_sbrk(ptrdiff_t incr) void *__wrap_sbrk(ptrdiff_t incr)
{ {
@ -14,3 +15,5 @@ void *__wrap_sbrk(ptrdiff_t incr)
curbrk += incr; curbrk += incr;
return curbrk - incr; return curbrk - incr;
} }
weak_under_alias(sbrk);

View File

@ -7,6 +7,7 @@
#include "platform.h" #include "platform.h"
#include "stub.h" #include "stub.h"
#include "weak_under_alias.h"
ssize_t __wrap_write(int fd, const void* ptr, size_t len) ssize_t __wrap_write(int fd, const void* ptr, size_t len)
{ {
@ -27,3 +28,4 @@ ssize_t __wrap_write(int fd, const void* ptr, size_t len)
return _stub(EBADF); return _stub(EBADF);
} }
weak_under_alias(write);