am afdfce06: am 3a5c958c: am 171040c6: am bd37ac2e: Merge "Make sys/ioctl_compat.h portable."

* commit 'afdfce0645b410402a52458c54a6032f2f8becfc':
  Make sys/ioctl_compat.h portable.
This commit is contained in:
Andrew Hsieh
2012-08-17 17:51:51 -07:00
committed by Android Git Automerger
2 changed files with 124 additions and 2 deletions

View File

@@ -154,6 +154,47 @@ static inline int mips_change_request(int request)
return TIOCPKT_DOSTOP;
/* case TIOCSER_TEMT_PORTABLE: // = 1 same as TIOCPKT_FLUSHREAD_PORTABLE
return TIOCSER_TEMT; */
case TIOCGPTN_PORTABLE:
return TIOCGPTN;
case TIOCSPTLCK_PORTABLE:
return TIOCSPTLCK;
#ifdef USE_OLD_TTY
case TIOCGETD_PORTABLE:
return TIOCGETD;
case TIOCSETD_PORTABLE:
return TIOCSETD;
#else
case OTIOCGETD_PORTABLE:
return OTIOCGETD;
case OTIOCSETD_PORTABLE:
return OTIOCSETD;
#endif
case TIOCHPCL_PORTABLE:
return TIOCHPCL;
case TIOCGETP_PORTABLE:
return TIOCGETP;
case TIOCSETP_PORTABLE:
return TIOCSETP;
case TIOCSETN_PORTABLE:
return TIOCSETN;
case TIOCSETC_PORTABLE:
return TIOCSETC;
case TIOCGETC_PORTABLE:
return TIOCGETC;
case TIOCLBIS_PORTABLE:
return TIOCLBIS;
case TIOCLBIC_PORTABLE:
return TIOCLBIC;
case TIOCLSET_PORTABLE:
return TIOCLSET;
case TIOCLGET_PORTABLE:
return TIOCLGET;
case TIOCSLTC_PORTABLE:
return TIOCSLTC;
case TIOCGLTC_PORTABLE:
return TIOCGLTC;
case OTIOCCONS_PORTABLE:
return OTIOCCONS;
}
return request;
}

View File

@@ -17,6 +17,37 @@
#ifndef _IOCTLS_PORTABLE_H_
#define _IOCTLS_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/include/asm-generic/ioctl.h */
#define _IOC_NRBITS_PORTABLE 8
#define _IOC_TYPEBITS_PORTABLE 8
#define _IOC_SIZEBITS_PORTABLE 14
#define _IOC_DIRBITS_PORTABLE 2
#define _IOC_NRMASK_PORTABLE ((1 << _IOC_NRBITS_PORTABLE)-1)
#define _IOC_TYPEMASK_PORTABLE ((1 << _IOC_TYPEBITS_PORTABLE)-1)
#define _IOC_SIZEMASK_PORTABLE ((1 << _IOC_SIZEBITS_PORTABLE)-1)
#define _IOC_DIRMASK_PORTABLE ((1 << _IOC_DIRBITS_PORTABLE)-1)
#define _IOC_NRSHIFT_PORTABLE 0
#define _IOC_TYPESHIFT_PORTABLE (_IOC_NRSHIFT_PORTABLE+_IOC_NRBITS_PORTABLE)
#define _IOC_SIZESHIFT_PORTABLE (_IOC_TYPESHIFT_PORTABLE+_IOC_TYPEBITS_PORTABLE)
#define _IOC_DIRSHIFT_PORTABLE (_IOC_SIZESHIFT_PORTABLE+_IOC_SIZEBITS_PORTABLE)
#define _IOC_NONE_PORTABLE 0U
#define _IOC_WRITE_PORTABLE 1U
#define _IOC_READ_PORTABLE 2U
#define _IOC_PORTABLE(dir,type,nr,size) (((dir) << _IOC_DIRSHIFT_PORTABLE) | ((type) << _IOC_TYPESHIFT_PORTABLE) | ((nr) << _IOC_NRSHIFT_PORTABLE) | ((size) << _IOC_SIZESHIFT_PORTABLE))
extern unsigned int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK_PORTABLE(t) ((sizeof(t) == sizeof(t[1]) && sizeof(t) < (1 << _IOC_SIZEBITS_PORTABLE)) ? sizeof(t) : __invalid_size_argument_for_IOC)
#define _IO_PORTABLE(type,nr) _IOC_PORTABLE(_IOC_NONE_PORTABLE,(type),(nr),0)
#define _IOR_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_READ_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
#define _IOW_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_WRITE_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
#define _IOWR_PORTABLE(type,nr,size) _IOC_PORTABLE(_IOC_READ_PORTABLE|_IOC_WRITE_PORTABLE,(type),(nr),(_IOC_TYPECHECK_PORTABLE(size)))
/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/ioctls.h */
#define TCGETS_PORTABLE 0x5401
@@ -60,8 +91,8 @@
#define TIOCSBRK_PORTABLE 0x5427
#define TIOCCBRK_PORTABLE 0x5428
#define TIOCGSID_PORTABLE 0x5429
//#define TIOCGPTN _IOR('T',0x30, unsigned int)
//#define TIOCSPTLCK _IOW('T',0x31, int)
#define TIOCGPTN_PORTABLE _IOR_PORTABLE('T',0x30, unsigned int)
#define TIOCSPTLCK_PORTABLE _IOW_PORTABLE('T',0x31, int)
#define FIONCLEX_PORTABLE 0x5450
#define FIOCLEX_PORTABLE 0x5451
@@ -90,4 +121,54 @@
#define TIOCSER_TEMT_PORTABLE 0x01
/* Derived from development/ndk/platforms/android-3/include/sys/ioctl_compat.h */
struct tchars_portable {
char t_intrc; /* interrupt */
char t_quitc; /* quit */
char t_startc; /* start output */
char t_stopc; /* stop output */
char t_eofc; /* end-of-file */
char t_brkc; /* input delimiter (like nl) */
};
struct ltchars_portable {
char t_suspc; /* stop process signal */
char t_dsuspc; /* delayed stop process signal */
char t_rprntc; /* reprint line */
char t_flushc; /* flush output (toggles) */
char t_werasc; /* word erase */
char t_lnextc; /* literal next character */
};
struct sgttyb_portable {
char sg_ispeed; /* input speed */
char sg_ospeed; /* output speed */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
short sg_flags; /* mode flags */
};
#ifdef USE_OLD_TTY
# define TIOCGETD_PORTABLE _IOR_PORTABLE('t', 0, int) /* get line discipline */
# define TIOCSETD_PORTABLE _IOW_PORTABLE('t', 1, int) /* set line discipline */
#else
# define OTIOCGETD_PORTABLE _IOR_PORTABLE('t', 0, int) /* get line discipline */
# define OTIOCSETD_PORTABLE _IOW_PORTABLE('t', 1, int) /* set line discipline */
#endif
#define TIOCHPCL_PORTABLE _IO_PORTABLE('t', 2) /* hang up on last close */
#define TIOCGETP_PORTABLE _IOR_PORTABLE('t', 8,struct sgttyb_portable)/* get parameters -- gtty */
#define TIOCSETP_PORTABLE _IOW_PORTABLE('t', 9,struct sgttyb_portable)/* set parameters -- stty */
#define TIOCSETN_PORTABLE _IOW_PORTABLE('t',10,struct sgttyb_portable)/* as above, but no flushtty*/
#define TIOCSETC_PORTABLE _IOW_PORTABLE('t',17,struct tchars_portable)/* set special characters */
#define TIOCGETC_PORTABLE _IOR_PORTABLE('t',18,struct tchars_portable)/* get special characters */
#define TIOCLBIS_PORTABLE _IOW_PORTABLE('t', 127, int) /* bis local mode bits */
#define TIOCLBIC_PORTABLE _IOW_PORTABLE('t', 126, int) /* bic local mode bits */
#define TIOCLSET_PORTABLE _IOW_PORTABLE('t', 125, int) /* set entire local mode word */
#define TIOCLGET_PORTABLE _IOR_PORTABLE('t', 124, int) /* get local modes */
#define TIOCSLTC_PORTABLE _IOW_PORTABLE('t',117,struct ltchars_portable)/* set local special chars*/
#define TIOCGLTC_PORTABLE _IOR_PORTABLE('t',116,struct ltchars_portable)/* get local special chars*/
#define OTIOCCONS_PORTABLE _IO_PORTABLE('t', 98) /* for hp300 -- sans int arg */
#endif /* _IOCTLS_PORTABLE_H */