Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 151650 Details for
Bug 235184
[rhts] ltp test vmsplice fails on ppc64 as a 32-bit app
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test program
vmsplice.c (text/x-csrc), 4.38 KB, created by
Don Zickus
on 2007-04-04 11:56:08 UTC
(
hide
)
Description:
test program
Filename:
MIME Type:
Creator:
Don Zickus
Created:
2007-04-04 11:56:08 UTC
Size:
4.38 KB
patch
obsolete
>/****************************************************************************** > * > * Copyright (c) International Business Machines Corp., 2006 > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License as published by > * the Free Software Foundation; either version 2 of the License, or > * (at your option) any later version. > * > * This program 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 General Public License for more details. > * > * You should have received a copy of the GNU General Public License > * along with this program; if not, write to the Free Software > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > * > * NAME > * vmsplice01.c > * > * DESCRIPTION > * This test case will verify basic function of vmsplice > * added by kernel 2.6.17 or up. > * > * USAGE: <for command-line> > * vmsplice01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p] > * where: > * -c n : Run n copies simultaneously. > * -e : Turn on errno logging. > * -i n : Execute test n times. > * -I x : Execute test for x seconds. > * -p : Pause for SIGUSR1 before starting > * -P x : Pause for x seconds between iterations. > * -t : Turn on syscall timing. > * > * Author > * Yi Yang <yyangcdl@cn.ibm.com> > * > * History > * 09/01/2006 Created first by Yi Yang <yyangcdl@cn.ibm.com> > * Thanks for some help from Jens Axboe <axboe@kernel.dk> > * > *****************************************************************************/ > >#include <errno.h> >#include <string.h> >#include <stdio.h> >#include <signal.h> >#include <sys/types.h> >#include <fcntl.h> >#include <linux/unistd.h> >#include <linux/uio.h> >#include <sys/poll.h> >#include <unistd.h> > >#define SPLICE_TEST_BLOCK_SIZE (1<<17) /* 128K */ > >static int vmsplice_test(void); > >char testfile[256]; > >static long mysplice(int fd_in, loff_t * off_in, > int fd_out, loff_t * off_out, > size_t len, unsigned int flags) >{ > return syscall(__NR_splice, fd_in, off_in, fd_out, off_out, len, flags); >} > >static long myvmsplice(int fd, struct iovec *v, unsigned long nregs, > unsigned int flags) >{ > return syscall(__NR_vmsplice, fd, v, nregs, flags); >} > >static void setup_every_copy() >{ > /* Initialize test file names */ > sprintf(testfile, "vmsplicetest%d.txt", getpid()); >} > >int main(int ac, char **av) >{ > setup_every_copy(); > > if (vmsplice_test() < 0) > printf("vmsplice failed\n"); > > unlink(testfile); > return (0); >} /* End main */ > >static int vmsplice_test(void) >{ > char buffer[SPLICE_TEST_BLOCK_SIZE]; > char vmsplicebuffer[SPLICE_TEST_BLOCK_SIZE]; > int pipes[2]; > long written; > int i, ret; > int fd_out; > struct iovec v; > struct pollfd pfd; > loff_t offset; > > for (i = 0; i < SPLICE_TEST_BLOCK_SIZE; i++) { > buffer[i] = i & 0xff; > } > v.iov_base = buffer; > v.iov_len = SPLICE_TEST_BLOCK_SIZE; > > ret = pipe(pipes); > if (ret < 0) { > perror("pipe: "); > return -1; > } > > fd_out = open(testfile, O_WRONLY | O_CREAT | O_TRUNC, 0644); > if (fd_out < 0) { > close(pipes[0]); > close(pipes[1]); > perror("open: "); > return -1; > } > > pfd.fd = pipes[1]; > pfd.events = POLLOUT; > offset = 0; > while (v.iov_len) { > /* > * in a real app you'd be more clever with poll of course, > * here we are basically just blocking on output room and > * not using the free time for anything interesting. > */ > if (poll(&pfd, 1, -1) < 0) { > perror("poll: "); > return -1; > } > > written = myvmsplice(pipes[1], &v, 1, 0); > if (written < 0) { > ret = -errno; > close(fd_out); > close(pipes[0]); > close(pipes[1]); > perror("myvmsplice:"); > return ret; > } else if (written == 0) > break; > else { > v.iov_base += written; > v.iov_len -= written; > } > > ret = mysplice(pipes[0], NULL, fd_out, &offset, written, 0); > if (ret < 0) { > ret = -errno; > close(fd_out); > close(pipes[0]); > close(pipes[1]); > return ret; > } > //printf("offset = %lld\n", (long long)offset); > > } > > close(fd_out); > close(pipes[0]); > close(pipes[1]); > > fd_out = open(testfile, O_RDONLY); > if (fd_out < 0) { > perror("open: "); > return -1; > } > read(fd_out, vmsplicebuffer, SPLICE_TEST_BLOCK_SIZE); > for (i = 0; i < SPLICE_TEST_BLOCK_SIZE; i++) { > if (buffer[i] != vmsplicebuffer[i]) > break; > } > if (i < SPLICE_TEST_BLOCK_SIZE) { > return -1; > } > return 0; >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 235184
: 151650