10-30-2011
Is it possible that the lock should have already been captured and this code is just ensuring that it has the lock? In that context, the code is correct -- it's a bug if the lock wasn't obtained before invoking ext3_write_super.
If the lock is already held, then the return is 0, and thus it is safe to do the work that the function wants to do.
This might not be the case, but assuming you've posted the whole ext3_write_super function, which does not release the mutex, that'd be my guess.
10 More Discussions You Might Find Interesting
1. Programming
I am new to the unix/linux environment.
AND........
I need to create a mini shell..that displays prompt (i.e., READY:$), accepts a command from std-in, and prints the command and any parameters passed to it. HELP!!!! (8 Replies)
Discussion started by: jj1814
8 Replies
2. UNIX for Dummies Questions & Answers
hi,
i would like to replace a string in a series of files with another string, without outputting to new files. is this possible?
i've tried using sed, and started by trying to alter the contents of one file...
sed 's/string1/string2/g' file.txt
but while this does the replacement on... (2 Replies)
Discussion started by: schmark
2 Replies
3. UNIX for Dummies Questions & Answers
Hi All
Just started with shell scripts and am stumped by, what is to most of you no doubt, a simple issue.
All I'm trying to do is prompt a user for input and writing to a log file. If the user types the word 'stop', then the program should halt. If the word typed is 'clear', then the log file... (2 Replies)
Discussion started by: kutz13
2 Replies
4. Shell Programming and Scripting
I want to write a script to go to particular path in file and run shell script from there.
what will be shell script for the same. (2 Replies)
Discussion started by: shekhar_ssm
2 Replies
5. Shell Programming and Scripting
Hi all,
I have sql query as follows. Please write a pro*c program for the following query.
select
sp1.cost_change
||','|| sp1.cost_change_desc
||','|| sp1.reason
||','|| to_char(sp1.active_date,'DD-MON-YYYY HH24:MI:SS')
||','|| sp1.status
||','|| sp1.cost_change_origin... (0 Replies)
Discussion started by: user71408
0 Replies
6. Shell Programming and Scripting
Dear,
I have a alarm text file, containing minor and major alarms, i am intrested in Mojor alarm with its alarm header and next four lines in seperate file....
Can anybody help me with this below is the alarm file output.
:SEV="MAJOR":
Object-Instance %
unit-type % bts nbr % 25
... (5 Replies)
Discussion started by: Danish Shakil
5 Replies
7. Programming
I don't know if it is right to ask you this. Can someone help me write a simple Xlib program,with button on it,and all that button do is switch 2 messages.
I have tried and tried,but never get past Hello World. Can someone help me please?
---------- Post updated at 10:17 PM ---------- Previous... (2 Replies)
Discussion started by: megane16v
2 Replies
8. Shell Programming and Scripting
The circumfrence of a circle is
#!/usr/bin/perl
print 2 * 3.141592654 * 12.50 \n"; # pi= 3.141592654
# r= 12.50
I need a simple program showing me all the steps..to modify the above to prompt for and accept a radius from the person running the... (3 Replies)
Discussion started by: Q2wert
3 Replies
9. Shell Programming and Scripting
Hey all,
Writing a program that searches for a username and if they are online creates a 'beep' and sends the username and date to a log file.
the error i am getting is:
paul.obrien16@aisling:~/os$ bash checklogin
: command not found
Enter username
paul.obrien16
': not a valid... (2 Replies)
Discussion started by: sexyladywall
2 Replies
10. Shell Programming and Scripting
I have tried executing one particular query through perl.But I am unable to get the result. When I tried to execute the sysdate query its working when I executed my perl code.
The below query doesn't work.
QUERY 1:my $sql ="select name from tab where rownum <6";
Received ora error... (23 Replies)
Discussion started by: ramkumar15
23 Replies
LEARN ABOUT MOJAVE
pthread_rwlock_rdlock
PTHREAD_RWLOCK_RDLOCK(3) BSD Library Functions Manual PTHREAD_RWLOCK_RDLOCK(3)
NAME
pthread_rwlock_rdlock, pthread_rwlock_tryrdlock -- acquire a read/write lock for reading
SYNOPSIS
#include <pthread.h>
int
pthread_rwlock_rdlock(pthread_rwlock_t *lock);
int
pthread_rwlock_tryrdlock(pthread_rwlock_t *lock);
DESCRIPTION
The pthread_rwlock_rdlock() function acquires a read lock on lock provided that lock is not presently held for writing and no writer threads
are presently blocked on the lock. If the read lock cannot be immediately acquired, the calling thread blocks until it can acquire the lock.
The pthread_rwlock_tryrdlock() function performs the same action, but does not block if the lock cannot be immediately obtained (i.e., the
lock is held for writing or there are waiting writers).
A thread may hold multiple concurrent read locks. If so, pthread_rwlock_unlock() must be called once for each lock obtained.
The results of acquiring a read lock while the calling thread holds a write lock are undefined.
IMPLEMENTATION NOTES
To prevent writer starvation, writers are favored over readers.
RETURN VALUES
If successful, the pthread_rwlock_rdlock() and pthread_rwlock_tryrdlock() functions will return zero. Otherwise an error number will be
returned to indicate the error.
ERRORS
The pthread_rwlock_tryrdlock() function will fail if:
[EBUSY] The lock could not be acquired because a writer holds the lock or was blocked on it.
The pthread_rwlock_rdlock() and pthread_rwlock_tryrdlock() functions may fail if:
[EAGAIN] The lock could not be acquired because the maximum number of read locks against lock has been exceeded.
[EDEADLK] The current thread already owns lock for writing.
[EINVAL] The value specified by lock is invalid.
[ENOMEM] Insufficient memory exists to initialize the lock (applies to statically initialized locks only).
SEE ALSO
pthread_rwlock_init(3), pthread_rwlock_trywrlock(3), pthread_rwlock_unlock(3), pthread_rwlock_wrlock(3)
STANDARDS
The pthread_rwlock_rdlock() and pthread_rwlock_tryrdlock() functions are expected to conform to Version 2 of the Single UNIX Specification
(``SUSv2'').
HISTORY
The pthread_rwlock_rdlock() function first appeared in FreeBSD 3.0.
BSD
August 4, 1998 BSD