libsysio-commit Mailing List for libsysio (Page 16)
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: Lee W. <lw...@us...> - 2006-02-08 17:17:51
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3483/src Modified Files: namei.c Log Message: The startup code in the tests directory should process the namespace initialization variable before the initial working directory. Fixed. From ClusterFS bugzilla #10114; When compiled to support an initial working directory that is deferred until needed, a chdir to a non-existent directory would cause an abort. This behavior is per design. Not technically a bug. However, it's very unfriendly. Especially so, since the accepted thing to do in this situation is to just leave the current working directory at the root of the namespace. This change, then, alters the behavior to the commonly accepted. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- namei.c 15 Sep 2005 19:29:02 -0000 1.18 +++ namei.c 8 Feb 2006 17:17:43 -0000 1.19 @@ -186,19 +186,22 @@ _sysio_path_walk(struct pnode *parent, s if (!parent) { const char *icwd; - if (!_sysio_init_cwd) + if (!_sysio_init_cwd && !nd->nd_root) abort(); /* - * Finally have to set the curretn working directory. We can + * Finally have to set the current working directory. We can * not tolerate errors here or else risk leaving the process * in a very unexpected location. We abort then unless all goes * well. */ icwd = _sysio_init_cwd; _sysio_init_cwd = NULL; - if (_sysio_namei(NULL, icwd, 0, NULL, &parent) != 0 || - _sysio_p_chdir(parent) != 0) + parent = nd->nd_root; + if (!parent) + abort(); + (void )_sysio_namei(nd->nd_root, icwd, 0, NULL, &parent); + if (_sysio_p_chdir(parent) != 0) abort(); } #endif |
From: Lee W. <lw...@us...> - 2006-01-18 00:48:01
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11788 Modified Files: init.c Log Message: Add comments to init files; From Cray. A hash, '#', symbol begins a comment that reads to the end of the line. Since the init configuration language is not line-based, though, this is dangerous. Just be *real* careful to terminate with a newline. Also, this only works *outside* a specification -- The '{' to '}' groupings. Used inside, it's a parsed character and would almost certainly err. Unfortunately, the precedent is set and it's too difficult to back out now. Beware! Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- init.c 18 Sep 2005 17:44:45 -0000 1.24 +++ init.c 18 Jan 2006 00:47:41 -0000 1.25 @@ -128,6 +128,12 @@ void *_sysio_exit_trace_q = &_sysio_exit #endif /* + * In sysio_init we'll allow simple comments, strings outside {} + * delimited by COMMENT_INTRO, and '\n' or '\0' + */ +#define COMMENT_INTRO '#' + +/* * Sysio library initialization. Must be called before anything else in the * library. */ @@ -958,6 +964,16 @@ _sysio_boot_namespace(const char *arg) while ((c = *arg) != '\0' && !(c == '{' || strchr(IGNORE_WHITE, c) == NULL)) arg++; + if (COMMENT_INTRO == c) { + /* + * Discard comment. + */ + while (*arg && (*arg != '\n')) { + ++arg; + } + continue; + } + if (c == '\0') break; if (c != '{') { |
From: Lee W. <lw...@us...> - 2006-01-18 00:42:48
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10543 Modified Files: open.c Log Message: Emulate Linux behavior with the O_NOFOLLOW flag to open(). Index: open.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/open.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -w -b -B -p -r1.25 -r1.26 --- open.c 3 Aug 2005 13:46:10 -0000 1.25 +++ open.c 18 Jan 2006 00:42:41 -0000 1.26 @@ -112,6 +112,10 @@ _sysio_open(struct pnode *pno, int flags err = -EEXIST; else if (!ino) err = _sysio_p_validate(pno, NULL, NULL); +#ifdef O_NOFOLLOW + else if (flags & O_NOFOLLOW && S_ISLNK(ino->i_stbuf.st_mode)) + err = -ELOOP; +#endif else { /* * Simple open of pre-existing file. |
From: Lee W. <lw...@us...> - 2006-01-05 15:27:38
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12551 Modified Files: sysio-cmn.h Log Message: The PREPEND macro needs to be defined always in order to support compilation without alternate-symbols set. From Oleg Drokin at Cluster FS. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- sysio-cmn.h 19 Oct 2005 19:30:56 -0000 1.8 +++ sysio-cmn.h 5 Jan 2006 15:27:31 -0000 1.9 @@ -90,13 +90,17 @@ struct intnl_xtvec; struct iovec; /* - * SYSIO name label macros + * Symbol composition. */ -#ifdef SYSIO_LABEL_NAMES #define _PREPEND_HELPER(p, x) \ p ## x #define PREPEND(p, x) \ _PREPEND_HELPER(p, x) + +/* + * SYSIO name label macros + */ +#ifdef SYSIO_LABEL_NAMES #define SYSIO_INTERFACE_NAME(x) \ PREPEND(SYSIO_LABEL_NAMES, x) #else |
From: Lee W. <lw...@us...> - 2006-01-04 13:16:28
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv890 Modified Files: file_hack.c Log Message: File new/gone routines weren't referencing and releasing, respectively, the associated inode. Fixed. From Oleg Drokin at Cluster FS. Index: file_hack.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/file_hack.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- file_hack.c 16 Jun 2005 21:14:52 -0000 1.9 +++ file_hack.c 4 Jan 2006 13:16:18 -0000 1.10 @@ -107,6 +107,7 @@ _sysio_fnew(struct inode *ino, int flags _SYSIO_FINIT(fil, ino, flags); F_REF(fil); + I_REF(ino); return fil; } @@ -122,6 +123,7 @@ _sysio_fgone(struct file *fil) assert(!fil->f_ref); assert(fil->f_ino); err = (*fil->f_ino->i_ops.inop_close)(fil->f_ino); + I_RELE(fil->f_ino); assert(!err); free(fil); } |
From: Lee W. <lw...@us...> - 2006-01-03 13:39:08
|
Update of /cvsroot/libsysio/libsysio/drivers/sockets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12476/drivers/sockets Modified Files: sockets.c Log Message: Unsed variable warnings found by gcc 4.0.2 are fixed. Index: sockets.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/sockets/sockets.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- sockets.c 25 Jan 2005 18:16:01 -0000 1.14 +++ sockets.c 3 Jan 2006 13:38:59 -0000 1.15 @@ -523,7 +523,9 @@ SYSIO_INTERFACE_NAME(bind)(int sockfd, { int err; struct file *fil; +#ifdef SYSIO_SYS_socketcall unsigned long avec[3]; +#endif err = 0; @@ -559,7 +561,9 @@ SYSIO_INTERFACE_NAME(listen)(int s, int { int err; struct file *fil; +#ifdef SYSIO_SYS_socketcall unsigned long avec[2]; +#endif err = 0; @@ -595,7 +599,9 @@ SYSIO_INTERFACE_NAME(connect)(int sockfd { int err; struct file *fil; +#ifdef SYSIO_SYS_socketcall unsigned long avec[3]; +#endif err = 0; |
From: Lee W. <lw...@us...> - 2006-01-03 13:33:17
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11065 Modified Files: test_path.c Log Message: Passing character sount (a ssize_t) to printf as a length specifier was incorrect. It should be an int. Fixed via cast. Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- test_path.c 28 Oct 2005 16:42:26 -0000 1.12 +++ test_path.c 3 Jan 2006 13:33:06 -0000 1.13 @@ -208,7 +208,7 @@ statit(const char *path) } (void )printf("%s: %c", path, t); if (S_ISLNK(stbuf.st_mode) && (size_t )cc < sizeof(buf)) - (void )printf(" %.*s", cc, buf); + (void )printf(" %.*s", (int )cc, buf); (void )putchar('\n'); return 0; |
From: Lee W. <lw...@us...> - 2006-01-03 13:26:43
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9081 Modified Files: file.c Log Message: The fnew and fgone routines were not referencing and releasing, respectively, the inode. Fixed. From Oleg Drokin at Cluster FS. Index: file.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/file.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- file.c 16 Jun 2005 21:14:40 -0000 1.19 +++ file.c 3 Jan 2006 13:26:33 -0000 1.20 @@ -76,6 +76,7 @@ _sysio_fnew(struct inode *ino, int flags _SYSIO_FINIT(fil, ino, flags); F_REF(fil); + I_REF(fil->f_ino); return fil; } @@ -92,6 +93,7 @@ _sysio_fgone(struct file *fil) assert(fil->f_ino); err = (*fil->f_ino->i_ops.inop_close)(fil->f_ino); assert(!err); + I_RELE(fil->f_ino); free(fil); } |
From: Lee W. <lw...@us...> - 2006-01-03 13:05:41
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3827 Modified Files: fcntl.c Log Message: Fix problem in case with duplicate labels when the LK calls are the same as the LK64 calls. For instance, with a 64-bit processor. From Oleg Drokin at Cluster FS. Thanks! Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- fcntl.c 28 Oct 2005 17:59:31 -0000 1.23 +++ fcntl.c 3 Jan 2006 13:05:29 -0000 1.24 @@ -193,6 +193,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a } } break; +#if !(_LARGEFILE64_SOURCE || F_GETLK64 == F_GETLK) case F_GETLK: case F_SETLK: case F_SETLKW: @@ -248,6 +249,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a rtn = 0; } break; +#endif /* !(_LARGEFILE64_SOURCE || F_GETLK64 == F_GETLK) */ #if _LARGEFILE64_SOURCE case F_GETLK64: case F_SETLK64: |
From: Lee W. <lw...@us...> - 2005-10-31 19:47:50
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8158/include Modified Files: file.h Log Message: Extracting the inode pointer from the file reference is no longer necessary when dereferencing a handle. That code is removed. Index: file.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/file.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- file.h 28 Oct 2005 17:59:31 -0000 1.12 +++ file.h 31 Oct 2005 19:47:42 -0000 1.13 @@ -93,11 +93,8 @@ struct file { */ #define F_RELE(fil) \ do { \ - struct inode *ino; \ - \ assert((fil)->f_ref); \ (fil)->f_ref--; \ - ino = (fil)->f_ino; \ if (!(fil)->f_ref) \ _sysio_fgone(fil); \ } while (0) |
From: Lee W. <lw...@us...> - 2005-10-31 18:51:08
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28642 Modified Files: configure.in Log Message: Internal API changes visible to the drivers beg an update of the version number. Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- configure.in 19 Oct 2005 19:30:56 -0000 1.21 +++ configure.in 31 Oct 2005 18:50:58 -0000 1.22 @@ -1,4 +1,4 @@ -AC_INIT(libsysio, 1.0) +AC_INIT(libsysio, 1.1) AC_CANONICAL_HOST |
From: Lee W. <lw...@us...> - 2005-10-28 17:59:40
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23911/include Modified Files: file.h sysio.h Log Message: Fixed to properly support fcntl locking with relative offsets. Index: file.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/file.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- file.h 16 Jun 2005 21:14:39 -0000 1.11 +++ file.h 28 Oct 2005 17:59:31 -0000 1.12 @@ -9,7 +9,7 @@ * 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. + * Cplant(TM) Copyright 1998-2005 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 @@ -46,6 +46,28 @@ */ /* + * Test whether large file support on this file. + */ +#ifdef O_LARGEFILE +#define _F_LARGEFILE(fil) \ + ((fil)->f_flags & O_LARGEFILE) +#else +#define _F_LARGEFILE(fil) \ + (1) +#endif +/* + * Return max seek value for this file. + */ +#define _SEEK_MAX(fil) \ + (_F_LARGEFILE(fil) ? _SYSIO_OFF_T_MAX : LONG_MAX) + +#if _LARGEFILE64_SOURCE +#define _SYSIO_FLOCK flock64 +#else +#define _SYSIO_FLOCK flock +#endif + +/* * A file record is maintained for each open file in the system. It holds * all the info necessary to track the context and parameters for the * operations that may be performed. @@ -106,3 +128,7 @@ extern int _sysio_fd_close_all(void); #if ZERO_SUM_MEMORY extern void _sysio_fd_shutdown(void); #endif +extern _SYSIO_OFF_T _sysio_lseek_prepare(struct file *fil, + _SYSIO_OFF_T offset, + int whence, + _SYSIO_OFF_T max); Index: sysio.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -b -B -p -r1.34 -r1.35 --- sysio.h 23 Feb 2005 01:43:08 -0000 1.34 +++ sysio.h 28 Oct 2005 17:59:31 -0000 1.35 @@ -171,6 +171,7 @@ extern int SYSIO_INTERFACE_NAME(close)(i extern int SYSIO_INTERFACE_NAME(dup)(int oldfd); extern int SYSIO_INTERFACE_NAME(dup2)(int oldfd, int newfd); extern int SYSIO_INTERFACE_NAME(fcntl)(int fd, int cmd, ...); +extern int SYSIO_INTERFACE_NAME(fcntl64)(int fd, int cmd, ...); extern int SYSIO_INTERFACE_NAME(fstat)(int fd, struct stat *buf); #if _LARGEFILE64_SOURCE extern int SYSIO_INTERFACE_NAME(fstat64)(int fd, struct stat64 *buf); |
From: Lee W. <lw...@us...> - 2005-10-28 17:59:40
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23911/src Modified Files: fcntl.c lseek.c Log Message: Fixed to properly support fcntl locking with relative offsets. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- fcntl.c 14 Oct 2004 14:59:29 -0000 1.22 +++ fcntl.c 28 Oct 2005 17:59:31 -0000 1.23 @@ -9,7 +9,7 @@ * 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. + * Cplant(TM) Copyright 1998-2005 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 @@ -41,8 +41,11 @@ * le...@sa... */ +#include <string.h> #include <unistd.h> +#include <stdlib.h> #include <errno.h> +#include <assert.h> #include <sys/types.h> #include <fcntl.h> #include <sys/queue.h> @@ -56,9 +59,11 @@ #ifdef HAVE_LUSTRE_HACK #include <syscall.h> #include <native.h> +#endif +#ifdef HAVE_LUSTRE_HACK static int -_sysio_fcntl(int fd, int cmd, va_list ap, int *rtn) +_sysio_lustre_fcntl(int fd, int cmd, va_list ap, int *rtn) { long arg = va_arg(ap, long); @@ -67,13 +72,92 @@ _sysio_fcntl(int fd, int cmd, va_list ap } #endif -int -SYSIO_INTERFACE_NAME(fcntl)(int fd, int cmd, ...) +static int +_sysio_fcntl_raw_call(struct inode *ino, int *r, int cmd, ...) +{ + va_list ap; + int err; + + va_start(ap, cmd); + err = ino->i_ops.inop_fcntl(ino, cmd, ap, r); + va_end(ap); + return err; +} + +/* + * Convert offsets to absolute, when appropriate, and call appropriate driver + * to complete the fcntl lock function. If successful, convert + * returned values back to appropriate form. + */ +static int +_sysio_fcntl_lock(struct file *fil, int cmd, struct _SYSIO_FLOCK *fl) +{ + struct _SYSIO_FLOCK flock; + _SYSIO_OFF_T pos; + int err; + int rtn; + + /* + * The drivers will not have a clue as to the + * current position of the file pointer. We need to + * convert relative whence values to absolute + * file adresses for them, then. + */ + flock = *fl; + switch (flock.l_whence) { + case SEEK_SET: + /* + * At least parameter check this one, too. + */ + case SEEK_CUR: + case SEEK_END: + pos = + _sysio_lseek_prepare(fil, + flock.l_start, + flock.l_whence, + _SEEK_MAX(fil)); + if (pos < 0) + return (int )pos; + flock.l_start = pos; + flock.l_whence = SEEK_SET; + break; + default: + return -EINVAL; + } + err = + _sysio_fcntl_raw_call(fil->f_ino, &rtn, cmd, &flock); + if (err) + return err; + /* + * Ugh, convert back to relative form. + */ + switch (fl->l_whence) { + case SEEK_SET: + break; + case SEEK_CUR: + fl->l_start = flock.l_start; + fl->l_start -= fil->f_pos; + break; + case SEEK_END: + fl->l_start = flock.l_start; + fl->l_start -= + fil->f_ino->i_stbuf.st_size; + break; + default: + abort(); + } + /* + * Return success. + */ + return 0; +} + +static int +_sysio_vfcntl(int fd, int cmd, va_list ap) { int err; int rtn; struct file *fil; - va_list ap; SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; @@ -81,12 +165,9 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int fil = _sysio_fd_find(fd); if (!fil) { #ifdef HAVE_LUSTRE_HACK - va_start(ap, cmd); - err = _sysio_fcntl(fd, cmd, ap, &rtn); - va_end(ap); + err = _sysio_lustre_fcntl(fd, cmd, ap, &rtn); goto out; #else - rtn = -1; err = -EBADF; goto out; @@ -99,9 +180,7 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int { long newfd; - va_start(ap, cmd); newfd = va_arg(ap, long); - va_end(ap); if (newfd != (int )newfd || newfd < 0) { rtn = -1; err = -EBADF; @@ -114,10 +193,77 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int } } break; + case F_GETLK: + case F_SETLK: + case F_SETLKW: + { + struct intnl_stat buf; + struct flock *fl; +#if _LARGEFILE64_SOURCE + struct _SYSIO_FLOCK flock64; +#endif + + /* + * Refresh the cached attributes. + */ + err = + fil->f_ino->i_ops.inop_getattr(NULL, + fil->f_ino, + &buf); + if (err) { + rtn = -1; + break; + } + /* + * Copy args to a temp and normalize. + */ + fl = va_arg(ap, struct flock *); +#if _LARGEFILE64_SOURCE + flock64.l_type = fl->l_type; + flock64.l_whence = fl->l_whence; + flock64.l_start = fl->l_start; + flock64.l_len = fl->l_len; + flock64.l_pid = fl->l_pid; + err = _sysio_fcntl_lock(fil, cmd, &flock64); +#else + err = _sysio_fcntl_lock(fil, cmd, fl); +#endif + if (err < 0) { + rtn = -1; + break; + } +#if _LARGEFILE64_SOURCE + /* + * Copy back. Note that the fcntl_lock call + * should have ensured that no overflow was possible. + */ + fl->l_type = flock64.l_type; + fl->l_whence = flock64.l_whence; + fl->l_start = flock64.l_start; + assert(fl->l_start == flock64.l_start); + fl->l_len = flock64.l_len; + assert(fl->l_len == flock64.l_len); + fl->l_pid = flock64.l_pid; +#endif + rtn = 0; + } + break; +#if _LARGEFILE64_SOURCE + case F_GETLK64: + case F_SETLK64: + case F_SETLKW64: + { + struct flock64 *fl64; + + fl64 = va_arg(ap, struct flock64 *); + err = _sysio_fcntl_lock(fil, cmd, fl64); + if (err) + rtn = -1; + } + break; +#endif default: - va_start(ap, cmd); err = fil->f_ino->i_ops.inop_fcntl(fil->f_ino, cmd, ap, &rtn); - va_end(ap); break; } @@ -125,6 +271,21 @@ out: SYSIO_INTERFACE_RETURN(rtn, err); } +int +SYSIO_INTERFACE_NAME(fcntl)(int fd, int cmd, ...) +{ + va_list ap; + int err; + + va_start(ap, cmd); + err = _sysio_vfcntl(fd, cmd, ap); + va_end(ap); + return err; +} + +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(fcntl), + SYSIO_INTERFACE_NAME(fcntl64)) + #ifdef __GLIBC__ #undef __fcntl sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(fcntl), Index: lseek.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/lseek.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -b -B -p -r1.26 -r1.27 --- lseek.c 2 Aug 2005 21:57:09 -0000 1.26 +++ lseek.c 28 Oct 2005 17:59:31 -0000 1.27 @@ -9,7 +9,7 @@ * 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. + * Cplant(TM) Copyright 1998-2005 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 @@ -55,24 +55,8 @@ #include "sysio-symbols.h" -/* - * Test whether large file support on this file. - */ -#ifdef O_LARGEFILE -#define _SEEK_MAX_TEST(fil) \ - ((fil)->f_flags & O_LARGEFILE) -#else -#define _SEEK_MAX_TEST(fil) \ - (1) -#endif -/* - * Return max seek value for this file. - */ -#define _SEEK_MAX(fil) \ - (_SEEK_MAX_TEST(fil) ? _SYSIO_OFF_T_MAX : LONG_MAX) - -static _SYSIO_OFF_T -_sysio_lseek(struct file *fil, +_SYSIO_OFF_T +_sysio_lseek_prepare(struct file *fil, _SYSIO_OFF_T offset, int whence, _SYSIO_OFF_T max) @@ -116,6 +100,20 @@ _sysio_lseek(struct file *fil, return -EINVAL; if (pos >= max) return -EOVERFLOW; + return pos; +} + +static _SYSIO_OFF_T +_sysio_lseek(struct file *fil, + _SYSIO_OFF_T offset, + int whence, + _SYSIO_OFF_T max) +{ + _SYSIO_OFF_T pos; + + pos = _sysio_lseek_prepare(fil, offset, whence, max); + if (pos < 0) + return pos; pos = (fil->f_ino->i_ops.inop_pos)(fil->f_ino, pos); if (pos < 0) return pos; |
From: Lee W. <lw...@us...> - 2005-10-28 17:59:40
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23911/tests Modified Files: Makefile.am Added Files: test_fcntl_lock.c Log Message: Fixed to properly support fcntl locking with relative offsets. --- 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-2005 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... */ #define _BSD_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" #include "test.h" /* * fcntl lock tests * * Usage: test_fcnt_lock [<path> ...] */ void usage(void); void do_tests(const char *path); int main(int argc, char * const argv[]) { int i; int err; extern int _test_sysio_startup(void); /* * Parse command-line args. */ while ((i = getopt(argc, argv, "")) != -1) switch (i) { default: usage(); } err = _test_sysio_startup(); if (err) { errno = -err; perror("sysio startup"); exit(1); } while (optind < argc) do_tests(argv[optind++]); /* * Clean up. */ _test_sysio_shutdown(); return 0; } void usage() { (void )fprintf(stderr, "Usage: test_fcntl_lock" " source...\n"); exit(1); } void do_tests(const char *path) { int fd; int err; struct flock flock; fd = SYSIO_INTERFACE_NAME(open)(path, O_RDONLY); if (fd < 0) { perror(path); return; } do { flock.l_type = F_RDLCK; flock.l_whence = SEEK_CUR; flock.l_start = 0; flock.l_len = 0; flock.l_pid = 0; err = SYSIO_INTERFACE_NAME(fcntl)(fd, F_SETLK, &flock); if (err) break; flock.l_type = F_UNLCK; err = SYSIO_INTERFACE_NAME(fcntl)(fd, F_SETLK, &flock); if (err) break; } while (0); if (err) perror(path); if (SYSIO_INTERFACE_NAME(close)(fd) != 0) perror(path); } Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- Makefile.am 4 Feb 2005 00:18:52 -0000 1.24 +++ Makefile.am 28 Oct 2005 17:59:31 -0000 1.25 @@ -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_stddir + test_regions test_stddir test_fcntl_lock CLEANFILES=drv_data.c @@ -81,6 +81,10 @@ test_stddir_SOURCES=test_stddir.c $(CMNS test_stddir_CFLAGS=$(CFL) test_stddir_DEPENDENCIES=$(LIBS) +test_fcntl_lock_SOURCES=test_fcntl_lock.c $(CMNSRC) +test_fcntl_lock_CFLAGS=$(CFL) +test_fcntl_lock_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: Lee W. <lw...@us...> - 2005-10-28 16:42:38
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1531 Modified Files: test_unlink.c test_stddir.c test_stats.c test_rename.c test_regions.c test_path.c test_list.c test_link.c test_getcwd.c test_copy.c Log Message: Testing SYSIO_LABEL_NAMES == 1 was improper and prevented the inclusion of the file that supported altered name space definitions. Fixed. Index: test_unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_unlink.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_unlink.c 4 Feb 2005 00:29:26 -0000 1.5 +++ test_unlink.c 28 Oct 2005 16:42:26 -0000 1.6 @@ -52,7 +52,7 @@ #endif #include <sys/uio.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_stddir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stddir.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- test_stddir.c 4 Feb 2005 00:29:26 -0000 1.2 +++ test_stddir.c 28 Oct 2005 16:42:26 -0000 1.3 @@ -49,7 +49,7 @@ #include <dirent.h> #include <sys/types.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- test_stats.c 4 Feb 2005 00:29:26 -0000 1.8 +++ test_stats.c 28 Oct 2005 16:42:26 -0000 1.9 @@ -55,7 +55,7 @@ #endif #include <sys/uio.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_rename.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- test_rename.c 4 Feb 2005 00:29:26 -0000 1.6 +++ test_rename.c 28 Oct 2005 16:42:26 -0000 1.7 @@ -52,7 +52,7 @@ #include <fcntl.h> #include <sys/uio.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_regions.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_regions.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- test_regions.c 4 Feb 2005 00:29:26 -0000 1.6 +++ test_regions.c 28 Oct 2005 16:42:26 -0000 1.7 @@ -65,7 +65,7 @@ #include <fcntl.h> #include <sys/uio.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- test_path.c 4 Feb 2005 00:29:26 -0000 1.11 +++ test_path.c 28 Oct 2005 16:42:26 -0000 1.12 @@ -52,7 +52,7 @@ #include <unistd.h> #include <sys/uio.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- test_list.c 4 Aug 2005 19:48:49 -0000 1.11 +++ test_list.c 28 Oct 2005 16:42:26 -0000 1.12 @@ -55,7 +55,7 @@ #include <sys/uio.h> #include <sys/queue.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_link.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- test_link.c 4 Feb 2005 00:29:26 -0000 1.4 +++ test_link.c 28 Oct 2005 16:42:26 -0000 1.5 @@ -54,7 +54,7 @@ #include <sys/uio.h> #include <sys/queue.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- test_getcwd.c 4 Feb 2005 00:29:26 -0000 1.6 +++ test_getcwd.c 28 Oct 2005 16:42:26 -0000 1.7 @@ -53,7 +53,7 @@ #include <sys/queue.h> #include <dirent.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- test_copy.c 9 Feb 2005 14:00:27 -0000 1.12 +++ test_copy.c 28 Oct 2005 16:42:26 -0000 1.13 @@ -53,7 +53,7 @@ #include <sys/uio.h> #include <sys/queue.h> -#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#if defined(SYSIO_LABEL_NAMES) #include "sysio.h" #endif #include "xtio.h" |
From: Ruth K. <rk...@us...> - 2005-10-24 18:21:10
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4516 Modified Files: fs_native.c Log Message: define variable for sys_getdirentries call Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -w -b -B -p -r1.57 -r1.58 --- fs_native.c 19 Oct 2005 19:25:33 -0000 1.57 +++ fs_native.c 24 Oct 2005 18:20:37 -0000 1.58 @@ -959,6 +959,9 @@ native_ifilldirentries(struct native_ino { int err; ssize_t cc; +#if defined(SYSIO_SYS_getdirentries) + _SYSIO_OFF_T waste; +#endif if (*posp < 0) return -EINVAL; |
From: Lee W. <lw...@us...> - 2005-10-19 19:31:07
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3658/include Modified Files: sysio-cmn.h Log Message: Merge in with-alternate-symbols modifications from LLNL_HPSS branch. This allows prepending public symbols with something other than "sysio_". However, the changes are backward compatible. I.e., the default is still to use "sysio_". Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- sysio-cmn.h 15 Sep 2005 21:46:23 -0000 1.7 +++ sysio-cmn.h 19 Oct 2005 19:30:56 -0000 1.8 @@ -92,13 +92,13 @@ struct iovec; /* * SYSIO name label macros */ -#define XPREPEND(p,x) p ## x -#define PREPEND(p,x) XPREPEND(p,x) -#ifndef SYSIO_LABEL_NAMES -#define SYSIO_LABEL_NAMES 0 -#endif -#if SYSIO_LABEL_NAMES -#define SYSIO_INTERFACE_NAME(x) PREPEND(sysio_, x) +#ifdef SYSIO_LABEL_NAMES +#define _PREPEND_HELPER(p, x) \ + p ## x +#define PREPEND(p, x) \ + _PREPEND_HELPER(p, x) +#define SYSIO_INTERFACE_NAME(x) \ + PREPEND(SYSIO_LABEL_NAMES, x) #else #define SYSIO_INTERFACE_NAME(x) x #endif |
From: Lee W. <lw...@us...> - 2005-10-19 19:31:07
|
Update of /cvsroot/libsysio/libsysio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3658 Modified Files: Rules.make configure.in Log Message: Merge in with-alternate-symbols modifications from LLNL_HPSS branch. This allows prepending public symbols with something other than "sysio_". However, the changes are backward compatible. I.e., the default is still to use "sysio_". Index: Rules.make =================================================================== RCS file: /cvsroot/libsysio/libsysio/Rules.make,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- Rules.make 18 Nov 2004 13:00:44 -0000 1.10 +++ Rules.make 19 Oct 2005 19:30:56 -0000 1.11 @@ -16,4 +16,4 @@ AM_CPPFLAGS = \ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=600 \ $(TRACING) \ $(AUTOMOUNT) $(ZERO_SUM_MEMORY) $(DEV_CPPFLAGS) $(SOCKETS_CPPFLAGS) \ - $(DEFER_INIT_CWD) -I$(top_srcdir)/include + $(DEFER_INIT_CWD) $(SYSIO_LABEL_NAMES) -I$(top_srcdir)/include Index: configure.in =================================================================== RCS file: /cvsroot/libsysio/libsysio/configure.in,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- configure.in 21 May 2005 03:24:27 -0000 1.20 +++ configure.in 19 Oct 2005 19:30:56 -0000 1.21 @@ -3,6 +3,8 @@ AC_INIT(libsysio, 1.0) AC_CANONICAL_HOST case "$host_os" in + aix*) + ;; linux*) ;; *) @@ -180,6 +182,27 @@ if test x$with_lustre_hack = xyes; then AC_DEFINE(HAVE_LUSTRE_HACK) fi +AC_ARG_WITH(tracing, + AC_HELP_STRING([--with-tracing], + [enable tracing support]), + [ case "${withval}" in + yes) TRACING=-DSYSIO_TRACING=${withval} ;; + no) ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;; + esac], + [TRACING=-DSYSIO_TRACING=1]) +AC_SUBST(TRACING) + +AC_ARG_WITH(alternate-symbols, + AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@], + [Prepend standard, public, symbols with a unique qualifer]), + [ case "${withval}" in + yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;; + no) ;; + *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;; + esac]) +AC_SUBST(SYSIO_LABEL_NAMES) + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. @@ -207,6 +230,12 @@ case "$host_os" in # These systems are always xcoff xcoff=yes elf=no + # ... and always needed... + AC_DEFINE(__USE_LARGEFILE64) + AC_DEFINE(_LARGE_FILES) + AC_DEFINE(_LARGE_FILE_API) + AC_DEFINE(_ALL_SOURCE) + AC_DEFINE(_XOPEN_SOURCE_EXTENDED) ;; esac |
From: Lee W. <lw...@us...> - 2005-10-19 19:25:41
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2498 Modified Files: fs_native.c Log Message: Fix returns from ioctl in both the normal ioctl handler and the one defined when WITH_LUSTRE_HACK set. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -w -b -B -p -r1.56 -r1.57 --- fs_native.c 4 Aug 2005 20:17:09 -0000 1.56 +++ fs_native.c 19 Oct 2005 19:25:33 -0000 1.57 @@ -1748,6 +1748,7 @@ native_inop_ioctl(struct inode *ino, { struct native_inode *nino; long arg1, arg2, arg3, arg4; + int rtn; nino = I2NI(ino); assert(nino->ni_fd >= 0); @@ -1756,8 +1757,12 @@ native_inop_ioctl(struct inode *ino, arg3 = va_arg(ap, long); arg4 = va_arg(ap, long); - return syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, + rtn = + syscall(SYSIO_SYS_ioctl, I2NI(ino)->ni_fd, request, arg1, arg2, arg3, arg4); + if (rtn < 0) + rtn = -errno; + return rtn; } #else static int @@ -1769,8 +1774,7 @@ native_inop_ioctl(struct inode *ino __IS /* * I'm lazy. Maybe implemented later. */ - errno = ENOTTY; - return -1; + return -ENOTTY; } #endif |
From: Lee W. <lw...@us...> - 2005-09-18 17:44:55
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28137/src Modified Files: init.c Log Message: Oops. Forgot to surround one addition with SYSIO_TRACING define. Fixed. It now build when ==with-tracing set to "no". Changed the copyright date. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- init.c 15 Sep 2005 21:46:23 -0000 1.23 +++ init.c 18 Sep 2005 17:44:45 -0000 1.24 @@ -9,7 +9,7 @@ * 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. + * Cplant(TM) Copyright 1998-2005 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 @@ -139,11 +139,13 @@ _sysio_init() extern int _sysio_sockets_init(void); #endif +#if SYSIO_TRACING /* * Initialize tracing callback queues. */ TAILQ_INIT(&_sysio_entry_trace_head); TAILQ_INIT(&_sysio_exit_trace_head); +#endif err = _sysio_ioctx_init(); if (err) |
From: Lee W. <lw...@us...> - 2005-09-15 21:46:32
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23070/include Modified Files: sysio-cmn.h Log Message: Oops. forgot to remove the old _sysio_tracing global declaration. Fixed. Added a bunch of comments. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -b -B -p -r1.6 -r1.7 --- sysio-cmn.h 15 Sep 2005 21:31:38 -0000 1.6 +++ sysio-cmn.h 15 Sep 2005 21:46:23 -0000 1.7 @@ -150,8 +150,6 @@ struct iovec; /* Interface enter/leave hook functions */ #if SYSIO_TRACING -extern int _sysio_tracing; - extern void *_sysio_entry_trace_q; extern void *_sysio_exit_trace_q; |
From: Lee W. <lw...@us...> - 2005-09-15 21:46:31
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23070/src Modified Files: init.c Log Message: Oops. forgot to remove the old _sysio_tracing global declaration. Fixed. Added a bunch of comments. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- init.c 15 Sep 2005 21:31:38 -0000 1.22 +++ init.c 15 Sep 2005 21:46:23 -0000 1.23 @@ -81,18 +81,30 @@ #if SYSIO_TRACING +/* + * Tracing callback record. + */ struct trace_callback { TAILQ_ENTRY(trace_callback) links; void (*f)(const char *file, const char *func, int line); }; +/* + * Initialize a tracing callback record. + */ #define TCB_INIT(__tcb, __f) \ do { \ (__tcb)->f = (__f); \ } while (0); +/* + * Trace queue head record. + */ TAILQ_HEAD(trace_q, trace_callback); +/* + * The entry and exit queue heads, and queue pointers. + */ static struct trace_q _sysio_entry_trace_head; void *_sysio_entry_trace_q = &_sysio_entry_trace_head; static struct trace_q _sysio_exit_trace_head; @@ -187,6 +199,9 @@ _sysio_shutdown() { struct trace_callback *tcb; + /* + * Empty the trace queues and free the entries. + */ while ((tcb = _sysio_entry_trace_head.tqh_first) != NULL) { TAILQ_REMOVE(&_sysio_entry_trace_head, tcb, links); free(tcb); @@ -287,7 +302,7 @@ _sysio_cprintf(const char *fmt, ...) /* * Register a trace callback. * - * The pointer to the tracde record is returned. + * The pointer to the trace record is returned. */ void * _sysio_register_trace(void *q, @@ -305,6 +320,9 @@ _sysio_register_trace(void *q, return tcb; } +/* + * Remove a registered trace callback. + */ void _sysio_remove_trace(void *q, void *p) { @@ -314,6 +332,9 @@ _sysio_remove_trace(void *q, void *p) } void +/* + * Run a trace queue, making all the callbacks. + */ _sysio_run_trace_q(void *q, const char *file, const char *func, |
From: Lee W. <lw...@us...> - 2005-09-15 21:31:47
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19135/include Modified Files: sysio-cmn.h Log Message: Support user-defined entry/exit callbacks and switch existing trace-print support to the new mechanism. Introduces: _sysio_entry_trace_q and _sysio_exit_trace_q; pointers to the 2 callback queues. _sysio_register_trace; To register a callback _sysio_remove_trace; To remove a previously registered callback _sysio_run_trace_q; To execute the callbacks in a trace queue. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- sysio-cmn.h 25 Jan 2005 00:37:07 -0000 1.5 +++ sysio-cmn.h 15 Sep 2005 21:31:38 -0000 1.6 @@ -9,7 +9,7 @@ * 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. + * Cplant(TM) Copyright 1998-2005 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 @@ -152,15 +152,35 @@ struct iovec; #if SYSIO_TRACING extern int _sysio_tracing; +extern void *_sysio_entry_trace_q; +extern void *_sysio_exit_trace_q; + +extern void *_sysio_register_trace(void *q, + void (*)(const char *file, + const char *func, + int line)); +extern void _sysio_remove_trace(void *q, void *p); +extern void _sysio_run_trace_q(void *q, + const char *file, + const char *func, + int line); #define SYSIO_ENTER \ - if (_sysio_tracing) _sysio_cprintf("+ENTER+ %s\n", __func__) + do { \ + _sysio_run_trace_q(_sysio_entry_trace_q, \ + __FILE__, __func__, __LINE__); \ + } while (0) + #define SYSIO_LEAVE \ - if (_sysio_tracing) _sysio_cprintf("+LEAVE+ %s\n", __func__) + do { \ + _sysio_run_trace_q(_sysio_exit_trace_q, \ + __FILE__, __func__, __LINE__); \ + } while (0) #else -#define SYSIO_ENTER -#define SYSIO_LEAVE - +#define SYSIO_ENTER \ + do { } while (0) +#define SYSIO_LEAVE \ + do { } while (0) #endif /* accounting for IO stats read and write char count */ |
From: Lee W. <lw...@us...> - 2005-09-15 21:31:46
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19135/src Modified Files: init.c Log Message: Support user-defined entry/exit callbacks and switch existing trace-print support to the new mechanism. Introduces: _sysio_entry_trace_q and _sysio_exit_trace_q; pointers to the 2 callback queues. _sysio_register_trace; To register a callback _sysio_remove_trace; To remove a previously registered callback _sysio_run_trace_q; To execute the callbacks in a trace queue. Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- init.c 25 Jan 2005 00:37:11 -0000 1.21 +++ init.c 15 Sep 2005 21:31:38 -0000 1.22 @@ -80,7 +80,23 @@ #endif #if SYSIO_TRACING -int _sysio_tracing = 0; + +struct trace_callback { + TAILQ_ENTRY(trace_callback) links; + void (*f)(const char *file, const char *func, int line); +}; + +#define TCB_INIT(__tcb, __f) \ + do { \ + (__tcb)->f = (__f); \ + } while (0); + +TAILQ_HEAD(trace_q, trace_callback); + +static struct trace_q _sysio_entry_trace_head; +void *_sysio_entry_trace_q = &_sysio_entry_trace_head; +static struct trace_q _sysio_exit_trace_head; +void *_sysio_exit_trace_q = &_sysio_exit_trace_head; #endif /* @@ -111,6 +127,12 @@ _sysio_init() extern int _sysio_sockets_init(void); #endif + /* + * Initialize tracing callback queues. + */ + TAILQ_INIT(&_sysio_entry_trace_head); + TAILQ_INIT(&_sysio_exit_trace_head); + err = _sysio_ioctx_init(); if (err) goto error; @@ -161,6 +183,20 @@ _sysio_shutdown() _sysio_fd_shutdown(); _sysio_i_shutdown(); _sysio_fssw_shutdown(); +#if SYSIO_TRACING + { + struct trace_callback *tcb; + + while ((tcb = _sysio_entry_trace_head.tqh_first) != NULL) { + TAILQ_REMOVE(&_sysio_entry_trace_head, tcb, links); + free(tcb); + } + while ((tcb = _sysio_exit_trace_head.tqh_first) != NULL) { + TAILQ_REMOVE(&_sysio_exit_trace_head, tcb, links); + free(tcb); + } + } +#endif #endif } @@ -247,6 +283,68 @@ _sysio_cprintf(const char *fmt, ...) _sysio_cwrite(buf, len); free(buf); } + +/* + * Register a trace callback. + * + * The pointer to the tracde record is returned. + */ +void * +_sysio_register_trace(void *q, + void (*f)(const char *file, + const char *func, + int line)) +{ + struct trace_callback *tcb; + + tcb = malloc(sizeof(struct trace_callback)); + if (!tcb) + return NULL; + TCB_INIT(tcb, f); + TAILQ_INSERT_TAIL((struct trace_q *)q, tcb, links); + return tcb; +} + +void +_sysio_remove_trace(void *q, void *p) +{ + + TAILQ_REMOVE((struct trace_q *)q, (struct trace_callback *)p, links); + free(p); +} + +void +_sysio_run_trace_q(void *q, + const char *file, + const char *func, + int line) +{ + struct trace_callback *tcb; + + tcb = ((struct trace_q *)q)->tqh_first; + while (tcb) { + (*tcb->f)(file, func, line); + tcb = tcb->links.tqe_next; + } +} + +static void +_sysio_trace_entry(const char *file __IS_UNUSED, + const char *func, + int line __IS_UNUSED) +{ + + _sysio_cprintf("+ENTER+ %s\n", func); +} + +static void +_sysio_trace_exit(const char *file __IS_UNUSED, + const char *func, + int line __IS_UNUSED) +{ + + _sysio_cprintf("+EXIT+ %s\n", func); +} #endif /* defined(SYSIO_TRACING) */ /* @@ -776,6 +874,9 @@ _sysio_boot_tracing(const char *arg) { long l; char *cp; + static struct trace_callback + *entcb = NULL, + *exitcb = NULL; l = 0; if (arg) { @@ -783,7 +884,27 @@ _sysio_boot_tracing(const char *arg) if (*cp || !(l == 0 || l == 1)) return -EINVAL; } - _sysio_tracing = (int )l; + if (l) { + if (entcb == NULL) + entcb = + _sysio_register_trace(_sysio_entry_trace_q, + _sysio_trace_entry); + if (entcb == NULL) + return -errno; + if (exitcb == NULL) + exitcb = + _sysio_register_trace(_sysio_exit_trace_q, + _sysio_trace_exit); + if (exitcb == NULL) + return -errno; + } else { + if (entcb != NULL) + _sysio_remove_trace(_sysio_entry_trace_q, entcb); + entcb = NULL; + if (exitcb != NULL) + _sysio_remove_trace(_sysio_exit_trace_q, exitcb); + exitcb = NULL; + } return 0; } #endif |
From: Lee W. <lw...@us...> - 2005-09-15 19:29:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26988/src Modified Files: namei.c Log Message: Oops. I had only the nd_intent field name. Not the pointer prepended. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- namei.c 15 Sep 2005 14:50:57 -0000 1.17 +++ namei.c 15 Sep 2005 19:29:02 -0000 1.18 @@ -262,7 +262,7 @@ _sysio_path_walk(struct pnode *parent, s (nd->nd_flags | ND_NEGOK), lpath, nd->nd_root, - !next.len ? nd_intent : NULL); + !next.len ? nd->nd_intent : NULL); nameidata.nd_slicnt = nd->nd_slicnt + 1; err = _sysio_path_walk(nd->nd_pno->p_parent, &nameidata); |