FreeBSD Bugzilla – Attachment 218237 Details for
Bug 249567
NFSv4 server sometimes responds with NFSERR_INVAL to LOCK from Linux clients
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
fcntl F_SETLK test case
fcntl_setlk.c (text/plain), 1.20 KB, created by
Björn Fischer
on 2020-09-24 09:39:08 UTC
(
hide
)
Description:
fcntl F_SETLK test case
Filename:
MIME Type:
Creator:
Björn Fischer
Created:
2020-09-24 09:39:08 UTC
Size:
1.20 KB
patch
obsolete
> >#include <unistd.h> >#include <fcntl.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <stdio.h> >#include <stdlib.h> >#include <errno.h> >#include <string.h> > >char data[] = "Lorem ipsum dolor sit amet"; > >int main( int argc, char *argv[] ) { > > char fname[] = "fcntl.test.XXXXXX"; > int fd = mkstemp(fname); > write(fd, data, sizeof(data)); > > struct flock lock; > lock.l_type = F_RDLCK; > lock.l_whence = SEEK_SET; > lock.l_start = 0; > lock.l_len = 1; > lock.l_pid = getpid(); > > > struct flock unlock; > unlock.l_type = F_UNLCK; > unlock.l_whence = SEEK_SET; > unlock.l_start = 0; > unlock.l_len = 1; > unlock.l_pid = getpid(); > > int c = 0; > while (c++ < 100000000) { > > errno = 0; > int res = fcntl(fd, F_SETLK, &lock); > if (res < 0) { > printf("F_SETLK F_RDLCK res = %d (%s)\n", > res, strerror(errno)); > break; > } > > errno = 0; > res = fcntl(fd, F_SETLK, &unlock); > if (res < 0) { > printf("F_SETLK F_UNLCK res = %d (%s)\n", > res, strerror(errno)); > break; > } > > } > > printf("Successful cycles: %d\n", c - 1); > close(fd); > unlink(fname); > >} >
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 249567
: 218237 |
218307