Repackaged Patches for QNX and install note

Sam Roberts sam at cogent.ca
Wed Mar 1 17:16:42 CET 2000


These are the same QNX patches as previous, but in a format that is
understandable to patch, and a not on how to apply them.

-- previous post

Here's some tiny patches for gpg under QNX. With
these patches (and if gcc is installed) it configures, builds, and the
test target reports it passes all (23) tests.


Here are the diffs. If they are not
accptable due to content or format just let me know. Otherwise, can
they be integrated?

sam at cogent.ca

-- a question --

  In util/secmem.c:

  QNX doesn't have the capability of paging *any* memory to disk, so
  it's safe to make lock_pool() a null op, *all* memory is locked in RAM.
  Should I do this, or do I misunderstand what mlock() does (I don't
  think I do)?

--

How to apply on a QNX system:

- download and compile/install GNU patch if you don't have it...
- download and install gcc if you don't have it...

- save the patch into a seperate file (see attachment for patch)
- untar gnupg-1.0.1
- patch it:

$ patch -p 1 <  the_patch_file

- if you have autoconf, bebuild configure from configure.in:

$ autoconf

- run configure, preferably using bash:

$ bash configure

- if you didn't have autoconf, hack config.h. Search for HAVE_CLOCK_GETTIME
  and change to being defined as 1

- make

- make test (ignore the unsafe memory and may cause core file messages), it
  should report success at the end.

- make install

Any QNX users who have problems with this, drop me a line. This works on my
systems but your mileage may vary.

Sam
sam at cogent.ca

--

Description of changes:

  config.h.in, configure.in:
  There's a dozen ways to get the time, QNX uses the POSIX clock_gettime(),
  I think it exists under HPUX and LynxOS as well so I added the test
  to the configure stuff, see below, so systems that have it will use it.

  cipher/random.c uses the clock_gettime() in the same way the old
  gettimeofday() does.


  cipher/rndunix.c: Interestingly, there are already QNX ifdefs in this file,
  but it's not complete. This is.

  config.guess and config.sub:
  For some reason, after close to 20 years, QNX still hasn't made it
  into these "standard" GNU autoconf scripts. I've also posted these diffs
  to bug-gnu-utils (the suggested address in the autoconf docs) so maybe
  they'll be in the next autoconf, I'm getting tired of hacking them into
  every GNU package I compile.

------ cut below here to make the patch file -------------------------
diff -r -C 2 gnupg-1.0.1-scratch//config.h.in gnupg-1.0.1//config.h.in
*** gnupg-1.0.1-scratch//config.h.in    Sat Dec  4 06:35:59 1999
--- gnupg-1.0.1//config.h.in    Wed Mar  1 14:42:48 2000
***************
*** 195,198 ****
--- 195,201 ----
  #undef HAVE_GETTIMEOFDAY

+ /* Define if you have the clock_gettime function.  */
+ #undef HAVE_CLOCK_GETTIME
+
  /* Define if you have the memicmp function.  */
  #undef HAVE_MEMICMP
diff -r -C 2 gnupg-1.0.1-scratch//configure.in gnupg-1.0.1//configure.in
*** gnupg-1.0.1-scratch//configure.in   Thu Dec 16 04:10:38 1999
--- gnupg-1.0.1//configure.in   Wed Mar  1 14:43:08 2000
***************
*** 387,391 ****
  AC_FUNC_VPRINTF
  AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap)
! AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit)
  AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)

--- 387,391 ----
  AC_FUNC_VPRINTF
  AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap)
! AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit clock_gettime)
  AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)
diff -r -C 2 gnupg-1.0.1-scratch/cipher/random.c gnupg-1.0.1/cipher/random.c
*** gnupg-1.0.1-scratch/cipher/random.c Tue Oct 26 13:36:58 1999
--- gnupg-1.0.1/cipher/random.c Wed Mar  1 15:18:51 2000
***************
*** 43,46 ****
--- 43,49 ----
    #include <sys/times.h>
  #endif
+ #ifdef HAVE_CLOCK_GETTIME
+   #include <time.h>
+ #endif
  #ifdef HAVE_GETRUSAGE
    #include <sys/resource.h>
***************
*** 399,402 ****
--- 402,412 ----
    add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
    add_randomness( &tv.tv_usec, sizeof(tv.tv_usec), 1 );
+     }
+   #elif HAVE_CLOCK_GETTIME
+     { struct timespec tv;
+   if( clock_gettime( CLOCK_REALTIME, &tv ) == -1 )
+       BUG();
+   add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
+   add_randomness( &tv.tv_nsec, sizeof(tv.tv_nsec), 1 );
      }
    #else /* use times */
diff -r -C 2 gnupg-1.0.1-scratch/cipher/rndunix.c gnupg-1.0.1/cipher/rndunix.c
*** gnupg-1.0.1-scratch/cipher/rndunix.c    Sat Oct  9 09:43:12 1999
--- gnupg-1.0.1/cipher/rndunix.c    Wed Mar  1 14:46:12 2000
***************
*** 76,82 ****
  #include <sys/resource.h>
  #endif                /* __QNX__ */
! #ifdef _AIX
  #include <sys/select.h>
! #endif                /* _AIX */
  #ifndef __QNX__
  #include <sys/shm.h>
--- 76,82 ----
  #include <sys/resource.h>
  #endif                /* __QNX__ */
! #if defined( _AIX ) || defined( __QNX__ )
  #include <sys/select.h>
! #endif                /* _AIX || __QNX__ */
  #ifndef __QNX__
  #include <sys/shm.h>
***************
*** 91,94 ****
--- 91,98 ----
  /* #include <kitchensink.h> */
  #include <errno.h>
+ #ifdef __QNX__
+ #include <signal.h>
+ #include <process.h>
+ #endif                /* __QNX__ */

  #include "types.h"  /* for byte and u32 typedefs */
diff -r -C 2 gnupg-1.0.1-scratch/scripts/config.guess gnupg-1.0.1/scripts/config.guess
*** gnupg-1.0.1-scratch/scripts/config.guess    Wed Aug  4 04:45:24 1999
--- gnupg-1.0.1/scripts/config.guess    Wed Mar  1 14:49:59 2000
***************
*** 69,72 ****
--- 69,75 ----

  case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+   *:QNX:*:*)
+   echo i386-pc-qnx
+   exit 0 ;;
      alpha:OSF1:*:*)
    if test $UNAME_RELEASE = "V4.0"; then
diff -r -C 2 gnupg-1.0.1-scratch/scripts/config.sub gnupg-1.0.1/scripts/config.sub
*** gnupg-1.0.1-scratch/scripts/config.sub  Wed Aug  4 04:45:25 1999
--- gnupg-1.0.1/scripts/config.sub  Wed Mar  1 14:50:23 2000
***************
*** 882,885 ****
--- 882,888 ----
        os=-solaris2
        ;;
+   -qnx)
+       os=-qnx
+       ;;
    -svr4*)
        os=-sysv4




More information about the Gnupg-devel mailing list