LibC: Move ioctl to <sys/ioctl.h>

Some ports seem to be assuming that ioctl exists there and not in
stropts.h
This commit is contained in:
Bananymous 2024-08-09 16:54:30 +03:00
parent ed325b4a45
commit 0c8cae4cc3
4 changed files with 56 additions and 42 deletions

View File

@ -19,8 +19,8 @@ set(LIBC_SOURCES
stdlib.cpp stdlib.cpp
string.cpp string.cpp
strings.cpp strings.cpp
stropts.cpp
sys/banan-os.cpp sys/banan-os.cpp
sys/ioctl.cpp
sys/mman.cpp sys/mman.cpp
sys/select.cpp sys/select.cpp
sys/socket.cpp sys/socket.cpp

View File

@ -7,6 +7,8 @@
__BEGIN_DECLS __BEGIN_DECLS
#include <sys/ioctl.h>
#define __need_uid_t #define __need_uid_t
#define __need_gid_t #define __need_gid_t
#include <sys/types.h> #include <sys/types.h>
@ -71,45 +73,6 @@ struct str_list
int sl_nmods; /* Number of STREAMS module names. */ 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 FLUSHR 1
#define FLUSHRW 2 #define FLUSHRW 2
#define FLUSHW 3 #define FLUSHW 3
@ -152,7 +115,6 @@ int fattach(int, const char*);
int fdetach(const char*); int fdetach(const char*);
int getmsg(int, struct strbuf* __restrict, struct strbuf* __restrict, int* __restrict); 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 getpmsg(int, struct strbuf* __restrict, struct strbuf* __restrict, int* __restrict, int* __restrict);
int ioctl(int, int, ...);
int isastream(int); int isastream(int);
int putmsg(int, const struct strbuf*, const struct strbuf*, int); int putmsg(int, const struct strbuf*, const struct strbuf*, int);
int putpmsg(int, const struct strbuf*, const struct strbuf*, int, int); int putpmsg(int, const struct strbuf*, const struct strbuf*, int, int);

View File

@ -0,0 +1,52 @@
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H 1
#include <sys/cdefs.h>
__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

View File

@ -1,5 +1,5 @@
#include <stdarg.h> #include <stdarg.h>
#include <stropts.h> #include <sys/ioctl.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>