Tags: byanother, capability, closed, couldreally, dnotify, equivelent, files, functions, inotify, linux, modified, operating, reading, software, solaris, system

Solaris equivelent of inotify?

On Software » Solaris Operating System

7,592 words with 9 Comments; publish: Mon, 19 May 2008 23:10:00 GMT; (40093.75, « »)

I was reading about the dnotify and inotify functions in Linux. I could

really use this capability for when files are opened/closed/modified by

another process in a Solaris application of mine.

Anyone know of a similar function/facility in Solaris?

Rick.

All Comments

Leave a comment...

  • 9 Comments
    • "Rick Ingham" <rdingham.solaris.todaysummary.com.comcast.net> wrote in message

      news:YYudnQib47AZHdHenZ2dnUVZ_s-dnZ2d.solaris.todaysummary.com.comcast.com...

      >I was reading about the dnotify and inotify functions in Linux. I could

      >really use this capability for when files are opened/closed/modified by

      >another process in a Solaris application of mine.

      > Anyone know of a similar function/facility in Solaris?

      > Rick.

      I think FAM is what you want.

      DS

      #1; Mon, 19 May 2008 23:12:00 GMT
    • In comp.unix.programmer David Schwartz <davids.solaris.todaysummary.com.webmaster.com> wrote:

      > "Rick Ingham" <rdingham.solaris.todaysummary.com.comcast.net> wrote in message

      > news:YYudnQib47AZHdHenZ2dnUVZ_s-dnZ2d.solaris.todaysummary.com.comcast.com...

      >

      > I think FAM is what you want.

      >

      That's just a wrapper, though. On Linux it uses dnotify, *BSD kqueue(2), and

      Solaris likely falls back to a stat(2) loop.

      So, in that case it might be easier just to use stat(2) yourself rather than

      install and wrestle with FAM.

      #2; Mon, 19 May 2008 23:13:00 GMT
    • William Ahern wrote:

      > In comp.unix.programmer David Schwartz <davids.solaris.todaysummary.com.webmaster.com> wrote:

      >

      >

      > That's just a wrapper, though. On Linux it uses dnotify, *BSD kqueue(2), a

      nd

      > Solaris likely falls back to a stat(2) loop.

      > So, in that case it might be easier just to use stat(2) yourself rather th

      an

      > install and wrestle with FAM.

      FAM doesn't support open/close notification. Appears to be only i-node

      modifications.

      What I need is to know when a file is opened and closed to synchronize

      access between two processes. I need to know when a command line

      background process gets a file open to proceed in the foreground

      process, and when the background process has caught up and closes the

      file. I'm doing this to coordinate with an external process I don't

      have any control over.

      Rick.

      #3; Mon, 19 May 2008 23:14:00 GMT
    • In article <zaidnZBGRuqzONDeRVn-vA.solaris.todaysummary.com.comcast.com>,

      Rick Ingham <rdingham.solaris.todaysummary.com.comcast.net> wrote:

      > William Ahern wrote:

      > FAM doesn't support open/close notification. Appears to be only i-node

      > modifications.

      > What I need is to know when a file is opened and closed to synchronize

      > access between two processes. I need to know when a command line

      > background process gets a file open to proceed in the foreground

      > process, and when the background process has caught up and closes the

      > file. I'm doing this to coordinate with an external process I don't

      > have any control over.

      > Rick.

      Well, you could modify the kernel to add this feature. Source is now

      availble.

      DeeDee, don't press that button! DeeDee! NO! Dee...

      #4; Mon, 19 May 2008 23:15:00 GMT
    • Michael Vilain wrote:

      > In article <zaidnZBGRuqzONDeRVn-vA.solaris.todaysummary.com.comcast.com>,

      > Rick Ingham <rdingham.solaris.todaysummary.com.comcast.net> wrote:

      >

      >

      > Well, you could modify the kernel to add this feature. Source is now

      > availble.

      >

      If this were just a toy system, or just one server, I'd be intrigued by

      the idea. But, there's no way the my employer will let me tinker at the

      kernel level for over 160 production data centers, over 200 servers.

      This program and process is no where near worth that kind of risk.

      Rick.

      #5; Mon, 19 May 2008 23:16:00 GMT
    • On 13/10/05 7:12, in article xL2dnekB0IF5Z9DeRVn-1g.solaris.todaysummary.com.comcast.com, "Rick

      Ingham" <rdingham.solaris.todaysummary.com.comcast.net> wrote:

      > Michael Vilain wrote:

      > If this were just a toy system, or just one server, I'd be intrigued by

      > the idea. But, there's no way the my employer will let me tinker at the

      > kernel level for over 160 production data centers, over 200 servers.

      > This program and process is no where near worth that kind of risk.

      I don't think anyone's suggested this yet - it *is* quite a hack - but you

      could monitor the background process closing the file via truss, and then

      have something monitor the truss output and signal the foreground process.

      OK, I said it was a hack :-)

      Maybe you could use dtrace instead of truss, but you get the idea.

      Cheers,

      Chris

      #6; Mon, 19 May 2008 23:17:00 GMT
    • Rick Ingham schrieb:

      > FAM doesn't support open/close notification. Appears to be only i-node

      > modifications.

      > What I need is to know when a file is opened and closed to synchronize

      > access between two processes. I need to know when a command line

      > background process gets a file open to proceed in the foreground

      > process, and when the background process has caught up and closes the

      > file. I'm doing this to coordinate with an external process I don't

      > have any control over.

      > Rick.

      you can get more control over a process than you might think,

      as long as you have all necessary rights to do this...

      What about LD_PRELOAD'ing special versions of open(2) and close(2) and

      trigger on those files that you care about and add standard file locking

      using flock(3ucb) or lockf(3c)?

      HTH,

      Tom

      #7; Mon, 19 May 2008 23:18:00 GMT
    • Rick Ingham wrote:

      > Michael Vilain wrote:

      [vbcol=seagreen]

      > If this were just a toy system, or just one server, I'd be intrigued by

      > the idea. But, there's no way the my employer will let me tinker at the

      > kernel level for over 160 production data centers, over 200 servers.

      > This program and process is no where near worth that kind of risk.

      Do you have control over the file which is being opened and closed? You

      could put a FIFO in its place, and you'd get the notifications in that

      case. (Didn't work on FreeBSD 4.x last time I needed it, though.)

      But FIFO doesn't work too well if there are multiple readers and writers,

      so maybe something else would work better. On Solaris maybe you could use

      fattach() to connect it with your streams module, for example.

      If you tell us more about your constraints, somebody might be able to come

      up with a better idea. Information about the OS you're using would also be

      helpful; your post is crossposted to Solaris, Linux and general Unix

      programming groups, so I can't tell the portability requirements.

      .-. .-. Yes, I am an agent of Satan, but my duties are largely

      (_ \ / _) ceremonial.

      |

      | dave.solaris.todaysummary.com.fly.srk.fer.hr

      #8; Mon, 19 May 2008 23:19:00 GMT
    • Rick Ingham wrote:

      > What I need is to know when a file is opened and closed to synchronize

      > access between two processes. I need to know when a command line

      > background process gets a file open to proceed in the foreground

      > process, and when the background process has caught up and closes the

      > file. I'm doing this to coordinate with an external process I don't

      > have any control over.

      > Rick.

      Just a thought. Is there any way you could have this process you have

      no control over access the data via fifos or domain sockets serviced by

      processes you do have control over?

      -- ced

      Chuck Dillon

      Senior Software Engineer

      NimbleGen Systems Inc.

      #9; Mon, 19 May 2008 23:20:00 GMT