From owner-svn-src-all@FreeBSD.ORG Sat Dec 11 16:06:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54DC0106566B; Sat, 11 Dec 2010 16:06:52 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 439FE8FC0A; Sat, 11 Dec 2010 16:06:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBBG6qCO011511; Sat, 11 Dec 2010 16:06:52 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBBG6qUS011509; Sat, 11 Dec 2010 16:06:52 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201012111606.oBBG6qUS011509@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 11 Dec 2010 16:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216379 - head/tools/regression/sockets/sendfile X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Dec 2010 16:06:52 -0000 Author: pjd Date: Sat Dec 11 16:06:52 2010 New Revision: 216379 URL: http://svn.freebsd.org/changeset/base/216379 Log: Allow to specify path to a file we want to test with sendfile(2). This allows to specify selected file system and not only /tmp/. Modified: head/tools/regression/sockets/sendfile/sendfile.c Modified: head/tools/regression/sockets/sendfile/sendfile.c ============================================================================== --- head/tools/regression/sockets/sendfile/sendfile.c Sat Dec 11 13:35:25 2010 (r216378) +++ head/tools/regression/sockets/sendfile/sendfile.c Sat Dec 11 16:06:52 2010 (r216379) @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -408,7 +409,7 @@ cleanup(void) } int -main(void) +main(int argc, char *argv[]) { char *page_buffer; int pagesize; @@ -422,8 +423,20 @@ main(void) FAIL_ERR("malloc") bzero(page_buffer, TEST_PAGES * pagesize); - snprintf(path, PATH_MAX, "/tmp/sendfile.XXXXXXXXXXXX"); - file_fd = mkstemp(path); + if (argc == 1) { + snprintf(path, PATH_MAX, "/tmp/sendfile.XXXXXXXXXXXX"); + file_fd = mkstemp(path); + if (file_fd == -1) + FAIL_ERR("mkstemp"); + } else if (argc == 2) { + (void)strlcpy(path, argv[1], sizeof(path)); + file_fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0600); + if (file_fd == -1) + FAIL_ERR("open"); + } else { + FAIL("usage: sendfile [path]"); + } + atexit(cleanup); len = write(file_fd, page_buffer, TEST_PAGES * pagesize);