Re: I need to watch a file descriptor while I don't know the corresponding file path

43 views
Skip to first unread message

Ujjwal Thaakar

unread,
Apr 22, 2013, 11:10:23 AM4/22/13
to nod...@googlegroups.com
I propose we write one. Do you guys think I should do it?

On Sunday, April 21, 2013 7:25:05 PM UTC+5:30, Ujjwal Thaakar wrote:
Is there any provision like fs.Watch but for file descriptors?

Matt

unread,
Apr 22, 2013, 11:14:59 AM4/22/13
to nod...@googlegroups.com
If you're on Linux you can probably watch /proc/<pid>/fd/<fdno>


On Sun, Apr 21, 2013 at 9:55 AM, Ujjwal Thaakar <ujjwal...@gmail.com> wrote:
Is there any provision like fs.Watch but for file descriptors?

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Nikhil Marathe

unread,
Apr 22, 2013, 11:19:10 AM4/22/13
to nod...@googlegroups.com

Fds can refer to non files so there doesn't seem to be js level support. You'll want to use UV_poll_t https://github.com/search?q=uv_poll_t+repo%3AJoyent%2Fnode&ref=searchresults&type=Code

Nikhil

Ujjwal Thaakar

unread,
Apr 22, 2013, 11:34:51 AM4/22/13
to nod...@googlegroups.com
I'm really looking for a *nix level support


You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/e2IHI4l5AW4/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Thanks
Ujjwal

Ujjwal Thaakar

unread,
Apr 22, 2013, 11:35:04 AM4/22/13
to nod...@googlegroups.com
When there is stat, there is fstat so I see it only reasonable that there should be a FWatch support at the js level and then Watch can be a special case of this. Watch does the same thing I guess at the backend using UV_poll_t so why not give direct support to watching fds. What do you think?


You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/e2IHI4l5AW4/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Thanks
Ujjwal

Nikhil Marathe

unread,
Apr 22, 2013, 11:50:57 AM4/22/13
to nod...@googlegroups.com

File watchers use is specific routines at the back such as inotify, kqueue or fsevent. That said this is not the same as what UV_poll_t does. The former is for watching higher level changes to files, that is be notified when the file changes, the latter is for I/O readiness.

What is your use case for adding FD based fswatch?

Nikhil

Ujjwal Thaakar

unread,
Apr 22, 2013, 12:14:41 PM4/22/13
to nod...@googlegroups.com
I want to read the file descriptor returned by libpcap to know when I should read the live capture dump

Ujjwal Thaakar

unread,
Apr 22, 2013, 12:15:32 PM4/22/13
to nod...@googlegroups.com
This was possible previously with IOWatcher but what now?
--
Thanks
Ujjwal

Ben Noordhuis

unread,
Apr 22, 2013, 1:58:28 PM4/22/13
to nod...@googlegroups.com
On Mon, Apr 22, 2013 at 6:15 PM, Ujjwal Thaakar <ujjwal...@gmail.com> wrote:
> This was possible previously with IOWatcher but what now?

new net.Socket({ fd: fd })
Reply all
Reply to author
Forward
0 new messages