Sponsored Content
Full Discussion: File read/ write operation
Operating Systems Linux File read/ write operation Post 302425287 by Corona688 on Thursday 27th of May 2010 02:41:22 PM
Old 05-27-2010
Quote:
Originally Posted by xs2punit
Well I do not wish to use IPC at this time.
So without that it is not possible, right?
Without some form of communication or synchronization between the reader and the writer the reader will not be able to tell the difference between the real end of the file, a temporary underrun, a broken socket, etc, etc.
 

10 More Discussions You Might Find Interesting

1. IP Networking

how do you get to know if the write operation was succesful.

how do you get to know if the write operation for writing to a socket was succesful was succesful. (3 Replies)
Discussion started by: arjunjag
3 Replies

2. Shell Programming and Scripting

read and write from a file

I have tried to show the file name whose size is greater than 200 byte in current directory. Please help me. ls -l | tr -s " " " " | cut -f 5,9 -d " " >out.txt #set -a x `cat out.txt` i=0 `cat out.txt` | while do read x echo $x #re=200 j=0 if }" < "200" ] then echo $j j=`expr $j... (2 Replies)
Discussion started by: rinku
2 Replies

3. UNIX for Dummies Questions & Answers

Simultaneous file read operation

Hi All, I need information on file handling in UNIX enviornment. If in UNIX enviornment I have two process.. P1 P2 Both accessing the same file simultaneosuly(read operation).. Suppose P1 opened the file in read mode first and started reading the file.. Then P2 opens the same file in... (5 Replies)
Discussion started by: chibob
5 Replies

4. UNIX for Dummies Questions & Answers

Write/read to file descriptors

Is it possible to write to file descriptor 0 and read from 1 or 2? How could this be implemented? (3 Replies)
Discussion started by: machshev
3 Replies

5. Solaris

monitoring multipath IO for read and write operation

Hi Folks, I would like to monitor multipath IO on solaris for write and read operations. Does "sar -d" include multipath IO information along with other block devices ? Thanks, Faizan. (0 Replies)
Discussion started by: sifaizan
0 Replies

6. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

7. Shell Programming and Scripting

Transferring file write operation to another host

I have a process running on two hosts in Active/Standby mode. Process running on active machine is handling the traffic while process running on Standby machine is sitting idle. We have a debugging mechanism in which logs are generated on local machine. When logging is enabled then process running... (1 Reply)
Discussion started by: akhilonnet
1 Replies

8. Shell Programming and Scripting

Grab data between 2 keywords any do an array operation and write the file intact

Hi Unix Gurus, I need to grep for a block that is between a start and end keyword and then in between I need to find and replace a keyword. for eg: I need to search between Test = 000; and Test = 000; and find K9 and replace with M9 INPUT FILE Define { Replace = K9; Test =... (6 Replies)
Discussion started by: naveen@
6 Replies

9. Shell Programming and Scripting

File Read and Write

I have got a file in following format: AAAAAAA BBBBBBBB CCCCCCC DDDDDDD I am trying to read this file and out put it in following format: AAAAAAA,BBBBBBB,CCCCCCC,DDDDDD Preferred method is shell or Perl. Any help appreciated. (11 Replies)
Discussion started by: Araoki
11 Replies

10. Shell Programming and Scripting

Read and write in the file

Hello Guys, How all are doing? I have an issue in Unix and want help from all of you I have a file in UNIX which it read by line by line , If at the end of line '0' is written the it should fetch that line into another file and change '0' to '1' and If at the end of line '1' is written then it... (10 Replies)
Discussion started by: adisky123
10 Replies
td_sync_get_info(3C_DB) 				Threads Debugging Library Functions				   td_sync_get_info(3C_DB)

NAME
td_sync_get_info, td_ta_sync_tracking_enable, td_sync_get_stats, td_sync_setstate, td_sync_waiters - operations on a synchronization object in libc_db SYNOPSIS
cc [ flag... ] file... -lc_db [ library... ] #include <proc_service.h> #include <thread_db.h> td_err_e td_sync_get_info(const td_synchandle_t *sh_p, td_syncinfo_t *si_p); td_err_e td_ta_sync_tracking_enable(const td_thragent_t *ta_p, int on_off); td_err_e td_sync_get_stats(const td_synchandle_t *sh_p, td_syncstats_t *ss_p); td_err_e td_sync_setstate(const td_synchandle_t *sh_p); typedef int td_thr_iter_f(const td_thrhandle_t *th_p, void *cb_data_p); td_err_e td_sync_waiters(const td_synchandle_t *sh_p, td_thr_iter_f *cb, void *cb_data_p); DESCRIPTION
Synchronization objects include mutexes, condition variables, semaphores, and reader-writer locks. In the same way that thread operations use a thread handle of type td_thrhandle_t, operations on synchronization objects use a synchronization object handle of type td_synchan- dle_t. The controlling process obtains synchronization object handles either by calling the function td_ta_sync_iter() to obtain handles for all synchronization objects of the target process that are known to the libc_db library of interfaces, or by mapping the address of a synchro- nization object in the address space of the target process to a handle by calling td_ta_map_addr2sync(3C_DB). Not all synchronization objects that a process uses can be known to the libc_db library and returned by td_ta_sync_iter(3C_DB). A synchro- nization object is known to libc_db only if it has been the target of a synchronization primitive in the process (such as mutex_lock(), described on the mutex_init(3C) manual page) after td_ta_new(3C_DB) has been called to attach to the process and td_ta_sync_track- ing_enable() has been called to enable synchronization object tracking. The td_ta_sync_tracking_enable() function turns synchronization object tracking on or off for the process identified by ta_p, depending on whether on_off is 0 (off) or non-zero (on). The td_sync_get_info() function fills in the td_syncinfo_t structure *si_p with values for the synchronization object identified by sh_p. The td_syncinfo_t structure contains the following fields: td_thragent_t *si_ta_p 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. psaddr_t si_sv_addr The address of the synchronization object in this target process's address space. td_sync_type_e si_type The type of the synchronization variable: mutex, condition variable, semaphore, or readers-writer lock. int si_shared_type If si_shared_type is non-zero, this synchronization object is process-shared, otherwise it is process-private. td_sync_flags_t si_flags Flags dependent on the type of the synchronization object. int si_state.sema_count Semaphores only. The current value of the semaphore int si_state.nreaders Readers-writer locks only. The number of readers currently holding the lock, or -1, if a writer is currently holding the lock. int si_state.mutex_locked For mutexes only. Non-zero if and only if the mutex is currently locked. int si_size The size of the synchronization object. uint8_t si_has_waiters Non-zero if and only if at least one thread is blocked on this synchronization object. uint8_t si_is_wlocked For reader-writer locks only. The value is non-zero if and only if this lock is held by a writer. uint8_t si_rcount PTHREAD_MUTEX_RECURSIVE mutexes only. If the mutex is held, the recursion count. uint8_t si_prioceiling PTHREAD_PRIO_PROTECT protocol mutexes only. The priority ceiling. td_thrhandle_t si_owner 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 is NULL if no one holds the mutex or write-lock. pid_t si_ownerpid Mutexes only. For a locked process-shared mutex, this is the process-ID of the process containing the owning thread. The td_sync_get_stats() function fills in the td_syncstats_t structure *ss_p with values for the synchronization object identified by sh_p. The td_syncstats_t structure contains an embedded td_syncinfo_t structure that is filled in as described above for td_sync_get_info(). In addition, usage statistics gathered since td_ta_sync_tracking_enable() was called to enable synchronization object tracking are returned in the ss_un.mutex, ss_un.cond, ss_un.rwlock, or ss_un.sema members of the td_syncstats_t structure, depending on the type of the synchroniza- tion object. The td_sync_setstate function modifies the state of synchronization object si_p, depending on the synchronization object type. For mutexes, td_sync_setstate is unlocked if the value is 0. Otherwise it is locked. For semaphores, the semaphore's count is set to the value. For reader-writer locks, the reader count set to the value if value is >0. The count is set to write-locked if value is -1. It is set to unlocked if the value is 0. Setting the state of a synchronization object from a libc_db interface may cause the synchronization object's semantics to be violated from the point of view of the threads in the target process. For example, if a thread holds a mutex, and td_sync_setstate is used to set the mutex to unlocked, then a different thread will also be able to subsequently acquire the same mutex. The td_sync_waiters function iterates over the set of thread handles of threads blocked on sh_p. The callback function cb is called once for each such thread handle, and is passed the thread handle and cb_data_p. If the callback function returns a non-zero value, iteration is terminated early. See td_ta_thr_iter(3C_DB). RETURN VALUES
TD_OK The call returned successfully. TD_BADTH An invalid thread handle was passed in. TD_DBERR A call to one of the imported interface routines failed. TD_ERR A libc_db-internal error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
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) SunOS 5.11 5 Jun 2007 td_sync_get_info(3C_DB)
All times are GMT -4. The time now is 07:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy