libsysio-commit Mailing List for libsysio (Page 23)
Brought to you by:
lward
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(25) |
May
(28) |
Jun
(25) |
Jul
(30) |
Aug
(60) |
Sep
(52) |
Oct
(100) |
Nov
(15) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(89) |
Feb
(48) |
Mar
(22) |
Apr
(59) |
May
(16) |
Jun
(15) |
Jul
(50) |
Aug
(26) |
Sep
(40) |
Oct
(27) |
Nov
(12) |
Dec
|
2005 |
Jan
(24) |
Feb
(11) |
Mar
|
Apr
|
May
(3) |
Jun
(6) |
Jul
|
Aug
(14) |
Sep
(21) |
Oct
(10) |
Nov
|
Dec
|
2006 |
Jan
(8) |
Feb
(5) |
Mar
(2) |
Apr
(6) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2007 |
Jan
(3) |
Feb
(5) |
Mar
(20) |
Apr
(41) |
May
(21) |
Jun
(3) |
Jul
(5) |
Aug
(12) |
Sep
(21) |
Oct
(5) |
Nov
(16) |
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
(23) |
May
|
Jun
(22) |
Jul
(13) |
Aug
|
Sep
|
Oct
(9) |
Nov
(3) |
Dec
(13) |
2009 |
Jan
(14) |
Feb
(10) |
Mar
(2) |
Apr
(11) |
May
(7) |
Jun
(1) |
Jul
(1) |
Aug
(36) |
Sep
(12) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
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: Ruth K. <rk...@us...> - 2004-09-10 16:43:15
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14110 Modified Files: fs_native.c Log Message: work around for basep brokenness Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -w -b -B -p -r1.47 -r1.48 --- fs_native.c 25 Aug 2004 08:07:45 -0000 1.47 +++ fs_native.c 10 Sep 2004 16:42:39 -0000 1.48 @@ -1022,6 +1022,12 @@ native_getdirentries(struct inode *ino, struct dirent64 *d64p; size_t namlen; size_t reclen; + /* + * Work-around for broken 64 bit basep update + * Get value of basep to return from last directory + * entry d_off value + */ + _SYSIO_OFF_T last_offset = *basep; #else #define bp buf #define count nbytes @@ -1068,12 +1074,15 @@ native_getdirentries(struct inode *ino, cc -= ldp->ld_reclen; ldp = (struct linux_dirent *)((char *)ldp + ldp->ld_reclen); nbytes -= d64p->d_reclen; + last_offset = d64p->d_off; d64p = (struct dirent64 *)((char *)d64p + d64p->d_reclen); } + nino->ni_fpos = *basep = last_offset; free(bp); - if (d64p == (struct dirent64 *)buf && cc) - cc = -EINVAL; /* buf too small */ - cc = (char *)d64p - buf; + cc = + (d64p == (struct dirent64 *)buf && cc) + ? -EINVAL + : (char *)d64p - buf; #else #undef bp #undef count |
From: Sonja T. <so...@us...> - 2004-08-30 20:29:02
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19089/tests Modified Files: test_all.pl Log Message: Fixed embarrasing "eq" versus "==" bug Index: test_all.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_all.pl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- test_all.pl 29 Jun 2004 18:49:41 -0000 1.13 +++ test_all.pl 30 Aug 2004 20:28:53 -0000 1.14 @@ -40,7 +40,7 @@ my $home = $ENV{"HOME"}; my $auto_mount = $ENV{"SYSIO_AUTOMOUNT"}; my $root_flags = "0"; my $extras = ""; -if ((defined($auto_mount)) && ($auto_mount == "xyes")) { +if ((defined($auto_mount)) && ($auto_mount eq "xyes")) { $root_flags = "2"; # |
From: Lee W. <lw...@us...> - 2004-08-30 19:06:44
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1143 Modified Files: init.c Log Message: Kevin Pedretti says x86-64 build complained about int/long assignments and compares. This should fix it. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- init.c 27 Jul 2004 15:00:43 -0000 1.13 +++ init.c 30 Aug 2004 19:06:34 -0000 1.14 @@ -557,27 +557,39 @@ do_open(char *args) { NULL, NULL } }; char *cp; + long l; int fd; + unsigned long ul; mode_t m; struct pnode *dir, *pno; struct intent intent; int err; struct file *fil; +/* + * Check if long overflows integer range. + */ +#if LONG_MAX <= INT_MAX +#define _irecheck(_l, _e) \ + ((_l) == LONG_MAX && (_e) == ERANGE) +#else +#define _irecheck(_l, _e) \ + ((_l) > INT_MAX) +#endif + len = strlen(args); if (get_args(args, v) - args != (ssize_t )len || !(v[0].value && v[1].value && v[2].value)) return -EINVAL; - fd = strtol(v[1].value, (char **)&cp, 0); - if (*cp || - (((fd == LONG_MIN || fd == LONG_MAX) && errno == ERANGE)) || - fd < 0) + l = strtol(v[1].value, (char **)&cp, 0); + if (*cp || l < 0 || _irecheck(l, errno)) return -EINVAL; - m = strtoul(v[1].value, (char **)&cp, 0); + fd = (int )l; + ul = strtoul(v[1].value, (char **)&cp, 0); if (*cp || - (m == LONG_MAX && errno == ERANGE)) + (ul == ULONG_MAX && errno == ERANGE)) return -EINVAL; - m &= O_RDONLY|O_WRONLY|O_RDWR; + m = (mode_t )ul & (O_RDONLY|O_WRONLY|O_RDWR); if (!(dir = _sysio_cwd) && !(dir = _sysio_root)) return -ENOENT; @@ -607,6 +619,8 @@ do_open(char *args) if (pno) P_RELE(pno); return err; + +#undef _irecheck } /* |
From: Ruth K. <rk...@us...> - 2004-08-30 16:48:03
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4119 Added Files: stddir.c Log Message: Changes to officially import directory functions into sysio. This is necessitated by the glibc >= 2.3 hidden attribute on getdents. (ifdef'd out for Red Storm build) --- NEW FILE --- /* * 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 * */ #ifdef __linux__ #include <features.h> #if defined(__GLIBC__) && !defined(REDSTORM) /* * stddir.c * * As of glibc 2.3, the new capability to define functions with a 'hidden' * attribute means that any time glibc decides to use that capability * we will no longer be able to successfully intercept low level calls * in a link against default system glibc. Thus the following imported * functions. */ #include <stdlib.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <dirent.h> #include <sysio.h> #include "sysio-symbols.h" #include "stddir.h" /*********************************************************** * dir series functions * ***********************************************************/ DIR* SYSIO_INTERFACE_NAME(opendir)(const char *name) { DIR *dir; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; dir = (DIR * )calloc(1, sizeof(DIR)); if (!dir) SYSIO_INTERFACE_RETURN(NULL, -ENOMEM); dir->fd = open(name, O_RDONLY); if (dir->fd < 0) { free(dir); SYSIO_INTERFACE_RETURN(NULL, -errno); } return dir; } sysio_sym_weak_alias(opendir, __opendir) int SYSIO_INTERFACE_NAME(closedir)(DIR *dir) { int rc; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; rc = SYSIO_INTERFACE_NAME(close)(dir->fd); free(dir); SYSIO_INTERFACE_RETURN(rc, 0); } sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(closedir), PREPEND(__, SYSIO_INTERFACE_NAME(closedir))) int SYSIO_INTERFACE_NAME(dirfd)(DIR *dir) { return(dir->fd); } long int SYSIO_INTERFACE_NAME(telldir)(DIR *dir) { return(dir->filepos); } void SYSIO_INTERFACE_NAME(seekdir)(DIR *dir, long int offset) { dir->filepos = offset; dir->base = offset; dir->effective = 0; dir->cur = 0; } void SYSIO_INTERFACE_NAME(rewinddir)(DIR *dir) { dir->base = 0; dir->filepos = 0; dir->cur = 0; dir->effective = 0; } #endif #endif |
From: Ruth K. <rk...@us...> - 2004-08-30 15:58:11
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/tests Modified Files: Makefile.am Added Files: test_stddir.c Log Message: Changes to officially import directory functions into sysio. This is necessitated by the glibc >= 2.3 hidden attribute on getdents. (ifdef'd out for Red Storm build) --- 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-2003 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 <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <getopt.h> #include <dirent.h> #include <sys/types.h> #include "xtio.h" #include "test.h" /* * Test {open, read, close}dir functions * * Usage: test_stddir [path, ...] */ static int testit(const char *); static void usage(void); int main (int argc, char** argv) { int err; int i; int n; const char *path; /* * Parse command line arguments. */ while ((i = getopt(argc, argv, "")) != -1) switch (i) { default: usage(); } /* * Init sysio lib. */ err = _test_sysio_startup(); if (err) { errno = -err; perror("sysio startup"); exit(1); } /* * If no command-line arguments, read from stdin until EOF. */ n = argc - optind; if (!n) { int doflush; static char buf[4096]; size_t len; char *cp; char c; doflush = 0; while (fgets(buf, sizeof(buf), stdin) != NULL) { len = strlen(buf); cp = buf + len - 1; c = *cp; *cp = '\0'; if (!doflush) err = testit(buf); if (err) break; doflush = c == '\n' ? 0 : 1; } } /* * Try path(s) listed on command-line. */ while (optind < argc) { path = argv[optind++]; err = testit(path); if (err) break; } /* * Clean up. */ _test_sysio_shutdown(); return err; } int testit(const char *path) { DIR *d; struct dirent *de; printf("testing directory functions on %s\n", path); if ((d = opendir(path)) == NULL) { perror(path); return errno; } while ((de = readdir(d)) != NULL) printf("\t %s: ino %lu off %lu type %u\n", de->d_name, (unsigned long )de->d_ino, (unsigned long )de->d_off, (int )de->d_type); if (closedir(d)) { perror("closedir"); return errno; } return 0; } static void usage() { (void )fprintf(stderr, "Usage: test_stddir [<path> ...]\n"); exit(1); } Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- Makefile.am 14 Feb 2004 19:42:59 -0000 1.19 +++ Makefile.am 30 Aug 2004 15:58:01 -0000 1.20 @@ -1,6 +1,6 @@ noinst_PROGRAMS = test_copy test_stats test_path test_list \ test_getcwd test_link test_unlink test_rename \ - test_regions test_driver + test_regions test_driver test_stddir CLEANFILES=drv_data.c @@ -106,6 +106,11 @@ test_driver_CFLAGS=$(CFL) test_driver_LDADD=$(LIBS) test_driver_DEPENDENCIES=$(LIBS) +test_stddir_SOURCES=test_stddir.c $(CMNSRC) +test_stddir_CFLAGS=$(CFL) +test_stddir_LDADD=$(LIBS) +test_stddir_DEPENDENCIES=$(LIBS) + drv_data.c: $(CONFIG_DEPENDENCIES) $(top_srcdir)/tests/gendrvdata.sh test -z "drv_data.c" && rm -f drv_data.c; \ $(SHELL) $(top_srcdir)/tests/gendrvdata.sh $(DRIVERS) > drv_data.c |
From: Ruth K. <rk...@us...> - 2004-08-30 15:58:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/src Modified Files: module.mk stdlib.c Added Files: readdir.c readdir64.c Log Message: Changes to officially import directory functions into sysio. This is necessitated by the glibc >= 2.3 hidden attribute on getdents. (ifdef'd out for Red Storm build) --- NEW FILE --- /* * 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 * */ #ifdef __linux__ #include <features.h> #if defined(__GLIBC__) && !defined(REDSTORM) #include <stdlib.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <dirent.h> #include <sysio.h> #include "sysio-symbols.h" #ifndef _READDIR #define _READDIR SYSIO_INTERFACE_NAME(readdir) #define _SCANDIR SYSIO_INTERFACE_NAME(scandir) #define _GETDIRENTRIES SYSIO_INTERFACE_NAME(getdirentries) #define _DIRENT_T struct dirent #define _OFF_T off_t #endif #include "stddir.h" _DIRENT_T * _READDIR(DIR *dir) { _DIRENT_T *dp = NULL; _OFF_T dbase; #ifndef BSD ssize_t rc; #else int rc; #endif SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; /* need to read new data? */ rc = 0; if (dir->cur >= dir->effective) { dir->cur = 0; dbase = (_OFF_T )dir->base; if (sizeof(dbase) != sizeof(dir->base) && dbase != dir->base) { dir->effective = 0; SYSIO_INTERFACE_RETURN(NULL, -EOVERFLOW); } rc = _GETDIRENTRIES(dir->fd, dir->buf, #ifndef BSD (size_t )BUFSIZE, (_OFF_T *) &dbase); #else (int )BUFSIZE, (long *) __restrict dbase); #endif dir->base = (_SYSIO_OFF_T )dbase; /* error or end-of-file */ if (rc == -ENOENT) rc = 0; if (rc <= 0) { dir->effective = 0; SYSIO_INTERFACE_RETURN(NULL, rc); } dir->effective = rc; } dp = (_DIRENT_T *)(dir->buf + dir->cur); #ifdef _DIRENT_HAVE_D_RECLEN dir->cur += dp->d_reclen; #else dir->cur += sizeof(_DIRENT_T); #endif #ifdef _DIRENT_HAVE_D_OFF dir->filepos = dp->d_off; #else dir->filepos = dir->cur; #endif SYSIO_INTERFACE_RETURN(dp, 0); } sysio_sym_weak_alias(_READDIR, PREPEND(__,_READDIR)) int _SCANDIR(const char *dirname, _DIRENT_T ***namelist, int (*filter) (const _DIRENT_T *), int (*cmp) (const void *, const void *)) { DIR *dir = NULL; _DIRENT_T *de = NULL, *nextde = NULL, **s = NULL; int n = 32, i = 0; size_t desize; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; if ((dir = opendir(dirname)) == NULL) SYSIO_INTERFACE_RETURN(-1, -errno); while ((de = _READDIR(dir)) != NULL) { if ((filter == NULL) || filter(de)) { if (i == 0 || i >= n) { n = MAX(n, 2*i); s = (_DIRENT_T **)realloc(s, (size_t )(n * sizeof(_DIRENT_T *))); if (!s) SYSIO_INTERFACE_RETURN(-1, -ENOMEM); } desize = &de->d_name[_D_ALLOC_NAMLEN(de)] - (char * )de; nextde = (_DIRENT_T *)malloc(desize); if (!nextde) SYSIO_INTERFACE_RETURN(-1, -ENOMEM); s[i++] = (_DIRENT_T *)memcpy(nextde, de, desize); } } if (cmp) qsort (s, i, sizeof (*s), cmp); *namelist = s; closedir(dir); SYSIO_INTERFACE_RETURN(i, 0); } sysio_sym_weak_alias(_SCANDIR, PREPEND(__,_SCANDIR)) #endif #endif --- NEW FILE --- #ifdef _LARGEFILE64_SOURCE #define _SCANDIR SYSIO_INTERFACE_NAME(scandir64) #define _READDIR SYSIO_INTERFACE_NAME(readdir64) #define _GETDIRENTRIES SYSIO_INTERFACE_NAME(getdirentries64) #define _DIRENT_T struct dirent64 #define _OFF_T _SYSIO_OFF_T #include "readdir.c" #endif Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/module.mk,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- module.mk 29 Jun 2004 18:49:40 -0000 1.8 +++ module.mk 30 Aug 2004 15:58:00 -0000 1.9 @@ -24,6 +24,7 @@ SRCDIR_SRCS = src/access.c src/chdir.c s src/mknod.c src/mount.c src/namei.c \ src/open.c src/rw.c src/rename.c \ src/rmdir.c src/stat64.c src/stat.c \ + src/stddir.c src/readdir.c src/readdir64.c \ src/symlink.c src/readlink.c \ src/truncate.c src/unlink.c src/utime.c \ $(FILE_SUPPORT) $(LUSTRE_SRCDIR_SRCS) Index: stdlib.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/stdlib.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- stdlib.c 27 Jul 2004 15:00:48 -0000 1.5 +++ stdlib.c 30 Aug 2004 15:58:00 -0000 1.6 @@ -39,200 +39,6 @@ #include "sysio-symbols.h" -#if !defined(__USE_LARGEFILE64) -#error "__LARGEFILE64_SOURCE must be defined" -#endif - - -/*********************************************************** - * dir series functions * - ***********************************************************/ - -#undef BUFSIZE -#define BUFSIZE 4096 - -struct __dirstream { - int fd; - loff_t base; - loff_t filepos; /* current pos in dir file stream */ - struct dirent *curent; /* current dirent pointer */ - struct dirent64 *curent64; /* current dirent64 pointer */ - struct dirent *retent; /* ent returned to caller */ - struct dirent64 *retent64; /* ent64 returned to caller */ - unsigned int effective; /* effective data size in buffer */ - char buf[BUFSIZE]; -}; - -DIR* opendir(const char *name) -{ - DIR *dir; - - dir = (DIR *) malloc(sizeof(*dir)); - if (!dir) { - errno = ENOMEM; - return NULL; - } - -#if __USE_LARGEFILE64 - dir->fd = open64(name, O_RDONLY); -#else - dir->fd = open(name, O_RDONLY); -#endif - if (dir->fd < 0) - goto err_out; - - dir->base = 0; - dir->filepos = 0; - dir->curent = (struct dirent *) dir->buf; - dir->curent64 = (struct dirent64 *) dir->buf; - dir->retent = NULL; - dir->retent64 = NULL; - dir->effective = 0; - - return dir; -err_out: - free(dir); - return NULL; -} - -sysio_sym_weak_alias(opendir, __opendir); - -struct dirent64 *readdir64(DIR *dir) -{ - int rc, reclen; - - /* need to read new data? */ - if ((char*)dir->curent64 - dir->buf >= dir->effective) { - rc = getdirentries64(dir->fd, dir->buf, BUFSIZE, &dir->base); - /* error or end-of-file */ - if (rc <= 0) - return NULL; - - dir->curent64 = (struct dirent64 *) dir->buf; - dir->effective = rc; - } - - dir->retent64 = dir->curent64; - dir->curent64 = (struct dirent64*) ((char *)(dir->curent64) + - dir->curent64->d_reclen); -#ifdef _DIRENT_HAVE_D_OFF - dir->filepos = dir->curent64->d_off; -#else - dir->filepos += dir->curent64->d_reclen; -#endif - return dir->retent64; -} - -sysio_sym_weak_alias(readdir64, __readdir64); - -/* XXX probably the following assumption is not true */ -#if __WORDSIZE == 64 -#define NATURAL_READDIR64 -#else -#undef NATURAL_READDIR64 -#endif - -#ifndef NATURAL_READDIR64 - -struct dirent *readdir(DIR *dir) -{ - int rc, reclen; - - /* need to read new data? */ - if ((char*)dir->curent - dir->buf >= dir->effective) { - rc = getdirentries(dir->fd, dir->buf, BUFSIZE, (off_t*) &dir->base); - /* error or end-of-file */ - if (rc <= 0) - return NULL; - - dir->curent = (struct dirent *) dir->buf; - dir->effective = rc; - } - - dir->retent = dir->curent; - dir->curent = (struct dirent*) ((char *)(dir->curent) + - dir->curent->d_reclen); -#ifdef _DIRENT_HAVE_D_OFF - dir->filepos = dir->curent->d_off; -#else - dir->filepos += dir->curent->d_reclen; -#endif - return dir->retent; -} -sysio_sym_weak_alias(readdir, __readdir); - -#else /* NATURAL_READDIR64 */ - -struct dirent *readdir(DIR *dir) { - return (struct dirent *) readdir64(dir); -} -sysio_sym_weak_alias(readdir, __readdir); - -#endif /* NATURAL_READDIR64 */ - -int closedir(DIR *dir) -{ - int rc; - - rc = close(dir->fd); - - free(dir); - return rc; -} - -sysio_sym_weak_alias(closedir, __closedir); - -int dirfd(DIR *dir) -{ - return dir->fd; -} - -off_t telldir(DIR *dir) -{ - return (dir->filepos); -} - -void seekdir(DIR *dir, off_t offset) -{ - dir->filepos = offset; - - dir->base = offset; - dir->curent64 = (struct dirent64 *) dir->buf; - dir->retent64 = NULL; - dir->effective = 0; - dir->curent = (struct dirent *) dir->buf; - dir->retent = NULL; -} - -void rewinddir(DIR *dir) -{ - dir->base = 0; - dir->filepos = 0; - dir->curent64 = (struct dirent64 *) dir->buf; - dir->retent64 = NULL; - dir->curent = (struct dirent *) dir->buf; - dir->retent = NULL; - dir->effective = 0; -} - -#if 0 -int scandir(const char *dir, struct dirent ***namelist, - int(*select)(const struct dirent *), - int(*compar)(const void *, const void *)) -{ - errno = ENOSYS; - return -1; -} - -int scandir64(const char *dir, struct dirent64 ***namelist, - int(*select)(const struct dirent64 *), - int(*compar)(const void *, const void *)) -{ - errno = ENOSYS; - return -1; -} -#endif - /*********************************************************** * FIXME workaround for linux only * ***********************************************************/ |
From: Ruth K. <rk...@us...> - 2004-08-30 15:58:10
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/include Modified Files: module.mk Added Files: stddir.h Log Message: Changes to officially import directory functions into sysio. This is necessitated by the glibc >= 2.3 hidden attribute on getdents. (ifdef'd out for Red Storm build) --- 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... */ /* * Support for directory functions */ #ifndef _STDDIR_H_ #define _STDDIR_H_ #undef BUFSIZE #define BUFSIZE 4096 struct __dirstream { int fd; _SYSIO_OFF_T base; /* start pos for next system call */ _SYSIO_OFF_T filepos; /* current pos in dir file stream */ size_t cur; /* current byte pos in data buffer */ size_t effective; /* effective data size in buffer */ char buf[BUFSIZE]; }; #ifndef MAX #define MAX(a,b) (a) > (b) ? (a) : (b) #endif #endif /* ! _STDDIR_H_ */ Index: module.mk =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/module.mk,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- module.mk 6 Feb 2004 20:07:29 -0000 1.2 +++ module.mk 30 Aug 2004 15:58:00 -0000 1.3 @@ -1,4 +1,4 @@ INCLUDE_EXTRA = include/dev.h include/file.h include/fs.h \ include/inode.h include/mount.h include/sysio.h \ include/sysio-symbols.h include/cplant-yod.h \ - include/module.mk include/xtio.h + include/module.mk include/xtio.h include/stddir.h |
From: Ruth K. <rk...@us...> - 2004-08-30 15:58:09
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24062/drivers/yod Modified Files: fs_yod.c Log Message: Changes to officially import directory functions into sysio. This is necessitated by the glibc >= 2.3 hidden attribute on getdents. (ifdef'd out for Red Storm build) Index: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- fs_yod.c 26 Jul 2004 17:10:15 -0000 1.17 +++ fs_yod.c 30 Aug 2004 15:58:00 -0000 1.18 @@ -747,10 +747,10 @@ static ssize_t yod_getdirentries(struct inode *ino, char *buf, size_t nbytes, - off64_t *basep) + _SYSIO_OFF_T *basep) { struct yod_inode *nino = I2NI(ino); - loff_t result; + _SYSIO_OFF_T result; ssize_t cc; assert(nino->ni_fd >= 0); @@ -762,10 +762,11 @@ yod_getdirentries(struct inode *ino, SEEK_SET) == -1)) return -errno; nino->ni_fpos = result; + memset(buf, 0, nbytes); cc = getdirentries_yod(nino->ni_fd, buf, nbytes, &result); if (cc < 0) return -errno; - nino->ni_fpos += cc; + nino->ni_fpos = *basep = result; return cc; } |
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: Lee W. <lw...@us...> - 2004-08-27 18:11:37
|
Update of /cvsroot/libsysio/libsysio/drivers/incore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31294/drivers/incore Modified Files: fs_incore.c Log Message: Cray SPR 729924. Bad return values. Was returning the negated error code instead of -1. Fixed. Index: fs_incore.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/incore/fs_incore.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- fs_incore.c 26 Jul 2004 17:09:21 -0000 1.20 +++ fs_incore.c 27 Aug 2004 18:11:24 -0000 1.21 @@ -165,7 +165,7 @@ static void _sysio_incore_inop_gone(stru #define _sysio_incore_dirop_symlink \ (int (*)(struct pnode *, const char *))_sysio_do_enosys #define _sysio_incore_dirop_readlink \ - (int (*)(struct pnode *, char *, size_t))_sysio_do_einval + (int (*)(struct pnode *, char *, size_t))_sysio_do_enosys #define _sysio_incore_dirop_read \ (int (*)(struct inode *, \ struct ioctx *))_sysio_do_eisdir |
From: Lee W. <lw...@us...> - 2004-08-27 18:10:15
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31039/src Modified Files: inode.c Log Message: Added fcntl call. It was, inappropriately, going to the supporting file system driver. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- inode.c 27 Jul 2004 15:00:43 -0000 1.19 +++ inode.c 27 Aug 2004 18:10:05 -0000 1.20 @@ -254,6 +254,7 @@ _sysio_i_new(struct filesys *fs, operations.inop_write = o->inop_write; operations.inop_pos = o->inop_pos; operations.inop_iodone = o->inop_iodone; + operations.inop_fcntl = o->inop_fcntl; operations.inop_datasync = o->inop_datasync; operations.inop_ioctl = o->inop_ioctl; } |
From: Lee W. <lw...@us...> - 2004-08-27 18:10:15
|
Update of /cvsroot/libsysio/libsysio/dev/stdfd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31039/dev/stdfd Modified Files: stdfd.c Log Message: Added fcntl call. It was, inappropriately, going to the supporting file system driver. Index: stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/dev/stdfd/stdfd.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- stdfd.c 3 Jul 2004 05:47:12 -0000 1.9 +++ stdfd.c 27 Aug 2004 18:10:05 -0000 1.10 @@ -78,6 +78,7 @@ static int stdfd_read(struct inode *ino, static int stdfd_write(struct inode *ino, struct ioctx *ioctx); static int stdfd_iodone(struct ioctx *ioctx); static int stdfd_datasync(struct inode *ino); +static int stdfd_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn); static int stdfd_ioctl(struct inode *ino, unsigned long int request, va_list ap); @@ -93,6 +94,7 @@ _sysio_stdfd_init() stdfd_operations.inop_read = stdfd_read; stdfd_operations.inop_write = stdfd_write; stdfd_operations.inop_iodone = stdfd_iodone; + stdfd_operations.inop_fcntl = stdfd_fcntl; stdfd_operations.inop_datasync = stdfd_datasync; stdfd_operations.inop_ioctl = stdfd_ioctl; @@ -195,6 +197,17 @@ stdfd_iodone(struct ioctx *iocp __IS_UNU } static int +stdfd_fcntl(struct inode *ino __IS_UNUSED, + int cmd __IS_UNUSED, + va_list ap __IS_UNUSED, + int *rtn) +{ + + *rtn = -1; + return -EINVAL; +} + +static int stdfd_datasync(struct inode *ino __IS_UNUSED) { |
From: Lee W. <lw...@us...> - 2004-08-26 09:03:11
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20651 Modified Files: rename.c Log Message: Fixed many bugs in rename. This is a complex function. Should be right now. I was carefuly this time. Really, I promise :-) Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- rename.c 9 Aug 2004 14:30:00 -0000 1.8 +++ rename.c 26 Aug 2004 09:03:03 -0000 1.9 @@ -65,18 +65,30 @@ SYSIO_INTERFACE_NAME(rename)(const char SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; + + /* + * Neither old nor new may be the empty string. + */ + if (*oldpath == '\0' || *newpath == '\0') + SYSIO_INTERFACE_RETURN(-1, -ENOENT); + /* * Resolve oldpath to a path node. */ INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); - err = _sysio_namei(_sysio_cwd, oldpath, 0, &intent, &old); + err = _sysio_namei(_sysio_cwd, oldpath, ND_NOFOLLOW, &intent, &old); if (err) goto error3; /* * Resolve newpath to a path node. */ INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); - err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &new); + err = + _sysio_namei(_sysio_cwd, + newpath, + ND_NOFOLLOW | ND_NEGOK, + &intent, + &new); if (err) goto error2; @@ -109,6 +121,12 @@ SYSIO_INTERFACE_NAME(rename)(const char } } while (nxtpb); + /* + * If old == new, we're done. + */ + if (old->p_base->pb_ino == new->p_base->pb_ino) + goto out; + while (new->p_base->pb_ino) { /* * Existing entry. We're replacing the new. Make sure that's @@ -129,17 +147,17 @@ SYSIO_INTERFACE_NAME(rename)(const char (void )_sysio_p_validate(new, NULL, NULL); continue; } - if (S_ISDIR(ostbuf.st_mode)) { - if (!S_ISDIR(nstbuf.st_mode)) { - err = -ENOTDIR; + if (S_ISDIR(nstbuf.st_mode)) { + if (!S_ISDIR(ostbuf.st_mode)) { + err = -EISDIR; goto error1; } if (nstbuf.st_nlink > 2) { err = -ENOTEMPTY; goto error1; } - } else if (S_ISDIR(nstbuf.st_mode)) { - err = -EEXIST; + } else if (S_ISDIR(ostbuf.st_mode)) { + err = -ENOTDIR; goto error1; } break; @@ -151,7 +169,7 @@ SYSIO_INTERFACE_NAME(rename)(const char * now. If it becomes an issue, we can do it later. For now, I've * elected to use the semantic that says, basically, the entire * sub-tree must be unreferenced. That's per POSIX, but it's a nasty - * this to do to the caller. + * thing to do to the caller. */ if (_sysio_p_prune(new) != 1) { err = -EBUSY; |
From: Lee W. <lw...@us...> - 2004-08-26 09:02:37
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20538 Modified Files: chdir.c Log Message: Fixed error return for zero length buffer specification. Now returns EINVAL as it should. Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- chdir.c 27 Jul 2004 15:00:43 -0000 1.19 +++ chdir.c 26 Aug 2004 09:02:28 -0000 1.20 @@ -154,6 +154,9 @@ _sysio_p_path(struct pnode *pno, char ** cur = pno; + if (!size) + return -EINVAL; + /* * Walk up the tree to the root, summing the component name * lengths and counting the vertices. |
From: Lee W. <lw...@us...> - 2004-08-25 08:07:54
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14222 Modified Files: fs_native.c Log Message: Why do folks keep screwing up the formatting in the source? Fixed here from the last change. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -w -b -B -p -r1.46 -r1.47 |
From: Lee W. <le...@sa...> - 2004-08-13 15:27:36
|
Let the lower levels fail. Seriously, as I said, there is *nothing* in SYSIO that requires such a check. --Lee On Fri, 2004-08-13 at 11:02, Sonja Tideman wrote: > Update of /cvsroot/libsysio/libsysio/drivers/native > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/drivers/native > > Modified Files: > fs_native.c > Log Message: > Try 2: take out the MAX_IOVEC references, revert fs_native.c back to > its > original form (which still has the MAX_IOVEC references, but it > defines > it and undefines it within one routine...although this still means > that > someone can define MAX_IOVEC and force the call to > _sysio_enumerate_iovec > instead of the syscall, but that doesn't place any strict limit on the > number of iovecs) > > > Index: fs_native.c > =================================================================== > RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v > retrieving revision 1.45 > retrieving revision 1.46 > diff -u -w -b -B -p -r1.45 -r1.46 > --- fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 > +++ fs_native.c 13 Aug 2004 15:02:50 -0000 1.46 > @@ -1398,6 +1398,10 @@ doiov(const struct iovec *iov, > { > ssize_t cc; > > +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) > +#define MAX_IOVEC INT_MAX > +#endif > + > > if (count <= 0) > return -EINVAL; > @@ -1422,11 +1426,7 @@ doiov(const struct iovec *iov, > */ > cc = > #ifndef REDSTORM > -#ifdef MAX_IOVEC > count <= MAX_IOVEC > -#else > - count <= INT_MAX > -#endif > ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, > nio->nio_nino->ni_fd, > iov, > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Libsysio-commit mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libsysio-commit > |
From: Sonja T. <so...@us...> - 2004-08-13 15:02:59
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/src Modified Files: rw.c Log Message: Try 2: take out the MAX_IOVEC references, revert fs_native.c back to its original form (which still has the MAX_IOVEC references, but it defines it and undefines it within one routine...although this still means that someone can define MAX_IOVEC and force the call to _sysio_enumerate_iovec instead of the syscall, but that doesn't place any strict limit on the number of iovecs) Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- rw.c 13 Aug 2004 14:40:09 -0000 1.13 +++ rw.c 13 Aug 2004 15:02:50 -0000 1.14 @@ -689,11 +689,6 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ireadx)) if ((iov_count == 0) || (xtv_count == 0)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#ifdef MAX_IOVEC - if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) - SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#endif - err = _sysio_iiox(IIOXOP_READ(fil->f_ino), fil, @@ -734,12 +729,6 @@ SYSIO_INTERFACE_NAME(ireadx)(int fd, if ((iov_count == 0) || (xtv_count == 0)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#ifdef MAX_IOVEC - if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) - SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#endif - - ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |
From: Sonja T. <so...@us...> - 2004-08-13 15:02:59
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/drivers/native Modified Files: fs_native.c Log Message: Try 2: take out the MAX_IOVEC references, revert fs_native.c back to its original form (which still has the MAX_IOVEC references, but it defines it and undefines it within one routine...although this still means that someone can define MAX_IOVEC and force the call to _sysio_enumerate_iovec instead of the syscall, but that doesn't place any strict limit on the number of iovecs) Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -w -b -B -p -r1.45 -r1.46 --- fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 +++ fs_native.c 13 Aug 2004 15:02:50 -0000 1.46 @@ -1398,6 +1398,10 @@ doiov(const struct iovec *iov, { ssize_t cc; +#if !(defined(REDSTORM) || defined(MAX_IOVEC)) +#define MAX_IOVEC INT_MAX +#endif + if (count <= 0) return -EINVAL; @@ -1422,11 +1426,7 @@ doiov(const struct iovec *iov, */ cc = #ifndef REDSTORM -#ifdef MAX_IOVEC count <= MAX_IOVEC -#else - count <= INT_MAX -#endif ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, nio->nio_nino->ni_fd, iov, |
From: Lee W. <le...@sa...> - 2004-08-13 14:46:31
|
This doesn't look right. How about just let it fail on the malloc... Should return ENOMEM, right? That's good enuff. As far as I know, there is no limit in libsysio for the count of the iovec or xtvec. --Lee On Fri, 2004-08-13 at 10:40, Sonja Tideman wrote: > Update of /cvsroot/libsysio/libsysio/drivers/native > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/drivers/native > > Modified Files: > fs_native.c > Log Message: > Removed definition of MAX_IOVEC from fs_native.c > > Fixed ireadx to verify the iov_counts and xtv_counts are valid > > > Index: fs_native.c > =================================================================== > RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v > retrieving revision 1.44 > retrieving revision 1.45 > diff -u -w -b -B -p -r1.44 -r1.45 > --- fs_native.c 5 Aug 2004 18:29:57 -0000 1.44 > +++ fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 > @@ -1398,9 +1398,6 @@ doiov(const struct iovec *iov, > { > ssize_t cc; > > -#if !(defined(REDSTORM) || defined(MAX_IOVEC)) > -#define MAX_IOVEC INT_MAX > -#endif > > if (count <= 0) > return -EINVAL; > @@ -1425,7 +1422,11 @@ doiov(const struct iovec *iov, > */ > cc = > #ifndef REDSTORM > +#ifdef MAX_IOVEC > count <= MAX_IOVEC > +#else > + count <= INT_MAX > +#endif > ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, > nio->nio_nino->ni_fd, > iov, > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Libsysio-commit mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libsysio-commit > |
From: Sonja T. <so...@us...> - 2004-08-13 14:40:18
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/drivers/native Modified Files: fs_native.c Log Message: Removed definition of MAX_IOVEC from fs_native.c Fixed ireadx to verify the iov_counts and xtv_counts are valid Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -w -b -B -p -r1.44 -r1.45 --- fs_native.c 5 Aug 2004 18:29:57 -0000 1.44 +++ fs_native.c 13 Aug 2004 14:40:09 -0000 1.45 @@ -1398,9 +1398,6 @@ doiov(const struct iovec *iov, { ssize_t cc; -#if !(defined(REDSTORM) || defined(MAX_IOVEC)) -#define MAX_IOVEC INT_MAX -#endif if (count <= 0) return -EINVAL; @@ -1425,7 +1422,11 @@ doiov(const struct iovec *iov, */ cc = #ifndef REDSTORM +#ifdef MAX_IOVEC count <= MAX_IOVEC +#else + count <= INT_MAX +#endif ? syscall(nio->nio_op == 'r' ? SYS_readv : SYS_writev, nio->nio_nino->ni_fd, iov, |
From: Sonja T. <so...@us...> - 2004-08-13 14:40:18
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/src Modified Files: rw.c Log Message: Removed definition of MAX_IOVEC from fs_native.c Fixed ireadx to verify the iov_counts and xtv_counts are valid Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- rw.c 27 Jul 2004 15:00:48 -0000 1.12 +++ rw.c 13 Aug 2004 14:40:09 -0000 1.13 @@ -682,9 +682,18 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ireadx)) SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + +#ifdef MAX_IOVEC + if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); +#endif + err = _sysio_iiox(IIOXOP_READ(fil->f_ino), fil, @@ -717,9 +726,20 @@ SYSIO_INTERFACE_NAME(ireadx)(int fd, SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + +#ifdef MAX_IOVEC + if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); +#endif + + ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |
From: Lee W. <lw...@us...> - 2004-08-09 15:33:12
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21795 Modified Files: startup.c Log Message: If SYSIO_CWD is set in the environment, the internal current working directory will be set to the value. Index: startup.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/startup.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- startup.c 3 Jul 2004 05:52:07 -0000 1.5 +++ startup.c 9 Aug 2004 15:33:03 -0000 1.6 @@ -23,14 +23,24 @@ _test_sysio_startup() return err; s = getenv("SYSIO_NAMESPACE"); if (s) - return _sysio_boot(s); - s = getenv("SYSIO_MANUAL"); - if (s) - return 0; + err = _sysio_boot(s); + else if (!(s = getenv("SYSIO_MANUAL"))) { /* * Assume a native mount at root. */ - return _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + err = _sysio_boot("{mnt,dev=\"native:/\",dir=/,fl=0}"); + } + if (err) + return err; + + s = getenv("SYSIO_CWD"); + if (s) { + err = chdir(s); + if (err) + return err; + } + + return 0; } void |
From: Lee W. <lw...@us...> - 2004-08-09 15:30:28
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20858 Modified Files: lseek.c Log Message: Cray SPR_729670: lseek is not checking whence arg. Returns errno 1 instead of errno 22. _sysio_lseek is an internal function but was crafted as an external. It returned API compliant return and set errno accordingly. All callers, though, expected errno or return value. Fixed. Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- lseek.c 27 Jul 2004 15:00:48 -0000 1.23 +++ lseek.c 9 Aug 2004 15:30:06 -0000 1.24 @@ -60,9 +60,7 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset struct file *fil; _SYSIO_OFF_T off, pos; struct intnl_stat stbuf; - SYSIO_INTERFACE_DISPLAY_BLOCK; - SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); if (!fil) return -EBADF; @@ -85,42 +83,58 @@ _sysio_lseek(int fd, _SYSIO_OFF_T offset fil->f_ino, &stbuf); if (err) - SYSIO_INTERFACE_RETURN((off_t )-1, (int )err); + return err; } off = stbuf.st_size; break; default: - SYSIO_INTERFACE_RETURN((off_t )-1, -EINVAL); + return -EINVAL; } pos = off + offset; if ((offset < 0 && -offset > off) || (offset > 0 && pos <= off)) - SYSIO_INTERFACE_RETURN((off_t )-1, -EINVAL); + return -EINVAL; #ifdef O_LARGEFILE if (pos >= ((fil->f_flags & O_LARGEFILE) ? _SYSIO_OFF_T_MAX : LONG_MAX)) - SYSIO_INTERFACE_RETURN((off_t )-1, -EOVERFLOW); + return -EOVERFLOW; #else if (pos >= _SYSIO_OFF_T_MAX) - SYSIO_INTERFACE_RETURN((off_t )-1, -EOVERFLOW); + return -EOVERFLOW; #endif pos = (fil->f_ino->i_ops.inop_pos)(fil->f_ino, pos); if (pos < 0) - SYSIO_INTERFACE_RETURN((off_t )-1, (int )pos); + return pos; fil->f_pos = pos; - SYSIO_INTERFACE_RETURN((off_t )pos, 0); + return pos; } #if _LARGEFILE64_SOURCE #undef lseek64 -sysio_sym_weak_alias(_sysio_lseek, SYSIO_INTERFACE_NAME(lseek64)) + +extern off64_t +SYSIO_INTERFACE_NAME(lseek64)(int fd, off64_t offset, int whence) +{ + _SYSIO_OFF_T off; + off_t rtn; + SYSIO_INTERFACE_DISPLAY_BLOCK; + + SYSIO_INTERFACE_ENTER; + off = _sysio_lseek(fd, offset, whence); + if (off < 0) + SYSIO_INTERFACE_RETURN((off_t )-1, (int )off); + rtn = (off64_t )off; + assert(rtn == off); + SYSIO_INTERFACE_RETURN(rtn, 0); +} #ifdef __GLIBC__ #undef __lseek64 -sysio_sym_weak_alias(_sysio_lseek, PREPEND(__, SYSIO_INTERFACE_NAME(lseek64))) +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(lseek64), + PREPEND(__, SYSIO_INTERFACE_NAME(lseek64))) #endif #ifdef REDSTORM #undef __libc_lseek64 -sysio_sym_weak_alias(_sysio_lseek, +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(lseek64), PREPEND(__, SYSIO_INTERFACE_NAME(libc_lseek64))) #endif #endif |
From: Lee W. <lw...@us...> - 2004-08-09 14:30:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9459 Modified Files: rename.c Log Message: From Cray SPR_729681, Sue Kelly, and Kevin Pedretti: A long file name given as target causes a seg fault. The error condition check included the returned "new" pnode. This was not being altered in the path lookup, so contained garbage. That would allow the routine to proceed, dereferencing the garbage pointer. Fixed. Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- rename.c 27 Jul 2004 15:00:48 -0000 1.7 +++ rename.c 9 Aug 2004 14:30:00 -0000 1.8 @@ -77,7 +77,7 @@ SYSIO_INTERFACE_NAME(rename)(const char */ INTENT_INIT(&intent, INT_UPDPARENT, NULL, NULL); err = _sysio_namei(_sysio_cwd, newpath, ND_NEGOK, &intent, &new); - if (err && !new) + if (err) goto error2; if (old->p_mount->mnt_root == old || old->p_cover || |