From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45936 invoked by alias); 5 Jul 2018 09:16:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 45926 invoked by uid 89); 5 Jul 2018 09:16:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=join, Special, Device, guerra X-HELO: a3-44.smtp-out.eu-west-1.amazonses.com Received: from a3-44.smtp-out.eu-west-1.amazonses.com (HELO a3-44.smtp-out.eu-west-1.amazonses.com) (54.240.3.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jul 2018 09:16:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=jl7vyxitgsfircfdhxflkj2c3tgxidze; d=farjump.io; t=1530782194; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:References:Message-Id; bh=sqLrS61LKa+LSTrM9QrSJKBCwU3SQe9ojcwRiYaoamo=; b=bLrzG5ZFN460cto4mwPvllq4IGq43hya552RL20PHNKRuKB9mOEHfNMGe7clQSSf +11hctXasY4njvdAMeoM+EenSu3DSKnNzjV0TsRnU+Wa44Q8y9fn9/1a5bkSAs6OQBu pXm9goCqYtiVS/MtXLbeNO9cezwxGIj4BY2PdrGo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1530782194; h=Subject:From:To:Cc:Date:Mime-Version:Content-Type:Content-Transfer-Encoding:References:Message-Id:Feedback-ID; bh=sqLrS61LKa+LSTrM9QrSJKBCwU3SQe9ojcwRiYaoamo=; b=RVUqLIfLB2xlLR9uxwpRVgT/Nef7pxMKrcfHBo9bQZm9L1cvPLO/4CRQvfD4gvBy rYa/CdSS3ckOUa8x1OSG9QsILUE/J53H7ulRMjJA89Y98TsC0Y+sTim+CImov0ruQNF XiZ9EYIxHlbIZO1MfnZq+HoQ/+nSVXLYw0WmOkXA= Subject: [PATCH v4] Allow using special files with File I/O functions From: =?UTF-8?Q?Julio_Guerra?= To: =?UTF-8?Q?gdb-patches=40sourceware=2Eorg?= Cc: =?UTF-8?Q?Pedro_Alves?= , =?UTF-8?Q?Julio_Guerra?= Date: Thu, 05 Jul 2018 09:16:00 -0000 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable References: <20180705091618.33743-1-julio@farjump.io> X-Original-Mailer: git-send-email 2.18.0 Message-ID: <0102016469ba9beb-e8338b53-74bd-46ea-91c7-eea909052532-000000@eu-west-1.amazonses.com> X-SW-Source: 2018-07/txt/msg00119.txt.bz2 Remove the restriction in remote_fileio_func_open() to regular files only a= nd=0D add support for special file types in the File IO stat structure.=0D The link file type is not part of the new definitions as stat() and fstat()= =0D called by remote_fileio_func_stat() and remote_fileio_func_fstat() follow l= inks,=0D it is thus not possible to obtain this file type in the File IO stat struct= ure.=0D =0D Add tests to cover as much cases as possible, limited by the fact that some= =0D types such as FIFOs or character devices cannot be created on non-unix oper= ating=0D systems. This limits the test cases to a regular file, a directory and the= =0D standard output/input/error descriptors.=0D =0D The major goal is to be able to write advanced embedded testing functions, = like:=0D - using a FIFO between the embedded program and the host, instead of being= =0D restricted to the GDB console only.=0D - mocking features based on host's by using some host device.=0D =0D 2018-07-05 Julio Guerra =0D =0D * remote-fileio.c (remote_fileio_func_open, remote_fileio_func_stat):=0D Allow using File I/O functions open(), stat() and fstat() on special=0D files.=0D * common/fileio.c (fileio_to_host_mode, fileio_mode_pack): Add new=0D special file types in fst_mode's definition.=0D (host_to_fileio_stat): Define fst_dev using the new macro definitions=0D and according to the file's type.=0D * testsuite/gdb.base/fileio.c: Add test cases to cover some special=0D files and file descriptors.=0D * testsuite/gdb.base/fileio.exp: Likewise.=0D * doc/gdb.texinfo: Document the changes.=0D * NEWS: Briefly describe the changes of File I/O operations open, stat,=0D fstat.=0D =0D Signed-off-by: Julio Guerra =0D ---=0D gdb/ChangeLog | 16 ++++++=0D gdb/NEWS | 4 ++=0D gdb/common/fileio.c | 55 +++++++++++++++----=0D gdb/doc/gdb.texinfo | 7 ++-=0D gdb/remote-fileio.c | 10 +---=0D gdb/testsuite/gdb.base/fileio.c | 87 +++++++++++++++++++++++++++----=0D gdb/testsuite/gdb.base/fileio.exp | 26 ++++++++-=0D include/ChangeLog | 5 ++=0D include/gdb/fileio.h | 19 +++++--=0D 9 files changed, 197 insertions(+), 32 deletions(-)=0D =0D diff --git a/gdb/ChangeLog b/gdb/ChangeLog=0D index 7bd0cc4f95..b937f029e3 100644=0D --- a/gdb/ChangeLog=0D +++ b/gdb/ChangeLog=0D @@ -1,3 +1,19 @@=0D +2018-07-05 Julio Guerra =0D +=0D + * remote-fileio.c (remote_fileio_func_open, remote_fileio_func_stat):=0D + Allow using File I/O functions open(), stat() and fstat() on special=0D + files.=0D + * common/fileio.c (fileio_to_host_mode, fileio_mode_pack): Add new=0D + special file types in fst_mode's definition.=0D + (host_to_fileio_stat): Define fst_dev using the new macro definitions=0D + and according to the file's type.=0D + * testsuite/gdb.base/fileio.c: Add test cases to cover some special=0D + files and file descriptors.=0D + * testsuite/gdb.base/fileio.exp: Likewise.=0D + * doc/gdb.texinfo: Document the changes.=0D + * NEWS: Briefly describe the changes of File I/O operations open, stat,=0D + fstat.=0D +=0D 2018-07-04 Tom Tromey =0D =0D * darwin-nat.c (darwin_attach_pid): Use exit_inferior.=0D diff --git a/gdb/NEWS b/gdb/NEWS=0D index 2d1d161233..4a0ab4ac52 100644=0D --- a/gdb/NEWS=0D +++ b/gdb/NEWS=0D @@ -36,6 +36,10 @@=0D * C expressions can now use _Alignof, and C++ expressions can now use=0D alignof.=0D =0D +* The File I/O remote protocole extension now allows opening special files= such=0D + as FIFOs or character devices. Common file types are now be returned by = stat=0D + and fstat.=0D +=0D * New commands=0D =0D set debug fbsd-nat=0D diff --git a/gdb/common/fileio.c b/gdb/common/fileio.c=0D index 912a7ede3c..754bc4b4f6 100644=0D --- a/gdb/common/fileio.c=0D +++ b/gdb/common/fileio.c=0D @@ -119,12 +119,40 @@ fileio_to_host_mode (int fileio_mode, mode_t *mode_p)= =0D if (fileio_mode & ~FILEIO_S_SUPPORTED)=0D return -1;=0D =0D - if (fileio_mode & FILEIO_S_IFREG)=0D - mode |=3D S_IFREG;=0D - if (fileio_mode & FILEIO_S_IFDIR)=0D - mode |=3D S_IFDIR;=0D - if (fileio_mode & FILEIO_S_IFCHR)=0D - mode |=3D S_IFCHR;=0D + switch (fileio_mode & FILEIO_S_IFMT)=0D + {=0D +#ifdef S_IFSOCK=0D + case FILEIO_S_IFSOCK:=0D + *mode_p |=3D S_IFSOCK;=0D + break;=0D +#endif=0D +#ifdef S_IFREG=0D + case FILEIO_S_IFREG:=0D + mode |=3D S_IFREG;=0D + break;=0D +#endif=0D +#ifdef S_IFBLK=0D + case FILEIO_S_IFBLK:=0D + mode |=3D S_IFBLK;=0D + break;=0D +#endif=0D +#ifdef S_IFDIR=0D + case FILEIO_S_IFDIR:=0D + mode |=3D S_IFDIR;=0D + break;=0D +#endif=0D +#ifdef S_IFCHR=0D + case FILEIO_S_IFCHR:=0D + mode |=3D S_IFCHR;=0D + break;=0D +#endif=0D +#ifdef S_IFIFO=0D + case FILEIO_S_IFIFO:=0D + mode |=3D S_IFIFO;=0D + break;=0D +#endif=0D + }=0D +=0D if (fileio_mode & FILEIO_S_IRUSR)=0D mode |=3D S_IRUSR;=0D if (fileio_mode & FILEIO_S_IWUSR)=0D @@ -167,10 +195,17 @@ fileio_mode_pack (mode_t mode)=0D =0D if (S_ISREG (mode))=0D tmode |=3D FILEIO_S_IFREG;=0D - if (S_ISDIR (mode))=0D + else if (S_ISDIR (mode))=0D tmode |=3D FILEIO_S_IFDIR;=0D - if (S_ISCHR (mode))=0D + else if (S_ISCHR (mode))=0D tmode |=3D FILEIO_S_IFCHR;=0D + else if (S_ISSOCK (mode))=0D + tmode |=3D FILEIO_S_IFSOCK;=0D + else if (S_ISBLK (mode))=0D + tmode |=3D FILEIO_S_IFBLK;=0D + else if (S_ISFIFO (mode))=0D + tmode |=3D FILEIO_S_IFIFO;=0D +=0D if (mode & S_IRUSR)=0D tmode |=3D FILEIO_S_IRUSR;=0D if (mode & S_IWUSR)=0D @@ -224,8 +259,10 @@ void=0D host_to_fileio_stat (struct stat *st, struct fio_stat *fst)=0D {=0D LONGEST blksize;=0D + long fst_dev;=0D =0D - host_to_fileio_uint ((long) st->st_dev, fst->fst_dev);=0D + fst_dev =3D S_ISREG (st->st_mode) ? FILEIO_STDEV_FILE : FILEIO_STDEV_SPE= CIAL;=0D + host_to_fileio_uint (fst_dev, fst->fst_dev);=0D host_to_fileio_uint ((long) st->st_ino, fst->fst_ino);=0D host_to_fileio_mode (st->st_mode, fst->fst_mode);=0D host_to_fileio_uint ((long) st->st_nlink, fst->fst_nlink);=0D diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo=0D index 91ec219958..54b9ff6253 100644=0D --- a/gdb/doc/gdb.texinfo=0D +++ b/gdb/doc/gdb.texinfo=0D @@ -40986,7 +40986,8 @@ range of values.=0D @table @code=0D =0D @item st_dev=0D -A value of 0 represents a file, 1 the console.=0D +A value of 0 represents a file, 1 GDB's console and 2 a special file=0D +(@code{st_mode} gives further details on the file type).=0D =0D @item st_ino=0D No valid meaning for the target. Transmitted unchanged.=0D @@ -41073,8 +41074,12 @@ All values are given in hexadecimal representation= .=0D All values are given in octal representation.=0D =0D @smallexample=0D + S_IFSOCK 0140000=0D S_IFREG 0100000=0D + S_IFBLK 060000=0D S_IFDIR 040000=0D + S_IFCHR 020000=0D + S_IFIFO 010000=0D S_IRUSR 0400=0D S_IWUSR 0200=0D S_IXUSR 0100=0D diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c=0D index 313da642ea..168590245e 100644=0D --- a/gdb/remote-fileio.c=0D +++ b/gdb/remote-fileio.c=0D @@ -885,16 +885,9 @@ remote_fileio_func_stat (remote_target *remote, char *= buf)=0D remote_fileio_return_errno (remote, -1);=0D return;=0D }=0D - /* Only operate on regular files and directories. */=0D - if (!ret && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode))=0D - {=0D - remote_fileio_reply (remote, -1, FILEIO_EACCES);=0D - return;=0D - }=0D if (statptr)=0D {=0D host_to_fileio_stat (&st, &fst);=0D - host_to_fileio_uint (0, fst.fst_dev);=0D =0D errno =3D target_write_memory (statptr, (gdb_byte *) &fst, sizeof fs= t);=0D if (errno !=3D 0)=0D @@ -939,7 +932,6 @@ remote_fileio_func_fstat (remote_target *remote, char *= buf)=0D =0D if (fd =3D=3D FIO_FD_CONSOLE_IN || fd =3D=3D FIO_FD_CONSOLE_OUT)=0D {=0D - host_to_fileio_uint (1, fst.fst_dev);=0D memset (&st, 0, sizeof (st));=0D st.st_mode =3D S_IFCHR | (fd =3D=3D FIO_FD_CONSOLE_IN ? S_IRUSR : S_= IWUSR);=0D st.st_nlink =3D 1;=0D @@ -972,6 +964,8 @@ remote_fileio_func_fstat (remote_target *remote, char *= buf)=0D if (ptrval)=0D {=0D host_to_fileio_stat (&st, &fst);=0D + if (fd =3D=3D FIO_FD_CONSOLE_IN || fd =3D=3D FIO_FD_CONSOLE_OUT)=0D + host_to_fileio_uint (FILEIO_STDEV_CONSOLE, fst.fst_dev);=0D =0D errno =3D target_write_memory (ptrval, (gdb_byte *) &fst, sizeof fst= );=0D if (errno !=3D 0)=0D diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/filei= o.c=0D index 7f482a34d3..c1902f5cc8 100644=0D --- a/gdb/testsuite/gdb.base/fileio.c=0D +++ b/gdb/testsuite/gdb.base/fileio.c=0D @@ -32,11 +32,19 @@ close(int fd);=0D 1) Attempt to close an invalid file descriptor - EBADF=0D =0D stat(const char *file_name, struct stat *buf);=0D -1) Pathname is a null string - ENOENT=0D -2) Pathname does not exist - ENOENT=0D +1) Regular file=0D +2) Pathname is a null string - ENOENT=0D +3) Pathname is an empty string - ENOENT or EFAULT=0D +4) Pathname does not exist - ENOENT=0D +5) Directory=0D =0D fstat(int filedes, struct stat *buf);=0D -1) Attempt to stat using an invalid file descriptor - EBADF=0D +1) Regular file=0D +2) Attempt to stat using an invalid file descriptor - EBADF=0D +3) Directory=0D +4) Standard input=0D +5) Standard output=0D +6) Standard error=0D =0D isatty (int desc);=0D Not applicable. We will test that it returns 1 when expected and a case=0D @@ -68,9 +76,10 @@ static const char *strerrno (int err);=0D #define RENAMED "bar.fileio.test"=0D #define NONEXISTANT "nofoo.fileio.test"=0D #define NOWRITE "nowrt.fileio.test"=0D -#define TESTDIR1 "dir1.fileio.test"=0D -#define TESTDIR2 "dir2.fileio.test"=0D -#define TESTSUBDIR "dir1.fileio.test/subdir.fileio.test"=0D +#define TESTDIR1 "dir1.fileio.test"=0D +#define TESTDIR2 "dir2.fileio.test"=0D +#define TESTSUBDIR "dir1.fileio.test/subdir.fileio.test"=0D +#define DIRECTORY "directory.fileio.test"=0D =0D #define STRING "Hello World"=0D =0D @@ -292,7 +301,8 @@ test_stat (void)=0D ret =3D stat (OUTDIR FILENAME, &st);=0D if (!ret)=0D printf ("stat 1: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D - st.st_size =3D=3D 11 ? "OK" : "");=0D + st.st_dev =3D=3D 0 && S_ISREG (st.st_mode) && st.st_size =3D=3D 11 ?= =0D + "OK" : "");=0D else=0D printf ("stat 1: ret =3D %d, errno =3D %d\n", ret, errno);=0D stop ();=0D @@ -311,8 +321,20 @@ test_stat (void)=0D /* Nonexistant file */=0D errno =3D 0;=0D ret =3D stat (NONEXISTANT, &st);=0D - printf ("stat 4: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D - strerrno (errno));=0D + if (!ret)=0D + printf ("stat 4: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D + strerrno (errno));=0D + else=0D + printf ("stat 1: ret =3D %d, errno =3D %d\n", ret, errno);=0D + stop ();=0D + /* Special file: directory */=0D + errno =3D 0;=0D + ret =3D stat (OUTDIR DIRECTORY, &st);=0D + if (!ret)=0D + printf ("stat 5: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D + st.st_dev =3D=3D 2 && S_ISDIR (st.st_mode) ? "OK" : "");=0D + else=0D + printf ("stat 1: ret =3D %d, errno =3D %d\n", ret, errno);=0D stop ();=0D }=0D =0D @@ -331,7 +353,8 @@ test_fstat (void)=0D ret =3D fstat (fd, &st);=0D if (!ret)=0D printf ("fstat 1: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D - st.st_size =3D=3D 11 ? "OK" : "");=0D + st.st_dev =3D=3D 0 && S_ISREG (st.st_mode) && st.st_size =3D=3D 11 ?=0D + "OK" : "");=0D else=0D printf ("fstat 1: ret =3D %d, errno =3D %d\n", ret, errno);=0D close (fd);=0D @@ -345,6 +368,50 @@ test_fstat (void)=0D printf ("fstat 2: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D strerrno (errno));=0D stop ();=0D + /* Special file: directory */=0D + errno =3D 0;=0D + fd =3D open (OUTDIR DIRECTORY, O_RDONLY);=0D + if (fd >=3D 0)=0D + {=0D + errno =3D 0;=0D + ret =3D fstat (fd, &st);=0D + if (!ret)=0D + printf ("fstat 3: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D + st.st_dev =3D=3D 2 && S_ISDIR (st.st_mode) ? "OK" : "");=0D + else=0D + printf ("fstat 3: ret =3D %d, errno =3D %d\n", ret, errno);=0D + close (fd);=0D + }=0D + else=0D + printf ("fstat 3: errno =3D %d\n", errno);=0D + stop ();=0D + /* Standard input */=0D + errno =3D 0;=0D + ret =3D fstat (STDIN_FILENO, &st);=0D + if (!ret)=0D + printf ("fstat 4: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D + st.st_dev =3D=3D 1 ? "OK" : "");=0D + else=0D + printf ("fstat 4: ret =3D %d, errno =3D %d\n", ret, errno);=0D + stop ();=0D + /* Standard output */=0D + errno =3D 0;=0D + ret =3D fstat (STDOUT_FILENO, &st);=0D + if (!ret)=0D + printf ("fstat 5: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D + st.st_dev =3D=3D 1 ? "OK" : "");=0D + else=0D + printf ("fstat 5: ret =3D %d, errno =3D %d\n", ret, errno);=0D + stop ();=0D + /* Standard error */=0D + errno =3D 0;=0D + ret =3D fstat (STDERR_FILENO, &st);=0D + if (!ret)=0D + printf ("fstat 6: ret =3D %d, errno =3D %d %s\n", ret, errno,=0D + st.st_dev =3D=3D 1 ? "OK" : "");=0D + else=0D + printf ("fstat 6: ret =3D %d, errno =3D %d\n", ret, errno);=0D + stop ();=0D }=0D =0D void=0D diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fil= eio.exp=0D index bc409c26aa..234f304ac7 100644=0D --- a/gdb/testsuite/gdb.base/fileio.exp=0D +++ b/gdb/testsuite/gdb.base/fileio.exp=0D @@ -31,7 +31,7 @@ if {[is_remote host]} {=0D =0D if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \=0D executable \=0D - [list debug "additional_flags=3D-DOUTDIR=3D\"$outdir/\""]] !=3D "" } {= =0D + [list debug "additional_flags=3D-DOUTDIR=3D\"$outdir/\" [target_info= fileio,cflags]" "ldflags=3D[target_info fileio,ldflags]"]] !=3D "" } {=0D untested "failed to compile"=0D return -1=0D }=0D @@ -136,6 +136,10 @@ gdb_test continue \=0D "Continuing\\..*close 2:.*EBADF$stop_msg" \=0D "Closing an invalid file descriptor returns EBADF"=0D =0D +# Prepare some different file types for stat and fstat.=0D +set filetype_directory [file join $outdir "directory.fileio.test"]=0D +file mkdir $filetype_directory=0D +=0D gdb_test continue \=0D "Continuing\\..*stat 1:.*OK$stop_msg" \=0D "Stat a file"=0D @@ -152,6 +156,10 @@ gdb_test continue \=0D "Continuing\\..*stat 4:.*ENOENT$stop_msg" \=0D "Stat a nonexistant file returns ENOENT"=0D =0D +gdb_test continue \=0D +"Continuing\\..*stat 5:.*OK$stop_msg" \=0D +"Stat a directory"=0D +=0D gdb_test continue \=0D "Continuing\\..*fstat 1:.*OK$stop_msg" \=0D "Fstat an open file"=0D @@ -160,6 +168,22 @@ gdb_test continue \=0D "Continuing\\..*fstat 2:.*EBADF$stop_msg" \=0D "Fstat an invalid file descriptor returns EBADF"=0D =0D +gdb_test continue \=0D +"Continuing\\..*fstat 3:.*OK$stop_msg" \=0D +"Fstat a directory"=0D +=0D +gdb_test continue \=0D +"Continuing\\..*fstat 4:.*OK$stop_msg" \=0D +"Fstat standard output"=0D +=0D +gdb_test continue \=0D +"Continuing\\..*fstat 5:.*OK$stop_msg" \=0D +"Fstat standard input"=0D +=0D +gdb_test continue \=0D +"Continuing\\..*fstat 6:.*OK$stop_msg" \=0D +"Fstat standard error"=0D +=0D gdb_test continue \=0D "Continuing\\..*isatty 1:.*OK$stop_msg" \=0D "Isatty (stdin)"=0D diff --git a/include/ChangeLog b/include/ChangeLog=0D index de808014ac..64c41b912b 100644=0D --- a/include/ChangeLog=0D +++ b/include/ChangeLog=0D @@ -1,3 +1,8 @@=0D +2018-07-05 Julio Guerra =0D +=0D + * gdb/fileio.h: Add macro definitions for special files,=0D + both for fst_dev and fst_mode fields of struct fst_stat.=0D +=0D 2018-07-02 Maciej W. Rozycki =0D =0D PR tdep/8282=0D diff --git a/include/gdb/fileio.h b/include/gdb/fileio.h=0D index 7bb55f579f..8ae1da4c68 100644=0D --- a/include/gdb/fileio.h=0D +++ b/include/gdb/fileio.h=0D @@ -37,10 +37,24 @@=0D FILEIO_O_CREAT | FILEIO_O_TRUNC| \=0D FILEIO_O_EXCL)=0D =0D +/* Device id values of fst_dev field */=0D +/* Regular file */=0D +#define FILEIO_STDEV_FILE 0=0D +/* GDB's console */=0D +#define FILEIO_STDEV_CONSOLE 1=0D +/* Not a regular file nor the console.=0D + Bits FILEIO_S_IFMT of fst_mode give the exact file type. */=0D +#define FILEIO_STDEV_SPECIAL 2=0D +=0D /* mode_t bits */=0D +#define FILEIO_S_IFSOCK 0140000=0D #define FILEIO_S_IFREG 0100000=0D +#define FILEIO_S_IFBLK 060000=0D #define FILEIO_S_IFDIR 040000=0D #define FILEIO_S_IFCHR 020000=0D +#define FILEIO_S_IFIFO 010000=0D +#define FILEIO_S_IFMT (FILEIO_S_IFIFO | FILEIO_S_IFCHR| \=0D + FILEIO_S_IFDIR | FILEIO_S_IFBLK | FILEIO_S_IFREG | FILEIO_S_IFSOC= K)=0D #define FILEIO_S_IRUSR 0400=0D #define FILEIO_S_IWUSR 0200=0D #define FILEIO_S_IXUSR 0100=0D @@ -53,9 +67,8 @@=0D #define FILEIO_S_IWOTH 02=0D #define FILEIO_S_IXOTH 01=0D #define FILEIO_S_IRWXO 07=0D -#define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \=0D - FILEIO_S_IRWXU|FILEIO_S_IRWXG| \=0D - FILEIO_S_IRWXO)=0D +#define FILEIO_S_SUPPORTED (FILEIO_S_IFMT | FILEIO_S_IRWXU| \=0D + FILEIO_S_IRWXG | FILEIO_S_IRWXO)=0D =0D /* lseek(2) flags */=0D #define FILEIO_SEEK_SET 0=0D -- =0D 2.18.0=0D =0D