mirror of
https://github.com/apache/nuttx.git
synced 2026-08-03 05:09:00 +00:00
libc: Implement ttyname and ttyname_r
Note: this patch can get file path from root pseudo file handle, but a general infrastructure is setup for other file system too. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I86cd79ebb741f2f43fdd398bb7498c40687d949b
This commit is contained in:
parent
b7653e2fae
commit
2fa1e55628
12 changed files with 264 additions and 2 deletions
|
|
@ -95,6 +95,7 @@
|
|||
#define F_SETLKW 12 /* Like F_SETLK, but wait for lock to become available */
|
||||
#define F_SETOWN 13 /* Set pid that will receive SIGIO and SIGURG signals for fd */
|
||||
#define F_SETSIG 14 /* Set the signal to be sent */
|
||||
#define F_GETPATH 15 /* Get the path of the file descriptor(BSD/macOS) */
|
||||
|
||||
/* For posix fcntl() and lockf() */
|
||||
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@
|
|||
#define MAX_CANON _POSIX_MAX_CANON
|
||||
#define MAX_INPUT _POSIX_MAX_INPUT
|
||||
#define NAME_MAX _POSIX_NAME_MAX
|
||||
#define TTY_NAME_MAX _POSIX_NAME_MAX
|
||||
#define NGROUPS_MAX _POSIX_NGROUPS_MAX
|
||||
#define OPEN_MAX _POSIX_OPEN_MAX
|
||||
#define PATH_MAX _POSIX_PATH_MAX
|
||||
|
|
|
|||
|
|
@ -180,6 +180,9 @@
|
|||
#define FIONCLEX _FIOC(0x000e) /* IN: None
|
||||
* OUT: None
|
||||
*/
|
||||
#define FIOC_FILEPATH _FIOC(0x000f) /* IN: FAR char *(length >= PATH_MAX)
|
||||
* OUT: The full file path
|
||||
*/
|
||||
|
||||
/* NuttX file system ioctl definitions **************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -322,6 +322,9 @@ int ftruncate(int fd, off_t length);
|
|||
/* Check if a file descriptor corresponds to a terminal I/O file */
|
||||
|
||||
int isatty(int fd);
|
||||
|
||||
FAR char *ttyname(int fd);
|
||||
int ttyname_r(int fd, FAR char *buf, size_t buflen);
|
||||
#endif
|
||||
|
||||
/* Memory management */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue