From 0c8cae4cc3162e636694427334eaa088d6c687d0 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 9 Aug 2024 16:54:30 +0300 Subject: [PATCH] LibC: Move ioctl to Some ports seem to be assuming that ioctl exists there and not in stropts.h --- userspace/libraries/LibC/CMakeLists.txt | 2 +- userspace/libraries/LibC/include/stropts.h | 42 +-------------- userspace/libraries/LibC/include/sys/ioctl.h | 52 +++++++++++++++++++ .../LibC/{stropts.cpp => sys/ioctl.cpp} | 2 +- 4 files changed, 56 insertions(+), 42 deletions(-) create mode 100644 userspace/libraries/LibC/include/sys/ioctl.h rename userspace/libraries/LibC/{stropts.cpp => sys/ioctl.cpp} (91%) diff --git a/userspace/libraries/LibC/CMakeLists.txt b/userspace/libraries/LibC/CMakeLists.txt index 5a70dd51..5105a70b 100644 --- a/userspace/libraries/LibC/CMakeLists.txt +++ b/userspace/libraries/LibC/CMakeLists.txt @@ -19,8 +19,8 @@ set(LIBC_SOURCES stdlib.cpp string.cpp strings.cpp - stropts.cpp sys/banan-os.cpp + sys/ioctl.cpp sys/mman.cpp sys/select.cpp sys/socket.cpp diff --git a/userspace/libraries/LibC/include/stropts.h b/userspace/libraries/LibC/include/stropts.h index 87eeb500..6c8ad295 100644 --- a/userspace/libraries/LibC/include/stropts.h +++ b/userspace/libraries/LibC/include/stropts.h @@ -7,6 +7,8 @@ __BEGIN_DECLS +#include + #define __need_uid_t #define __need_gid_t #include @@ -71,45 +73,6 @@ struct str_list int sl_nmods; /* Number of STREAMS module names. */ }; -#define I_ATMARK 1 -#define I_CANPUT 2 -#define I_CKBAND 3 -#define I_FDINSERT 4 -#define I_FIND 5 -#define I_FLUSH 6 -#define I_FLUSHBAND 7 -#define I_GETBAND 8 -#define I_GETCLTIME 9 -#define I_GETSIG 10 -#define I_GRDOPT 11 -#define I_GWROPT 12 -#define I_LINK 13 -#define I_LIST 14 -#define I_LOOK 15 -#define I_NREAD 16 -#define I_PEEK 17 -#define I_PLINK 18 -#define I_POP 19 -#define I_PUNLINK 20 -#define I_PUSH 21 -#define I_RECVFD 22 -#define I_SENDFD 23 -#define I_SETCLTIME 24 -#define I_SETSIG 25 -#define I_SRDOPT 26 -#define I_STR 27 -#define I_SWROPT 28 -#define I_UNLINK 29 - -#define KDLOADFONT 30 - -struct winsize -{ - unsigned short ws_row; - unsigned short ws_col; -}; -#define TIOCGWINSZ 50 - #define FLUSHR 1 #define FLUSHRW 2 #define FLUSHW 3 @@ -152,7 +115,6 @@ int fattach(int, const char*); int fdetach(const char*); int getmsg(int, struct strbuf* __restrict, struct strbuf* __restrict, int* __restrict); int getpmsg(int, struct strbuf* __restrict, struct strbuf* __restrict, int* __restrict, int* __restrict); -int ioctl(int, int, ...); int isastream(int); int putmsg(int, const struct strbuf*, const struct strbuf*, int); int putpmsg(int, const struct strbuf*, const struct strbuf*, int, int); diff --git a/userspace/libraries/LibC/include/sys/ioctl.h b/userspace/libraries/LibC/include/sys/ioctl.h new file mode 100644 index 00000000..a4d90990 --- /dev/null +++ b/userspace/libraries/LibC/include/sys/ioctl.h @@ -0,0 +1,52 @@ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H 1 + +#include + +__BEGIN_DECLS + +#define I_ATMARK 1 +#define I_CANPUT 2 +#define I_CKBAND 3 +#define I_FDINSERT 4 +#define I_FIND 5 +#define I_FLUSH 6 +#define I_FLUSHBAND 7 +#define I_GETBAND 8 +#define I_GETCLTIME 9 +#define I_GETSIG 10 +#define I_GRDOPT 11 +#define I_GWROPT 12 +#define I_LINK 13 +#define I_LIST 14 +#define I_LOOK 15 +#define I_NREAD 16 +#define I_PEEK 17 +#define I_PLINK 18 +#define I_POP 19 +#define I_PUNLINK 20 +#define I_PUSH 21 +#define I_RECVFD 22 +#define I_SENDFD 23 +#define I_SETCLTIME 24 +#define I_SETSIG 25 +#define I_SRDOPT 26 +#define I_STR 27 +#define I_SWROPT 28 +#define I_UNLINK 29 + +#define KDLOADFONT 30 + +struct winsize +{ + unsigned short ws_row; + unsigned short ws_col; +}; +#define TIOCGWINSZ 50 +#define TIOCSWINSZ 51 + +int ioctl(int, int, ...); + +__END_DECLS + +#endif diff --git a/userspace/libraries/LibC/stropts.cpp b/userspace/libraries/LibC/sys/ioctl.cpp similarity index 91% rename from userspace/libraries/LibC/stropts.cpp rename to userspace/libraries/LibC/sys/ioctl.cpp index 4c14c421..a6afa093 100644 --- a/userspace/libraries/LibC/stropts.cpp +++ b/userspace/libraries/LibC/sys/ioctl.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include