Thread: [Libsysio-commit] HEAD: libsysio/src readlink.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-05-28 11:52:37
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2519/src Added Files: readlink.c Log Message: Oops. Ok, here's readlink(2) now. --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2004 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ #include <unistd.h> #include <errno.h> #include <assert.h> #include <sys/types.h> #include <sys/queue.h> #include "sysio.h" #include "inode.h" #include "sysio-symbols.h" int SYSIO_INTERFACE_NAME(readlink)(const char *path, char *buf, size_t bufsiz) { struct intent intent; int err; struct pnode *pno; struct inode *ino; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; INTENT_INIT(&intent, INT_GETATTR, NULL, NULL); err = _sysio_namei(_sysio_cwd, path, ND_NOFOLLOW, &intent, &pno); if (err) goto out; ino = pno->p_base->pb_ino; err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz); if (err) goto error; error: P_RELE(pno); out: SYSIO_INTERFACE_RETURN(err, err >= 0 ? 0 : err); } #ifdef REDSTORM #undef __readlink sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(readlink), PREPEND(__, SYSIO_INTERFACE_NAME(readlink))) #endif |
From: Lee W. <lw...@us...> - 2004-08-27 18:11:37
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31294/src Modified Files: readlink.c Log Message: Cray SPR 729924. Bad return values. Was returning the negated error code instead of -1. Fixed. Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- readlink.c 27 Jul 2004 15:00:48 -0000 1.3 +++ readlink.c 27 Aug 2004 18:11:24 -0000 1.4 @@ -45,6 +45,7 @@ #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> #include <sys/queue.h> #include "sysio.h" @@ -58,6 +59,7 @@ SYSIO_INTERFACE_NAME(readlink)(const cha int err; struct pnode *pno; struct inode *ino; + struct intnl_stat stbuf; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -66,6 +68,13 @@ SYSIO_INTERFACE_NAME(readlink)(const cha if (err) goto out; ino = pno->p_base->pb_ino; + err = (*ino->i_ops.inop_getattr)(pno, ino, &stbuf); + if (err) + goto error; + if (!S_ISLNK(stbuf.st_mode)) { + err = -EINVAL; + goto error; + } err = (*ino->i_ops.inop_readlink)(pno, buf, bufsiz); if (err) goto error; @@ -73,7 +82,7 @@ SYSIO_INTERFACE_NAME(readlink)(const cha error: P_RELE(pno); out: - SYSIO_INTERFACE_RETURN(err, err >= 0 ? 0 : err); + SYSIO_INTERFACE_RETURN(err < 0 ? -1 : err, err >= 0 ? 0 : err); } #ifdef REDSTORM |
From: Ruth K. <rk...@us...> - 2004-09-10 16:44:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14248 Modified Files: readlink.c Log Message: IS_LNK definition needed on alpha Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- readlink.c 27 Aug 2004 18:11:24 -0000 1.4 +++ readlink.c 10 Sep 2004 16:43:37 -0000 1.5 @@ -41,6 +41,9 @@ * le...@sa... */ +#if defined(__linux__) +#define _BSD_SOURCE +#endif #include <unistd.h> #include <errno.h> #include <assert.h> |
From: Lee W. <lw...@us...> - 2007-01-02 20:44:15
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2466/src Modified Files: readlink.c Log Message: Fix return type for readlink with newer versions of glibc >From Oleg Drokin at Cluster File Systems: [...] newer glibc version readlink returns ssize_t instead of int, and thus libsysio cannot be compiled anymore due to conflicting declarations. Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- readlink.c 14 Oct 2004 14:59:29 -0000 1.6 +++ readlink.c 2 Jan 2007 20:44:10 -0000 1.7 @@ -55,7 +55,11 @@ #include "inode.h" #include "sysio-symbols.h" +#ifdef HAVE_POSIX_1003_READLINK +ssize_t +#else int +#endif SYSIO_INTERFACE_NAME(readlink)(const char *path, char *buf, size_t bufsiz) { struct intent intent; |
From: Lee W. <lw...@us...> - 2007-03-23 20:02:19
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12453/src Modified Files: readlink.c Log Message: The configure test for readlink was broken. The readlink module was improperly forcing the BSD variance. This is in compliance with the proper POSIX options. One note: The GNU includes just don't define a prototype for readlink sans extensions. The choices made here should be the correct ones. Your mileage may vary... Index: readlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- readlink.c 2 Jan 2007 20:44:10 -0000 1.7 +++ readlink.c 23 Mar 2007 20:02:13 -0000 1.8 @@ -41,9 +41,6 @@ * le...@sa... */ -#if defined(__linux__) -#define _BSD_SOURCE -#endif #include <unistd.h> #include <errno.h> #include <assert.h> |
From: Klundt, R. <rk...@sa...> - 2007-03-26 18:04:06
|
On this one, the Rules.make file is defining _XOPEN_SOURCE=3D600. But = the configure step does not have that defined. So it can prompt the ssize_t readlink and pass that test in the catamount build. Then when the compile comes around the ssize_t readlink is seen and conflicts with the int version due to that define. Don't know/remember why that is in Rules.make? Ruth =20 -----Original Message----- From: lib...@li... [mailto:lib...@li...] On Behalf Of Lee Ward Sent: Friday, March 23, 2007 2:02 PM To: lib...@li... Subject: [Libsysio-commit] HEAD: libsysio/src readlink.c Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12453/src Modified Files: readlink.c Log Message: The configure test for readlink was broken. The readlink module was improperly forcing the BSD variance. This is in compliance with the proper POSIX options. One note: The GNU includes just don't define a prototype for readlink sans extensions. The choices made here should be the correct ones. Your mileage may vary... Index: readlink.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/libsysio/libsysio/src/readlink.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- readlink.c 2 Jan 2007 20:44:10 -0000 1.7 +++ readlink.c 23 Mar 2007 20:02:13 -0000 1.8 @@ -41,9 +41,6 @@ * le...@sa... */ =20 -#if defined(__linux__) -#define _BSD_SOURCE -#endif #include <unistd.h> #include <errno.h> #include <assert.h> ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDE V _______________________________________________ Libsysio-commit mailing list Lib...@li... https://lists.sourceforge.net/lists/listinfo/libsysio-commit |