]> sourceware.org Git - lvm2.git/commitdiff
test: Make runner use bigger IO buffers, put them on stack.
authorPetr Rockai <prockai@redhat.com>
Thu, 26 Jun 2014 22:52:07 +0000 (00:52 +0200)
committerPetr Rockai <prockai@redhat.com>
Thu, 5 Feb 2015 12:47:17 +0000 (13:47 +0100)
test/lib/io.h

index 8ade28163e5d713c54e289688e20d8b090666878..28e40d8c3c630c5020aa98737181bdcdac1c2ceb 100644 (file)
@@ -114,7 +114,6 @@ struct Observer : Sink {
 
 struct KMsg {
        int fd;
-       char buf[ 4096 ];
 
        bool dev_kmsg() {
                return fd >= 0;
@@ -136,6 +135,8 @@ struct KMsg {
        void read( Sink *s ) {
                int sz;
 
+               char buf[ 128 * 1024 ];
+
                if ( dev_kmsg() ) {
                        while ( (sz = ::read(fd, buf, sizeof(buf) - 1)) > 0 )
                                s->push( std::string( buf, sz ) );
@@ -144,8 +145,7 @@ struct KMsg {
                                read( s );
                        }
                } else {
-                       sz = klogctl( SYSLOG_ACTION_READ_CLEAR, buf, sizeof(buf) - 1 );
-                       if ( sz > 0 )
+                       while ( (sz = klogctl( SYSLOG_ACTION_READ_CLEAR, buf, sizeof(buf) - 1 )) > 0 )
                                s->push( std::string( buf, sz ) );
                }
        }
@@ -160,7 +160,6 @@ struct IO : Sink {
 
        KMsg kmsg;
        int fd;
-       char buf[ 4096 ];
 
        virtual void push( std::string x ) {
                for ( Sinks::iterator i = sinks.begin(); i != sinks.end(); ++i )
@@ -169,6 +168,8 @@ struct IO : Sink {
 
        void sync() {
                ssize_t sz;
+               char buf[ 128 * 1024 ];
+
                while ( (sz = read(fd, buf, sizeof(buf) - 1)) > 0 )
                        push( std::string( buf, sz ) );
 
This page took 0.033164 seconds and 5 git commands to generate.