Re: Current compilation status

From: Petter Reinholdtsen (pere@hungry.com)
Date: Wed Jul 19 2000 - 08:42:55 PDT

  • Next message: Oliver Rauch: "Re: astra 2400 S + ATA"

    > isfdtype() is as far as I know, the only way to test if a file
    > descriptor is a socket. If someone want to make a proper
    > implementation for AIX and Solaris, please update lib/isfdtype.c. It
    > currently returns 0 (false) on all platforms where the native
    > function is missing.

    Olly Betts send me an email suggesting the following implementation.
    I have not had a look at how we can autodetect the required features,
    and I do not have time to look at this now. Would this implementation
    work on all the platforms which are missing isfdtype().

      int
      isfdtype(int fd, int fdtype)
      {
        struct stat st;
        if (fstat(fd, &st) == -1) return 0; /* couldn't stat fd */
      #if defined(HAVE_S_ISSOCK)
        return S_ISSOCK(st.st_mode) != 0;
      #elif defined(HAVE_S_IFSOCK)
        return (st.st_mode & S_IFMT) == S_IFSOCK;
      #else
        return 0;
      #endif
      }

    It is not really generic, but at the moment, we only need the socket
    test.

    -- 
    ##>  Petter Reinholdtsen <##    | pere@td.org.uit.no
     O-  <SCRIPT Language="Javascript">window.close()</SCRIPT>
    http://www.hungry.com/~pere/    | Go Mozilla, go! Go!
    

    -- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com



    This archive was generated by hypermail 2b29 : Wed Jul 19 2000 - 08:43:03 PDT