> Yamato, > > Send these series (1-3) as a patch either embedded in the mail, or, as > an attachment. But, as Vijay wants it in mail, better embed in mail. > What you have done is just pasted the code. Instead, create patches and > then paste patch(s) like the following:
Like this? What kind of command line do you use to generate this kind of output? Newly added files are included in my patch. I cannot find good option in cvs diff for such purpose. All peope moved to git already? Signed-off-by: Masatake YAMATO <[EMAIL PROTECTED]> --- signalfd/Makefile | 35 +++++ signalfd/signalfd01.c | 329 ++++++++++++++++++++++++++++++++++++++++++++++++++ utils/cond.mk | 88 +++++++++++++ 3 files changed, 452 insertions(+) diff --exclude=CVS --exclude='~' --exclude='\.*' --exclude='_*' --exclude='*.patch' -rupN ltp/testcases/kernel/syscalls/signalfd/Makefile ltp-hacked/testcases/kernel/syscalls/signalfd/Makefile --- ltp/testcases/kernel/syscalls/signalfd/Makefile 1970-01-01 09:00:00.000000000 +0900 +++ ltp-hacked/testcases/kernel/syscalls/signalfd/Makefile 2008-09-10 14:35:31.000000000 +0900 @@ -0,0 +1,35 @@ +# +# Copyright (c) International Business Machines Corp., 2001 +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +include ../utils/cond.mk + + +CFLAGS += -I../../../../include \ + $(call check_header,sys/signalfd.h, -DHAS_SIGNALFD_H, ) -Wall +LDLIBS += -L../../../../lib -lltp + +SRCS = $(wildcard *.c) +TARGETS = $(patsubst %.c,%,$(SRCS)) + +all: $(TARGETS) + +install: + @set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done + +clean: + rm -f $(TARGETS) diff --exclude=CVS --exclude='~' --exclude='\.*' --exclude='_*' --exclude='*.patch' -rupN ltp/testcases/kernel/syscalls/signalfd/signalfd01.c ltp-hacked/testcases/kernel/syscalls/signalfd/signalfd01.c --- ltp/testcases/kernel/syscalls/signalfd/signalfd01.c 1970-01-01 09:00:00.000000000 +0900 +++ ltp-hacked/testcases/kernel/syscalls/signalfd/signalfd01.c 2008-09-10 14:35:23.000000000 +0900 @@ -0,0 +1,329 @@ +/* + * + * Copyright (c) Red Hat Inc., 2008 + * + * 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 + * signalfd01.c + * + * DESCRIPTION + * Check signalfd can receive signals + * + * USAGE + * signalfd01 + * + * HISTORY + * 9/2008 Initial version by Masatake YAMATO <[EMAIL PROTECTED]> + * + * RESTRICTIONS + * None + */ +# define _GNU_SOURCE + + +#include "test.h" +#include "usctest.h" + +#include <errno.h> +#include <signal.h> +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> + + +TCID_DEFINE(signalfd01); +int TST_TOTAL = 1; +extern int Tst_count; + +# ifdef HAS_SIGNALFD_H +#include <sys/signalfd.h> + +void cleanup(void); +void setup(void); + + +int +do_test1(int ntst, int sig) +{ + int sfd_for_next; + int sfd; + sigset_t mask; + pid_t pid; + struct signalfd_siginfo fdsi; + ssize_t s; + + sigemptyset(&mask); + sigaddset(&mask, sig); + if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) { + tst_brkm(TBROK, cleanup, + "sigprocmask() Failed: errno=%d : %s", + errno, + strerror(errno)); + } + + TEST(signalfd(-1, &mask, 0)); + + if ((sfd = TEST_RETURN) == -1) { + tst_resm(TFAIL, + "signalfd() Failed, errno=%d : %s", + TEST_ERRNO, strerror(TEST_ERRNO)); + sfd_for_next = -1; + return sfd_for_next; + + } else if (!STD_FUNCTIONAL_TEST) { + tst_resm(TPASS, "signalfd is created successfully"); + sfd_for_next = sfd; + goto out; + } + + + if (fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) { + close(sfd); + tst_brkm(TBROK, cleanup, + "setting signalfd nonblocking mode failed: errno=%d : %s", + errno, + strerror(errno)); + } + + + pid = getpid(); + if (kill(pid, sig) == -1) { + close(sfd); + tst_brkm(TBROK, cleanup, + "kill(self, %s) failed: errno=%d : %s", + strsignal(sig), + errno, + strerror(errno)); + } + + s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo)); + if ((s > 0) && (s != sizeof(struct signalfd_siginfo))) { + tst_resm(TFAIL, + "getting incomplete signalfd_siginfo data: " + "actual-size=%d, expected-size= %d", + s, sizeof(struct signalfd_siginfo)); + sfd_for_next = -1; + close(sfd); + goto out; + } + else if (s < 0) { + if (errno == EAGAIN) { + tst_resm(TFAIL, + "signalfd_siginfo data is not delivered yet"); + sfd_for_next = -1; + close(sfd); + goto out; + } else { + close(sfd); + tst_brkm(TBROK, cleanup, + "read signalfd_siginfo data failed: errno=%d : %s", + errno, + strerror(errno)); + } + } + else if (s == 0) { + tst_resm(TFAIL, "got EOF unexpectedly"); + sfd_for_next = -1; + close(sfd); + goto out; + } + + if (fdsi.ssi_signo == sig) { + tst_resm(TPASS, "got expected signal"); + sfd_for_next = sfd; + goto out; + } + else { + tst_resm(TFAIL, "got unexpected signal: signal=%d : %s", + fdsi.ssi_signo, + strsignal(fdsi.ssi_signo)); + sfd_for_next = -1; + close(sfd); + goto out; + } + +out: + return sfd_for_next; +} + + +void +do_test2(int ntst, int fd, int sig) +{ + int sfd; + sigset_t mask; + pid_t pid; + struct signalfd_siginfo fdsi; + ssize_t s; + + + sigemptyset(&mask); + sigaddset(&mask, sig); + if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) { + close(fd); + tst_brkm(TBROK, cleanup, + "sigprocmask() Failed: errno=%d : %s", + errno, + strerror(errno)); + } + + TEST(signalfd(fd, &mask, 0)); + + if ((sfd = TEST_RETURN) == -1) { + tst_resm(TFAIL, + "reassignment the file descriptor by signalfd() failed, errno=%d : %s", + TEST_ERRNO, strerror(TEST_ERRNO)); + return; + } else if (sfd != fd) { + tst_resm(TFAIL, + "different fd is returned in reassignment: expected-fd=%d, actual-fd=%d", + fd, sfd); + close(sfd); + return; + + } else if (!STD_FUNCTIONAL_TEST) { + tst_resm(TPASS, "signalfd is successfully reassigned"); + goto out; + } + + pid = getpid(); + if (kill(pid, sig) == -1) { + close(sfd); + tst_brkm(TBROK, cleanup, + "kill(self, %s) failed: errno=%d : %s", + strsignal(sig), + errno, + strerror(errno)); + } + + s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo)); + if ((s > 0) && (s != sizeof(struct signalfd_siginfo))) { + tst_resm(TFAIL, + "getting incomplete signalfd_siginfo data: " + "actual-size=%d, expected-size= %d", + s, sizeof(struct signalfd_siginfo)); + goto out; + } + else if (s < 0) { + if (errno == EAGAIN) { + tst_resm(TFAIL, + "signalfd_siginfo data is not delivered yet"); + goto out; + } else { + close(sfd); + tst_brkm(TBROK, cleanup, + "read signalfd_siginfo data failed: errno=%d : %s", + errno, + strerror(errno)); + } + } + else if (s == 0) { + tst_resm(TFAIL, "got EOF unexpectedly"); + goto out; + } + + if (fdsi.ssi_signo == sig) { + tst_resm(TPASS, "got expected signal"); + goto out; + } + else { + tst_resm(TFAIL, "got unexpected signal: signal=%d : %s", + fdsi.ssi_signo, + strsignal(fdsi.ssi_signo)); + goto out; + } +out: + return; +} + + +int +main(int argc, char** argv) +{ + int lc; + char *msg; /* message returned from parse_opts */ + int sfd; + + if((tst_kvercmp(2, 6, 22)) < 0) + { + tst_resm(TWARN, "This test can only run on kernels that are 2.6.22 and higher"); + exit(0); + } + + + if ((msg = parse_opts(argc, argv, NULL, NULL)) != NULL) { + tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); + } + + setup (); + for (lc = 0; TEST_LOOPING(lc); lc++) { + Tst_count = 0; + + sfd = do_test1(lc, SIGUSR1); + if (sfd < 0) + continue; + + do_test2(lc, sfd, SIGUSR2); + close(sfd); + } + + cleanup(); + + return 0; +} + +/* + * setup() - performs all the ONE TIME setup for this test. + */ +void +setup(void) +{ + /* Pause if that option was specified */ + TEST_PAUSE; +} + +/* + * cleanup() - performs all the ONE TIME cleanup for this test at completion + * or premature exit. + */ +void +cleanup(void) +{ + /* + * print timing stats if that option was specified. + * print errno log if that option was specified. + */ + TEST_CLEANUP; + + /* exit with return code appropriate for results */ + tst_exit(); +} + + +#else /* !HAS_SIGNALFD_H */ + +int +main(int argc, char** argv) +{ + tst_resm(TCONF, + "System doesn't support execution of the test"); + return 0; +} + + +#endif /* !HAS_SIGNALFD_H */ diff --exclude=CVS --exclude='~' --exclude='\.*' --exclude='_*' --exclude='*.patch' -rupN ltp/testcases/kernel/syscalls/utils/cond.mk ltp-hacked/testcases/kernel/syscalls/utils/cond.mk --- ltp/testcases/kernel/syscalls/utils/cond.mk 1970-01-01 09:00:00.000000000 +0900 +++ ltp-hacked/testcases/kernel/syscalls/utils/cond.mk 2008-09-09 18:46:22.000000000 +0900 @@ -0,0 +1,88 @@ +# cond.mk --- useful functions to write conditions +# +# Copyright (c) International Business Machines Corp., 2001 +# +# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# NAME +# check_header: Checking the existence of header file. +# +# SYNOPSIS +# $(call check_header,HEADFILE) +# $(call check_header,HEADFILE,STRING_IF_FOUND) +# $(call check_header,HEADFILE,STRING_IF_FOUND,STRING_IF_NOT_FOUND) +# +# DESCRIPTION +# +# check_header checks whether $(CC) can found HEADFILE or not. +# +# With the first form, "yes" is returned if it is found. +# "no" is returned if it is not found. +# +# With the second form, STRING_IF_FOUND is returned if it is found. +# "no" is returned if it is not found. +# +# With the second form, STRING_IF_FOUND is returned if it is found. +# STRING_IF_NOT_FOUND is returned if it is not found. +# +# EXAMPLES +# +# (1) yes or no +# +# include ../utils/cond.mk +# +# ifeq ($(call check_header,foo.h),yes) +# RULES if foo.h is available. +# else +# RULES IF foo.h is NOT available. +# endif +# +# +# (2) adding CFLAGS# CFLAGS += $(call check_header,foo.h,-DHAS_FOO_H, ) +# +# CFLAGS += $(call check_header,foo.h,-DHAS_FOO_H, ) +# +# +# NOTE +# +# Spaces after `,' are not striped automatically. +# +# The value for CFLAGS is different in following assignment: +# +# CFLAGS += $(call check_header,foo.h,-DHAS_FOO_H, ) +# CFLAGS += $(call check_header,foo.h,-DHAS_FOO_H,) +# +check_header = $(shell \ + if [ "x$(2)" = "x" ]; then FOUND=yes; else FOUND="$(2)"; fi; \ + if [ "x$(3)" = "x" ]; then NOTFOUND=no; else NOTFOUND="$(3)"; fi; \ + if echo "\#include <$(1)>" | $(CC) -E - > /dev/null 2>&1 ; \ + then echo "$${FOUND}" ; \ + else echo "$${NOTFOUND}" ; fi) + + +#COND_MK_DEBUG=yes +ifdef COND_MK_DEBUG +all: + @echo "-DHAS_STDIO_H == $(call check_header,stdio.h,-DHAS_STDIO_H,)" + @echo "\" \" == \"$(call check_header,foo.h,-DHAS_FOO_H, )\"" + @echo "yes == $(call check_header,stdio.h)" + @echo "no == $(call check_header,foo.h)" + @echo "YES == $(call check_header,stdio.h,YES)" + @echo "no == $(call check_header,foo.h,YES)" + @echo "YES == $(call check_header,stdio.h,YES,NO)" + @echo "NO == $(call check_header,foo.h,YES,NO)" +endif +# cond.mk ends here. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list