mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Initial import
This commit is contained in:
commit
c91b3c5006
14915 changed files with 590219 additions and 0 deletions
52
libc/calls/ioctl.h
Normal file
52
libc/calls/ioctl.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_CALLS_IOCTL_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_IOCTL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § system calls » input output control ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
int ioctl(int, uint64_t, void *);
|
||||
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § system calls » input output control » undiamonding ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
#ifdef __GNUC__
|
||||
#include "libc/macros.h"
|
||||
#include "libc/sysv/consts/termios.h"
|
||||
|
||||
struct termios;
|
||||
struct winsize;
|
||||
|
||||
#define ioctl(FD, REQUEST, MEMORY) ioctl$dispatch(FD, REQUEST, MEMORY)
|
||||
|
||||
#define __IOCTL_DISPATCH(CMP, FD, REQUEST, MEMORY) \
|
||||
do { \
|
||||
if (CMP(request, TIOCGWINSZ)) return ioctl$tiocgwinsz(FD, MEMORY); \
|
||||
if (CMP(request, TIOCSWINSZ)) return ioctl$tiocswinsz(FD, MEMORY); \
|
||||
if (CMP(request, TCGETS)) return ioctl$tcgets(FD, MEMORY); \
|
||||
if (CMP(request, TCSETS)) return ioctl$tcsets(FD, REQUEST, MEMORY); \
|
||||
if (CMP(request, TCSETSW)) return ioctl$tcsets(FD, REQUEST, MEMORY); \
|
||||
if (CMP(request, TCSETSF)) return ioctl$tcsets(FD, REQUEST, MEMORY); \
|
||||
} while (0)
|
||||
|
||||
int ioctl$tcgets(int, void *);
|
||||
int ioctl$tcgets$nt(int, void *);
|
||||
int ioctl$tcsets(int, uint64_t, void *);
|
||||
int ioctl$tcsets$nt(int, uint64_t, void *);
|
||||
int ioctl$tiocgwinsz(int, void *);
|
||||
int ioctl$tiocgwinsz$nt(int, void *);
|
||||
int ioctl$tiocswinsz(int, void *);
|
||||
int ioctl$tiocswinsz$nt(int, void *);
|
||||
int ioctl$default(int, uint64_t, void *);
|
||||
|
||||
forceinline int ioctl$dispatch(int fd, uint64_t request, void *memory) {
|
||||
__IOCTL_DISPATCH(EQUIVALENT, fd, request, memory);
|
||||
return ioctl$default(fd, request, memory);
|
||||
}
|
||||
|
||||
#endif /* GNUC */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_IOCTL_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue