| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- operations on a synchronization object in libc_db
cc [flag... ]file... -lc_db [library... ]#include <proc_service.h>#include <thread_db.h>td_err_etd_sync_get_info(const td_synchandle_t *sh_p,td_syncinfo_t *si_p);
td_err_etd_ta_sync_tracking_enable(const td_thragent_t *ta_p,inton_off);
td_err_etd_sync_get_stats(const td_synchandle_t *sh_p,td_syncstats_t *ss_p);
td_err_etd_sync_setstate(const td_synchandle_t *sh_p);
typedef inttd_thr_iter_f(const td_thrhandle_t *th_p,void *cb_data_p);
td_err_etd_sync_waiters(const td_synchandle_t *sh_p,td_thr_iter_f *cb,void *cb_data_p);
Synchronization objects include mutexes, condition variables, semaphores, and reader-writer locks. In thesame way that thread operations use a thread handle of typetd_thrhandle_t,operations on synchronization objects use a synchronization object handle of typetd_synchandle_t.
The controlling process obtains synchronization object handles either by calling the functiontd_ta_sync_iter() to obtain handles for all synchronization objects of the target processthat are known to thelibc_db library of interfaces, or by mapping theaddress of a synchronization object in the address space of the targetprocess to a handle by callingtd_ta_map_addr2sync(3C_DB).
Not all synchronization objects that a process uses can be known tothelibc_db library and returned bytd_ta_sync_iter(3C_DB). A synchronization object is known tolibc_db only if it has been the target of a synchronization primitivein the process (such asmutex_lock(), described on themutex_init(3C) manual page)aftertd_ta_new(3C_DB) has been called to attach to the process andtd_ta_sync_tracking_enable()has been called to enable synchronization object tracking.
Thetd_ta_sync_tracking_enable() function turns synchronization object tracking on or off for theprocess identified byta_p, depending on whetheron_off is 0 (off) ornon-zero (on).
Thetd_sync_get_info() function fills in thetd_syncinfo_t structure*si_p with values forthe synchronization object identified bysh_p. Thetd_syncinfo_t structure contains the followingfields:
The internal process handle identifying the target process through which this synchronization object handle was obtained. Synchronization objects may be process-private or process-shared. In the latter case, the same synchronization object may have multiple handles, one for each target process's "view" of the synchronization object.
The address of the synchronization object in this target process's address space.
The type of the synchronization variable: mutex, condition variable, semaphore, or readers-writer lock.
Ifsi_shared_type is non-zero, this synchronization object is process-shared, otherwise it is process-private.
Flags dependent on the type of the synchronization object.
Semaphores only. The current value of the semaphore
Readers-writer locks only. The number of readers currently holding the lock, or-1, if a writer is currently holding the lock.
For mutexes only. Non-zero if and only if the mutex is currently locked.
The size of the synchronization object.
Non-zero if and only if at least one thread is blocked on this synchronization object.
For reader-writer locks only. The value is non-zero if and only if this lock is held by a writer.
PTHREAD_MUTEX_RECURSIVE mutexes only. If the mutex is held, the recursion count.
PTHREAD_PRIO_PROTECT protocol mutexes only. The priority ceiling.
Mutexes and readers-writer locks only. This is the thread holding the mutex, or the write lock, if this is a reader-writer lock. The value isNULL if no one holds the mutex or write-lock.
Mutexes only. For a locked process-shared mutex, this is the process-ID of the process containing the owning thread.
Thetd_sync_get_stats() function fills in thetd_syncstats_t structure *ss_p with values forthe synchronization object identified bysh_p. Thetd_syncstats_t structure contains an embeddedtd_syncinfo_t structure that is filled in as described above fortd_sync_get_info(). In addition, usage statistics gathered sincetd_ta_sync_tracking_enable() was called to enable synchronizationobject tracking are returned in thess_un.mutex,ss_un.cond,ss_un.rwlock, orss_un.sema members ofthetd_syncstats_t structure, depending on the type of the synchronization object.
Thetd_sync_setstate function modifies the state of synchronization objectsi_p, depending onthe synchronization object type. For mutexes,td_sync_setstate is unlocked if thevalue is0. Otherwise it is locked. For semaphores, the semaphore's countis set to the value. For reader-writer locks, the reader count setto the value if value is>0. The count is set towrite-locked if value is–1. It is set to unlocked if thevalue is0. Setting the state of a synchronization object from alibc_db interface may cause the synchronization object's semantics to be violated fromthe point of view of the threads in the target process. Forexample, if a thread holds a mutex, andtd_sync_setstate is used to setthe mutex to unlocked, then a different thread will also beable to subsequently acquire the same mutex.
Thetd_sync_waiters function iterates over the set of thread handles of threadsblocked onsh_p. The callback functioncb is called once for eachsuch thread handle, and is passed the thread handle andcb_data_p. If the callback function returns a non-zero value, iteration is terminated early.Seetd_ta_thr_iter(3C_DB).
The call returned successfully.
An invalid thread handle was passed in.
A call to one of the imported interface routines failed.
A libc_db-internal error occurred.
Seeattributes(5) for descriptions of the following attributes:
|
libc_db(3LIB),mutex_init(3C),td_ta_map_addr2sync(3C_DB),td_ta_sync_iter(3C_DB),td_ta_thr_iter(3C_DB),attributes(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |