[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Is there really any interest in a patch to allow cvs 1.11.6
From: |
Kelly F. Hickel |
Subject: |
RE: Is there really any interest in a patch to allow cvs 1.11.6 |
Date: |
Wed, 19 Nov 2003 12:58:05 -0600 |
OK all, here's the (small) diff (against 1.11.9) to make cvs work in
client mode, with large-ish (over 50k) files. I had been working with
1.11.6, but moved up to 1.11.9 hoping to get past the "make check"
failures that happen with or without these changes. It doesn't look
like I'm going to have any time in the near future to address the test
errors, but since the tests fail the same way with and without the
change, I'm submitting them anyway.
Basically this is to work around an issue in some systems (notably HP
NonStop) that are unable to read or write "large" buffers to/from a
socket with a single read/write call. The changes pretty much just add
a saferead and safewrite call to subr.c if LIMIT_READ_WRITE_SIZE is
defined.
Info for folks trying to build CVS on HP NonStop:
To build cvs under OSS on HP NonStop requires the installation of
various GNU packages, as well as something called FLOSS. All of this
(as well as binaries for some older versions of cvs) are available at
http://www.itug.org. Note that the cvs binaries available at ITUG also
exhibit the problem that this diff is intended to correct.
Once FLOSS and the pre-reqs are installed, and the cvs source unpacked,
I configure cvs with the following small shell script:
#!/bin/sh
export CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1 \
-DLIMIT_READ_WRITE_SIZE=32767"
./configure
The diff is:
*** cvs-1.11.9_orig/src/cvs.h Tue Oct 7 11:18:30 2003
--- cvs-1.11.9_nsk/src/cvs.h Wed Nov 19 11:04:30 2003
***************
*** 900,902 ****
--- 900,912 ----
extern void cvs_flusherr PROTO ((void));
extern void cvs_flushout PROTO ((void));
extern void cvs_output_tagged PROTO ((char *, char *));
+
+ #ifdef LIMIT_READ_WRITE_SIZE
+ extern size_t saferead PROTO ((int, void *, size_t));
+ extern size_t safewrite PROTO ((int, const void *, size_t));
+
+ /* use #define to map all read/write calls to the safe versions */
+ #define read saferead
+ #define write safewrite
+ #endif
+
*** cvs-1.11.9_orig/src/subr.c Tue Oct 7 11:44:31 2003
--- cvs-1.11.9_nsk/src/subr.c Wed Nov 19 11:05:14 2003
***************
*** 1013,1018 ****
--- 1013,1092 ----
#endif /* defined (SERVER_SUPPORT) && !defined
(FILENAMES_CASE_INSENSITIVE) */
+ #ifdef LIMIT_READ_WRITE_SIZE
+ /*
+ * On some systems it may not be a good idea, or may not work to
+ * attempt large read or write operations. Specifically, on HP
NonStop
+ * (Formerly Compaq NSK, formerly Tandem), it doesn't seem possible
+ * to perform read or write operations that are larger than about 52K.
+ * These functions provide a "safe" replacement for read and write
that
+ * will obey the configured limit.
+ */
+
+ /* remove mapping of these functions, so that we can call the real
ones. */
+ #undef read
+ #undef write
+
+ size_t saferead(fd, bufp, count)
+ int fd;
+ void *bufp;
+ size_t count;
+ {
+ size_t bytes = count;
+ unsigned char *bp = (unsigned char *)bufp;
+ size_t rv=0, len=0;
+
+ if(bytes > LIMIT_READ_WRITE_SIZE)
+ bytes = LIMIT_READ_WRITE_SIZE;
+ while ((bytes) && (len = read (fd, &bp[rv], bytes)) > 0)
+ {
+ rv += len;
+ if((count - rv) > LIMIT_READ_WRITE_SIZE)
+ {
+ bytes = LIMIT_READ_WRITE_SIZE;
+ }
+ else
+ {
+ bytes = count - rv;
+ }
+ }
+ /* make sure to return an error if the last op failed */
+ if(len < 0)
+ rv = len;
+ return rv;
+ }
+
+ size_t safewrite(fd, bufp, count)
+ int fd;
+ const void *bufp;
+ size_t count;
+ {
+ size_t bytes = count;
+ unsigned char *bp = (unsigned char *)bufp;
+ size_t rv=0, len=0;
+
+ if(bytes > LIMIT_READ_WRITE_SIZE)
+ bytes = LIMIT_READ_WRITE_SIZE;
+ while ((bytes) && (len = write (fd, &bp[rv], bytes)) > 0)
+ {
+ rv += len;
+ if((count - rv) > LIMIT_READ_WRITE_SIZE)
+ {
+ bytes = LIMIT_READ_WRITE_SIZE;
+ }
+ else
+ {
+ bytes = count - rv;
+ }
+ }
+ /* make sure to return an error if the last op failed */
+ if(len < 0)
+ rv = len;
+ return rv;
+ }
+
+ #endif
+
/* vim:tabstop=8:shiftwidth=4
*/
Thanks,
-Kelly Hickel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: Is there really any interest in a patch to allow cvs 1.11.6,
Kelly F. Hickel <=