X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Ffdmatch.c;h=ff45e4191766a93ea64d06e143c1844b3e0b7352;hb=5f512a7dd0df1205630e9edfaa84f2e9a8fb8771;hp=7af039f5a2b8605c79302adf64cae791b09fb065;hpb=252b5132c753830d5fd56823373aed85f2a0db63;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/fdmatch.c b/libiberty/fdmatch.c index 7af039f5a2..ff45e41917 100644 --- a/libiberty/fdmatch.c +++ b/libiberty/fdmatch.c @@ -1,5 +1,5 @@ /* Compare two open file descriptors to see if they refer to the same file. - Copyright (C) 1991 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -14,31 +14,25 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* -NAME +@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2}) - fdmatch -- see if two file descriptors refer to same file +Check to see if two open file descriptors refer to the same file. +This is useful, for example, when we have an open file descriptor for +an unnamed file, and the name of a file that we believe to correspond +to that fd. This can happen when we are exec'd with an already open +file (@code{stdout} for example) or from the SVR4 @file{/proc} calls +that return open file descriptors for mapped address spaces. All we +have to do is open the file by name and check the two file descriptors +for a match, which is done by comparing major and minor device numbers +and inode numbers. -SYNOPSIS - - int fdmatch (int fd1, int fd2) - -DESCRIPTION - - Check to see if two open file descriptors refer to the same file. - This is useful, for example, when we have an open file descriptor - for an unnamed file, and the name of a file that we believe to - correspond to that fd. This can happen when we are exec'd with - an already open file (stdout for example) or from the SVR4 /proc - calls that return open file descriptors for mapped address spaces. - All we have to do is open the file by name and check the two file - descriptors for a match, which is done by comparing major&minor - device numbers and inode numbers. +@end deftypefn BUGS @@ -47,14 +41,15 @@ BUGS */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" #include #include -int fdmatch (fd1, fd2) - int fd1; - int fd2; +int fdmatch (int fd1, int fd2) { struct stat sbuf1; struct stat sbuf2;