[stgt] [PATCH 07/11] os.h: semtimedop not available on BSD

Boaz Harrosh bharrosh at panasas.com
Thu Mar 12 12:02:21 CET 2009


Return error for semtimedop on BSD. Logger can not
be used directlly. On BSD use redirected IO.

Signed-off-by: Boaz Harrosh <bharrosh at panasas.com>
---
 usr/bsd/os.c   |    6 ++++++
 usr/linux/os.c |    6 ++++++
 usr/log.c      |    3 ++-
 usr/os.h       |    5 +++++
 4 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/usr/bsd/os.c b/usr/bsd/os.c
index 7fec458..d8bd51a 100644
--- a/usr/bsd/os.c
+++ b/usr/bsd/os.c
@@ -48,3 +48,9 @@ int os_blockdev_size(int fd, uint64_t *size)
 {
 	return ioctl(fd, DIOCGMEDIASIZE, &size);
 }
+
+int os_semtimedop (int __semid, struct sembuf *__sops, size_t __nsops,
+		       __const struct timespec *__timeout)
+{
+	return -1;
+}
diff --git a/usr/linux/os.c b/usr/linux/os.c
index b4027cb..cee4f47 100644
--- a/usr/linux/os.c
+++ b/usr/linux/os.c
@@ -104,3 +104,9 @@ int os_blockdev_size(int fd, uint64_t *size)
 {
 	return ioctl(fd, BLKGETSIZE64, size);
 }
+
+int os_semtimedop (int __semid, struct sembuf *__sops, size_t __nsops,
+		       __const struct timespec *__timeout)
+{
+	return semtimedop (__semid, __sops, __nsops, __timeout);
+}
diff --git a/usr/log.c b/usr/log.c
index 056314a..c1dfabb 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -30,6 +30,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include "os.h"
 #include "log.h"
 
 #define SEMKEY	0xA7L
@@ -260,7 +261,7 @@ static void dolog(int prio, const char *fmt, va_list ap)
 		ops.sem_num = 0;
 		ops.sem_flg = 0;
 		ops.sem_op = -1;
-		if (semtimedop(la->semid, &ops, 1, &ts) < 0) {
+		if (os_semtimedop(la->semid, &ops, 1, &ts) < 0) {
 			syslog(LOG_ERR, "semop up failed");
 			return;
 		}
diff --git a/usr/os.h b/usr/os.h
index 03ad898..28c8973 100644
--- a/usr/os.h
+++ b/usr/os.h
@@ -19,4 +19,9 @@ int os_oom_adjust(void);
 
 int os_blockdev_size(int fd, uint64_t *size);
 
+struct sembuf;
+struct timespec;
+int os_semtimedop (int __semid, struct sembuf *__sops, size_t __nsops,
+		       __const struct timespec *__timeout);
+
 #endif /* ndef __TGT_OS_H__*/
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list