473,569 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

count of file descriptors

Hi,
I have a requirement in which I need to count the number
of file descriptors associated with a file. To be more clear...A file
can be opened by several processes say in read only mode. I would like
to count the number of such file opens on particular file at a given
instant of time. Any C library function or unix command that can solve
my problem please...?

Nov 14 '05 #1
1 2054
up******@gmail. com wrote:
# Hi,
# I have a requirement in which I need to count the number
# of file descriptors associated with a file. To be more clear...A file
# can be opened by several processes say in read only mode. I would like
# to count the number of such file opens on particular file at a given
# instant of time. Any C library function or unix command that can solve
# my problem please...?

No. Some unices provide something like this, some don't; outside of unix,
some do, some don't. Among those that do, there's no standardised
interface.

Perhaps if you're trying to serialise file access, you can try file locking.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I hope it feels so good to be right. There's nothing more
exhilirating pointing out the shortcomings of others, is there?
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1802
by: François Pinard | last post by:
This question is a bit technical, but hopefully, this list will offer me good hints or nice solutions. Happily enough for me, it often does! :-) I would need to recognise and play with descriptor types, like: member descriptors method descriptors getset descriptors wrapper descriptors
14
1625
by: Antoon Pardon | last post by:
Can anyone explain why descriptors only work when they are an attribute to an object or class. I think a lot of interesting things one can do with descriptors would be just as interesting if the object stood on itself instead of being an attribute to an other object. So what are the reasons for limiting this feature in such a way? --...
5
3547
by: JG | last post by:
Hi all, Does anyone know how the implementations on Linux and Windows handle synchronization between a read and write FD open to the same file. For example, if I have 2 FD open to file X.txt. 1 I use for reading, the other for writing. If I write to position 125 on the write_FD, call flush, and then turn around and read from the read_FD...
36
2583
by: Roman Mashak | last post by:
Hello, All! I implemented simple program to eliminate entry from the file having the following structure (actually it's config file of 'named' DNS package for those who care and know): options { directory "/var/named"; listen-on { 192.168.11.22; 127.0.0.1; }; forwarders { 168.126.63.1; };
0
1372
by: jfigueiras | last post by:
>I have a problem with the module subprocess! As many other programs... I'm not sure what you mean by "non-standard file descriptors". The other program is free to open, read, write, etc any file he wants - are you trying to trap any file operation it may want to do? You *could* do such things -google for "code injection" and "API...
1
64043
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts,...
5
5248
by: yinglcs | last post by:
I have a c/c++ program in linux. I would like to know if I kill my program (e.g. exit(1)), will it release all the file descriptors my program held (regardless if I call close(fd) of each file descriptor)? Thank you.
8
12001
ashitpro
by: ashitpro | last post by:
Understanding Ext-2 file system:chapter 1 The first block in each Ext2 partition is never managed by the Ext2 filesystem, because it is reserved for the partition boot sector. The rest of the Ext2 partition is split into block groups, each of which has the layout shown in Image 2. As you will notice from the figure, some data structures...
2
5418
by: DJ Dharme | last post by:
Hi all, I am writing a multi-threaded application in c++ running on solaris. I have a file which is updated by a single thread by appending data into the file and at same time the other threads are reading the content written into the file. Can anybody tell me is there a performance or any other gain (except for the multex locking) by using...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.