From: Alex Riesen <raa.lkml@gmail.com>
To: boi@boi.at
Cc: linux-kernel@vger.kernel.org
Subject: Re: blocking file lock functions (lockf,flock,fcntl) do not return after timer signal
Date: Wed, 12 Oct 2005 14:48:59 +0200 [thread overview]
Message-ID: <81b0412b0510120548k3464d355ne75cce4e5edcce1a@mail.gmail.com> (raw)
In-Reply-To: <434CC144.6000504@boi.at>
On 10/12/05, "Dieter Müller (BOI GmbH)" <dieter.mueller@boi.at> wrote:
> bug description:
>
> flock, lockf, fcntl do not return even after the signal SIGALRM has
> been raised and the signal handler function has been executed
> the functions should return with a return value EWOULDBLOCK as described
> in the man pages
To confirm:
#include <unistd.h>
#include <sys/time.h>
#include <sys/file.h>
#include <time.h>
#include <signal.h>
void alrm(int sig)
{
write(2, "timeout\n", 8);
}
int main(int argc, char* argv[])
{
struct itimerval tv = {
.it_interval = {.tv_sec = 10, .tv_usec = 0},
.it_value = {.tv_sec = 10, .tv_usec = 0},
};
struct itimerval otv;
signal(SIGALRM, alrm);
setitimer(ITIMER_REAL, &tv, &otv);
int fd = open(argv[1], O_RDWR);
if ( fd < 0 )
{
perror(argv[1]);
return 1;
}
printf("locking...\n");
if ( flock(fd, LOCK_EX) < 0 )
{
perror("flock");
return 1;
}
printf("sleeping...\n");
int ch;
read(0, &ch, 1);
close(fd);
return 0;
}
next prev parent reply other threads:[~2005-10-12 12:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-12 7:54 "Dieter Müller (BOI GmbH)"
2005-10-12 12:48 ` Alex Riesen [this message]
2005-10-12 13:09 ` linux-os (Dick Johnson)
2005-10-12 14:39 ` Trond Myklebust
2005-10-12 15:10 ` Alex Riesen
2005-10-12 15:20 ` linux-os (Dick Johnson)
2005-10-12 15:37 ` Michael Kerrisk
2005-10-12 15:43 ` linux-os (Dick Johnson)
2005-10-12 16:05 ` Michael Kerrisk
2005-10-12 16:06 ` Mark Lord
2005-10-12 21:15 ` Alex Riesen
2005-10-12 16:36 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81b0412b0510120548k3464d355ne75cce4e5edcce1a@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=boi@boi.at \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®