1
0
forked from pool/sane-backends
sane-backends/replace-HZ-by-sysconf_SC_CLK_TCK.patch

33 lines
829 B
Diff

--- sanei/sanei_scsi.c 22 Nov 2005 21:17:20 -0000 1.58
+++ sanei/sanei_scsi.c 19 Jan 2007 07:10:30 -0000
@@ -281,6 +281,20 @@ static char lastrcmd[16]; /* hold comman
# define MAX_DATA (32*1024)
#endif
+#ifdef SG_SET_TIMEOUT
+# ifdef _SC_CLK_TCK
+# define GNU_HZ sysconf(_SC_CLK_TCK)
+# else
+# ifdef HZ
+# define GNU_HZ HZ
+# else
+# ifdef CLOCKS_PER_SEC
+# define GNU_HZ CLOCKS_PER_SEC
+# endif
+# endif
+# endif
+#endif
+
/* default timeout value: 120 seconds */
static int sane_scsicmd_timeout = 120;
int sanei_scsi_max_request_size = MAX_DATA;
@@ -1273,7 +1287,7 @@ sanei_scsi_open (const char *dev, int *f
disconnect... ;-( */
{
int timeout;
- timeout = sane_scsicmd_timeout * HZ;
+ timeout = sane_scsicmd_timeout * GNU_HZ;
ioctl (fd, SG_SET_TIMEOUT, &timeout);
}
#endif