fam
[Top] [All Lists]

[fam] Patch for Linux 2.2.14 and gcc 2.95.2

To: fam@xxxxxxxxxxx
Subject: [fam] Patch for Linux 2.2.14 and gcc 2.95.2
From: Ingvaldur Sigurjonsson <ingi@xxxxxxxxx>
Date: Tue, 02 May 2000 14:08:16 +0000
Sender: owner-fam@xxxxxxxxxxx
Hi,

I wanted to see the new efm so I decided to install the imon-patch to my
linux 2.2.14 which was successful. But trying to compile the
fam-oss-2.6.2 gave me some problems. I found rasters patch and applied
it, but I still had some problems, so I fixed them (I believe ;) so
enclosed you'll find the patch.

The patch is done from the orignal fam-oss-2.6.2 to fam-oss-2.6.2.ingi
which contains rasters patch and then fixes done by me. Hope it helps
anyone.

Oh and by the way, I've built the kernel with imon both as module and
into the kernel, but when I launch fam I get the following error:

fam[3811]: can't open /dev/imon: No such file or directory

And it's correct that there's no /dev/imon and I cant figure out what
major/minor number I should use to create it with mknod.

Hints are welcome.

regards
- Ingi

diff -c -r fam-oss-2.6.2/fam/Client.c++
fam-oss-2.6.2.ingi/fam/Client.c++
*** fam-oss-2.6.2/fam/Client.c++        Thu Mar  2 00:51:17 2000
--- fam-oss-2.6.2.ingi/fam/Client.c++   Mon May  1 15:06:21 2000
***************
*** 26,32 ****
  #include <stddef.h>
  #include <string.h>
  
! const in_addr Client::LOCALHOST = { htonl(INADDR_LOOPBACK) };
  
  Client::Client(const char *name, in_addr host)
      : myname(name ? strcpy(new char[strlen(name) + 1], name) : NULL),
--- 26,32 ----
  #include <stddef.h>
  #include <string.h>
  
! const in_addr Client::LOCALHOST() { htonl(INADDR_LOOPBACK); };
  
  Client::Client(const char *name, in_addr host)
      : myname(name ? strcpy(new char[strlen(name) + 1], name) : NULL),
diff -c -r fam-oss-2.6.2/fam/Client.h fam-oss-2.6.2.ingi/fam/Client.h
*** fam-oss-2.6.2/fam/Client.h  Thu Mar  2 00:51:21 2000
--- fam-oss-2.6.2.ingi/fam/Client.h     Mon May  1 15:07:09 2000
***************
*** 49,55 ****
  
  public:    
  
!     static const in_addr LOCALHOST;
  
      Client(const char *name, in_addr host);
      virtual ~Client();
--- 49,55 ----
  
  public:    
  
!     static const in_addr LOCALHOST();
  
      Client(const char *name, in_addr host);
      virtual ~Client();
diff -c -r fam-oss-2.6.2/fam/IMonIrix.c++
fam-oss-2.6.2.ingi/fam/IMonIrix.c++
*** fam-oss-2.6.2/fam/IMonIrix.c++      Thu Mar  2 00:51:18 2000
--- fam-oss-2.6.2.ingi/fam/IMonIrix.c++ Mon May  1 15:09:57 2000
***************
*** 35,41 ****
  #include "IMon.h"
  
  const intmask_t INTEREST_MASK = (IMON_CONTENT | IMON_ATTRIBUTE |
IMON_DELETE |
!                                IMON_EXEC | IMON_EXIT | IMON_RENAME);
  
  int IMon::imon_open()
  {
--- 35,45 ----
  #include "IMon.h"
  
  const intmask_t INTEREST_MASK = (IMON_CONTENT | IMON_ATTRIBUTE |
IMON_DELETE |
!                                IMON_EXEC | IMON_EXIT
! #ifdef IMON_RENAME
!                                | IMON_RENAME
! #endif
!                                );
  
  int IMon::imon_open()
  {
***************
*** 48,54 ****
  
  IMon::Status IMon::imon_express(const char *name, struct stat *status)
  {
!     struct interest interest = { (char *) name, status, INTEREST_MASK
};
      int rc = ioctl(imonfd, IMONIOC_EXPRESS, &interest);
      if (rc < 0)
      {
--- 52,63 ----
  
  IMon::Status IMon::imon_express(const char *name, struct stat *status)
  {
!       // The (famstat_t*)status cast should be ok as long as st_dev and 
!       // st_ino are the first members of struct stat
!       // Ingi 2000-04-30
!     struct interest interest = { (char *) name, 
!                                                               
reinterpret_cast<famstat_t*>(status), 
!                                                               INTEREST_MASK };
      int rc = ioctl(imonfd, IMONIOC_EXPRESS, &interest);
      if (rc < 0)
      {
***************
*** 84,91 ****
  
      if (can_revokdi)
      {
!       struct revokdi revokdi = { dev, ino, INTEREST_MASK };
!       int rc = ioctl(imonfd, IMONIOC_REVOKDI, &revokdi);
        if (rc < 0)
        {   Log::perror("IMONIOC_REVOKDI on \"%s\" failed", name);
            revokdi_failed = true;
--- 93,107 ----
  
      if (can_revokdi)
      {
!       // There's no struct revokdi defined in imon.h, but there's
!       // an 'struct revoke', and along with a IMONIOC define, it should
!       // be safe to use that instead (How should I know anyhow, I just
!       // want this to compile to see the new efm!!!)
!       // Ingi 2000-04-30
!       //      struct revokdi revokdi = { dev, ino, INTEREST_MASK };
!       //      int rc = ioctl(imonfd, IMONIOC_REVOKDI, &revokdi);
!       struct revoke revokdi = { dev, ino, INTEREST_MASK };
!       int rc = ioctl(imonfd, IMONIOC_REVOKE, &revokdi);
        if (rc < 0)
        {   Log::perror("IMONIOC_REVOKDI on \"%s\" failed", name);
            revokdi_failed = true;
diff -c -r fam-oss-2.6.2/fam/InternalClient.c++
fam-oss-2.6.2.ingi/fam/InternalClient.c++
*** fam-oss-2.6.2/fam/InternalClient.c++        Thu Mar  2 00:51:19 2000
--- fam-oss-2.6.2.ingi/fam/InternalClient.c++   Mon May  1 15:07:20 2000
***************
*** 31,37 ****
  
  InternalClient::InternalClient(const char *filename,
                               EventHandler h, void *closr)
!     : Client("myself", LOCALHOST), handler(h), closure(closr)
  {
      assert(filename);
      assert(h);
--- 31,37 ----
  
  InternalClient::InternalClient(const char *filename,
                               EventHandler h, void *closr)
!     : Client("myself", LOCALHOST()), handler(h), closure(closr)
  {
      assert(filename);
      assert(h);
diff -c -r fam-oss-2.6.2/fam/Listener.c++
fam-oss-2.6.2.ingi/fam/Listener.c++
*** fam-oss-2.6.2/fam/Listener.c++      Thu Mar  2 00:51:19 2000
--- fam-oss-2.6.2.ingi/fam/Listener.c++ Mon May  1 15:08:37 2000
***************
*** 153,159 ****
      // Get the new socket.
  
      struct sockaddr_in addr;
!     int addrlen = sizeof addr;
      int client_fd = accept(rendezvous_fd, (struct sockaddr *) &addr,
&addrlen);
      if (client_fd < 0)
      {
--- 153,159 ----
      // Get the new socket.
  
      struct sockaddr_in addr;
!     socklen_t addrlen = sizeof addr;
      int client_fd = accept(rendezvous_fd, (struct sockaddr *) &addr,
&addrlen);
      if (client_fd < 0)
      {
***************
*** 272,278 ****
      // Get the new socket.
  
      struct sockaddr_un sun = { AF_UNIX, "" };
!     int sunlen = sizeof(sun);
      int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen);
      if (client_fd < 0)
      {
--- 272,278 ----
      // Get the new socket.
  
      struct sockaddr_un sun = { AF_UNIX, "" };
!     socklen_t sunlen = sizeof(sun);
      int client_fd = accept(ofd, (struct sockaddr *) &sun, &sunlen);
      if (client_fd < 0)
      {
***************
*** 400,406 ****
      //  Accept a new ugly connection.
  
      struct sockaddr_un sun;
!     int sunlen = sizeof sun;
      int sock = accept(ugly, (struct sockaddr *)(&sun), &sunlen);
      if (sock < 0)
      {   Log::perror("accept");
--- 400,406 ----
      //  Accept a new ugly connection.
  
      struct sockaddr_un sun;
!     socklen_t sunlen = sizeof sun;
      int sock = accept(ugly, (struct sockaddr *)(&sun), &sunlen);
      if (sock < 0)
      {   Log::perror("accept");
diff -c -r fam-oss-2.6.2/fam/LocalClient.c++
fam-oss-2.6.2.ingi/fam/LocalClient.c++
*** fam-oss-2.6.2/fam/LocalClient.c++   Thu Mar  2 00:51:19 2000
--- fam-oss-2.6.2.ingi/fam/LocalClient.c++      Mon May  1 15:07:26 2000
***************
*** 29,35 ****
  #include "Cred.h"
  
  LocalClient::LocalClient(int fd, const struct sockaddr_un *addr, Cred
&cred)
! : TCP_Client(LOCALHOST, fd, cred)
  {
      assert(cred.is_valid());
      sun.sun_family = AF_UNIX;
--- 29,35 ----
  #include "Cred.h"
  
  LocalClient::LocalClient(int fd, const struct sockaddr_un *addr, Cred
&cred)
! : TCP_Client(LOCALHOST(), fd, cred)
  {
      assert(cred.is_valid());
      sun.sun_family = AF_UNIX;
diff -c -r fam-oss-2.6.2/fam/NFSFileSystem.c++
fam-oss-2.6.2.ingi/fam/NFSFileSystem.c++
*** fam-oss-2.6.2/fam/NFSFileSystem.c++ Thu Mar  2 00:51:19 2000
--- fam-oss-2.6.2.ingi/fam/NFSFileSystem.c++    Mon May  1 15:09:12 2000
***************
*** 26,31 ****
--- 26,32 ----
  #include <assert.h>
  #include <mntent.h>
  #include <stdlib.h>
+ #include <stdio.h>    /* for sscanf(...) */
  #include <string.h>
  
  #include "Log.h"
diff -c -r fam-oss-2.6.2/fam/Scheduler.c++
fam-oss-2.6.2.ingi/fam/Scheduler.c++
*** fam-oss-2.6.2/fam/Scheduler.c++     Thu Mar  2 00:51:20 2000
--- fam-oss-2.6.2.ingi/fam/Scheduler.c++        Mon May  1 15:02:29 2000
***************
*** 232,238 ****
  Scheduler::trim_fdinfo()
  {
      for (FDInfo *fp = &fdinfo[nfds - 1]; nfds > 0; --nfds, --fp)
!       if (fp->read.handler || fp->write.handler)
            break;
  
      if (!nfds)
--- 232,238 ----
  Scheduler::trim_fdinfo()
  {
      for (FDInfo *fp = &fdinfo[nfds - 1]; nfds > 0; --nfds, --fp)
!       if (fp->read.iohandler || fp->write.iohandler)
            break;
  
      if (!nfds)
***************
*** 249,256 ****
      assert(fd >= 0);
      assert(handler);
      FDInfo *fp = fd_to_info(fd);
!     IOHandler old_handler = (fp->*(iotype->iotype)).handler;
!     (fp->*(iotype->iotype)).handler = handler;
      (fp->*(iotype->iotype)).closure = closure;
      assert(!old_handler || FD_ISSET(fd, &iotype->fds));
      if (!FD_ISSET(fd, &iotype->fds))
--- 249,256 ----
      assert(fd >= 0);
      assert(handler);
      FDInfo *fp = fd_to_info(fd);
!     IOHandler old_handler = (fp->*(iotype->iotype)).iohandler;
!     (fp->*(iotype->iotype)).iohandler = handler;
      (fp->*(iotype->iotype)).closure = closure;
      assert(!old_handler || FD_ISSET(fd, &iotype->fds));
      if (!FD_ISSET(fd, &iotype->fds))
***************
*** 266,273 ****
  {
      assert(fd >= 0 && fd < nfds);
      FDInfo *fp = fd_to_info(fd);
!     IOHandler old_handler = (fp->*(iotype->iotype)).handler;
!     (fp->*(iotype->iotype)).handler = NULL;
      (fp->*(iotype->iotype)).closure = NULL;
      trim_fdinfo();
      assert(old_handler);
--- 266,273 ----
  {
      assert(fd >= 0 && fd < nfds);
      FDInfo *fp = fd_to_info(fd);
!     IOHandler old_handler = (fp->*(iotype->iotype)).iohandler;
!     (fp->*(iotype->iotype)).iohandler = NULL;
      (fp->*(iotype->iotype)).closure = NULL;
      trim_fdinfo();
      assert(old_handler);
***************
*** 311,317 ****
            if (FD_ISSET(fd, fds))
            {   FDInfo *fp = &fdinfo[fd];
                assert(iotype == &FDInfo::read || iotype == &FDInfo::write);
!               (fp->*iotype).handler(fd, (fp->*iotype).closure);
                // Remember, handler may move fdinfo array.
            }
  }
--- 311,317 ----
            if (FD_ISSET(fd, fds))
            {   FDInfo *fp = &fdinfo[fd];
                assert(iotype == &FDInfo::read || iotype == &FDInfo::write);
!               (fp->*iotype).iohandler(fd, (fp->*iotype).closure);
                // Remember, handler may move fdinfo array.
            }
  }
diff -c -r fam-oss-2.6.2/fam/Scheduler.h
fam-oss-2.6.2.ingi/fam/Scheduler.h
*** fam-oss-2.6.2/fam/Scheduler.h       Thu Mar  2 00:51:24 2000
--- fam-oss-2.6.2.ingi/fam/Scheduler.h  Mon May  1 15:03:37 2000
***************
*** 91,100 ****
  
      //  Per-filedescriptor info is the set of three handlers and their
      //  closures.
- 
      struct FDInfo {
        struct handler {
!           IOHandler handler;
            void *closure;
        } read, write;
      };
--- 91,99 ----
  
      //  Per-filedescriptor info is the set of three handlers and their
      //  closures.
      struct FDInfo {
        struct handler {
!             IOHandler iohandler;
            void *closure;
        } read, write;
      };


-- 
---------------------------------------------------------
Ingvaldur Þ. Sigurjónsson                       Avenir AB
ingi@xxxxxxxxx

--
Source code, list archive, and docs: http://oss.sgi.com/projects/fam/
To unsubscribe: echo unsubscribe fam | mail majordomo@xxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>