Skip to contentSkip to conversation

sem_is_locked()

DISCUSSION William Lee Irwin III 4 participants 6 messages Sep 22, 2004 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

hch and some others (e.g. moi) trying to do vfs sweeps would very much like to have a sem_is_locked() to assist them; by any chance could arch maintainers help out with implementing this for various arches?

Thanks.

-- wli

#1 lore raw
Quoted 3 lines · William Lee Irwin III

hch and some others (e.g. moi) trying to do vfs sweeps would very much like to have a sem_is_locked() to assist them; by any chance could arch maintainers help out with implementing this for various arches?

asm-parisc/semaphore.h already has a sem_getcount(). If you choose a different name for it, please just rename it.

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
#2 lore raw
In reply to William Lee Irwin III
Quoted 3 lines · William Lee Irwin III

hch and some others (e.g. moi) trying to do vfs sweeps would very much like to have a sem_is_locked() to assist them; by any chance could arch maintainers help out with implementing this for various arches?

On x86-64/i386 and probably most other architectures it is just atomic_read(&sem->count) <= 0

-Andi

#3 lore raw
Quoted 7 lines · Andi Kleen
Quoted 3 lines · William Lee Irwin III

hch and some others (e.g. moi) trying to do vfs sweeps would very much like to have a sem_is_locked() to assist them; by any chance could arch maintainers help out with implementing this for various arches?

On x86-64/i386 and probably most other architectures it is just atomic_read(&sem->count) <= 0

Obviously, generic code should not assume that a semaphore is implemented using atomic_t.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#4 lore raw
Quoted 11 lines · Russell King
Quoted 7 lines · Andi Kleen
Quoted 3 lines · William Lee Irwin III

hch and some others (e.g. moi) trying to do vfs sweeps would very much like to have a sem_is_locked() to assist them; by any chance could arch maintainers help out with implementing this for various arches?

On x86-64/i386 and probably most other architectures it is just atomic_read(&sem->count) <= 0

Obviously, generic code should not assume that a semaphore is implemented using atomic_t.

Sure, but with that fact it's pretty easy to implement the macro wli wants for most architectures.

-Andi

#5 lore raw
Quoted 2 lines · Russell King
Quoted 2 lines

Obviously, generic code should not assume that a semaphore is implemented using atomic_t.

Quoted 2 lines · Andi Kleen

Sure, but with that fact it's pretty easy to implement the macro wli wants for most architectures.

This sounds like I should just sweep them all and drop it in, as no one is concerned much about the details. All's well, it seems.

-- wli