[nos-bbs] getting mail into the BBS

Torsten Harenberg harenberg at physik.uni-wuppertal.de
Sat Mar 18 15:44:26 EST 2006


Dear list,

so.. replying to my own mail, as I found the "bug":

lseek on Mac OS X (Darwin) returns a 64-bit integer (as opposed to
many common implementations that return 32). Also he requires the 2nd 
option to be a 64-bit integer, not a 32 one.

Usually one would simply include <usistd.h>, but this is not done in 
JNOS for reasons explained in unix.c . So the lseek function is declared 
implicitly as "a function returning an integer".

(Futhermore, PowerPC architecture is big-endian, so if you truncate you 
will most likely just get a zero).

So I modified unix.c now with the following patch (THIS IS JUST A QUICK 
AND DIRTY HACK - if has to be properly #ifdef'ed to do that only under 
Darwin):

diff -u ../jnos2_orig/unix.h unix.h
--- ../jnos2_orig/unix.h        2005-01-05 04:08:17.000000000 +0100
+++ unix.h      2006-03-18 21:41:44.000000000 +0100
@@ -91,13 +91,15 @@
  #ifdef linux
  extern int unlink __ARGS((char *));
  #endif
+/* Need that for Darwin, too */
+extern int unlink __ARGS((char *));
  extern int fork __ARGS((void));
  extern int execvp __ARGS((char *, char **));
-extern int lseek __ARGS((int, long, int));
-extern int read __ARGS((int, void *, unsigned));
+extern long long lseek __ARGS((int, long long, int));
+extern long read __ARGS((int, void *, unsigned));
  extern int close __ARGS((int));
  extern int access __ARGS((char *, int));
-extern int write __ARGS((int, void *, unsigned));
+extern long write __ARGS((int, void *, unsigned));
  #ifndef sun
  extern char *getcwd __ARGS((char *, int));
  #endif
@@ -109,7 +111,7 @@
  #if defined(linux) && (__GNU_LIBRARY__  >  1)
  extern int ioctl __ARGS((int, unsigned long int, ...));
  #else
-extern int ioctl __ARGS((int, int, int *));
+extern int ioctl __ARGS((int, unsigned long int, ...));
  #endif
  #ifdef __cplusplus
  }
@@ -122,7 +124,7 @@
  #define _SOLIDCURSOR 2

  #ifndef tell
-#define tell(fh)       lseek(fh,0L,1);
+#define tell(fh)       lseek(fh,0LL,1);
  #endif


Maiko: would you be so kind and could you include that in a proper way, 
please? I will send you a new binary (with a working BBS) shortly.

73s de Torsten DL1THM


-- 
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>                                                              <>
<> Torsten Harenberg         harenberg at physik.uni-wuppertal.de  <>
<> Bergische Universitaet                                       <>
<> FB C - Physik             Tel.: +49 (0)202 439-3521          <>
<> Gaussstr. 20              Fax : +49 (0)202 439-2811          <>
<> 42097 Wuppertal                                              <>
<>                                                              <>
<><><><><><><>< Of course it runs NetBSD http://www.netbsd.org ><>




More information about the nos-bbs mailing list