2
* Copyright (C) 2002-2005 Novell/SUSE
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation, version 2 of the
13
#include <sys/types.h>
19
static int gotsigusr1;
26
int main(int argc, char *argv[])
29
const char *data="hello world";
34
fprintf(stderr, "usage: %s file\n",
39
if (signal(SIGUSR1, handler) == SIG_ERR){
40
fprintf(stderr, "FAIL: internal error signal failed - %s\n",
45
if (sigemptyset(&sigset) == -1) {
46
perror ("FAIL: nullifying sigset");
50
fd=open(argv[1], O_CREAT|O_EXCL|O_RDWR, S_IWUSR|S_IRUSR);
52
fprintf(stderr, "FAIL: create %s failed - %s\n",
61
(void)lseek(fd, 0, SEEK_SET);
62
rc=write(fd, data, strlen(data));
64
if (rc != strlen(data)){
65
fprintf(stderr, "FAIL: write failed - %s\n",
70
(void)lseek(fd, 0, SEEK_SET);
71
rc=read(fd, buf, sizeof(buf));
73
if (rc != strlen(data)){
74
fprintf(stderr, "FAIL: read failed - %s\n",
79
if (memcmp(buf, data, strlen(data)) != 0){
80
fprintf(stderr, "FAIL: comparison failed - %s\n",
89
(void)sigsuspend(&sigset);