The Samba-Bugzilla – Attachment 4889 Details for
Bug 6828
infinite timeout occurs when byte lock held outside of samba
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test program to grab lock and not release it.
ctdb_test.c (text/plain), 962 bytes, created by
Barry Sabsevitz (mail address dead)
on 2009-10-26 19:19:20 UTC
(
hide
)
Description:
Test program to grab lock and not release it.
Filename:
MIME Type:
Creator:
Barry Sabsevitz (mail address dead)
Created:
2009-10-26 19:19:20 UTC
Size:
962 bytes
patch
obsolete
>#include <stdio.h> >#include <fcntl.h> >#include <sys/errno.h> > >int fd; > >void >lock_file() >{ > struct flock lock; > int ret; > > lock.l_whence = SEEK_SET; > lock.l_start = 0; > lock.l_len = 0; > lock.l_type = F_WRLCK; > > printf ("locking file\n"); > fflush(stdout); > > ret = fcntl(fd, F_SETLKW, &lock); > if (ret < 0) { > perror ("lock failed:"); > exit(1); > } >} > >void >unlock_file() >{ > > struct flock lock; > int ret; > > lock.l_whence = SEEK_SET; > lock.l_start = 0; > lock.l_len = 0; > lock.l_type = F_UNLCK; > > printf ("unlocking file\n"); > fflush(stdout); > > ret = fcntl(fd, F_SETLKW, &lock); > if (ret < 0) { > perror ("unlock lock failed:"); > exit(1); > } >} > > >main(int argc, char *argv[]) >{ > > char buf[1024]; > > fd = open(argv[1], O_RDWR); > if (fd < 0) { > perror ("open failed:"); > exit(1); > } > > while(1) { > > lock_file(); > > printf ("File locked\n"); > fflush(stdout); > fgets(buf, sizeof(buf), stdin); > > unlock_file(); > printf ("File unlocked\n"); > fflush(stdout); > } >} > >
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 6828
:
4866
|
4872
|
4873
| 4889 |
4890
|
4891
|
4899
|
4900