Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 161204 Details for
Bug 252000
flock demotion from exclusive to shared is incorrect
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test program to do exclusive followed by shared flock
flock_EX_SH.c (text/x-csrc), 1.26 KB, created by
Abhijith Das
on 2007-08-13 18:58:07 UTC
(
hide
)
Description:
test program to do exclusive followed by shared flock
Filename:
MIME Type:
Creator:
Abhijith Das
Created:
2007-08-13 18:58:07 UTC
Size:
1.26 KB
patch
obsolete
>#include <stdio.h> >#include <unistd.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> >#include <sys/file.h> >#include <string.h> >#include <time.h> >#include <errno.h> > >int writelock(char *filename) >{ > int fd; > > if ((fd=open(filename,O_CREAT|O_RDWR,S_IRUSR|S_IWUSR|S_IRGRP))==-1) > { > fprintf (stderr,"Could not open %s:",filename); > perror (""); > exit(1); > } > > int flock(int fd, int operation); > > while (flock(fd,LOCK_EX) == -1) > { > if (errno!=EAGAIN) > { > fprintf (stderr,"Could not get write lock on %s errno=%d:",filename,errno); > perror (""); > exit(1); > } > printf ("%s locked, trying again\n",filename); > } > > printf ("Have exclusive lock, hit return to free write lock on %s and exit\n",filename); > fgetc(stdin); > > printf ("Attempt to demote lock on %s to shared lock\n",filename); > > if (flock(fd,LOCK_SH|LOCK_NB) == -1) > { > fprintf (stderr,"Could not demote to shared lock on file %s, %s\n",filename,strerror(errno)); > exit(1); > } > > printf ("Have shared lock, hit return to free lock on %s and exit\n",filename); > fgetc(stdin); > > if (flock(fd,LOCK_UN) == -1) > { > fprintf (stderr,"Could not free shared lock on file %s:",filename); > perror (""); > exit(1); > } > > close(fd); >} > >main(int argc, char *argv[]) >{ > int fd; > int i; > fd=writelock(argv[1]); >} >
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 252000
: 161204 |
161205
|
161405
|
161406