[PATCH 14/15 ver2] tgt: os.h: semtimedop not available on BSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

diff --git a/usr/bsd/os.c b/usr/bsd/os.c
index d486b24..d53d05f 100644
--- a/usr/bsd/os.c
+++ b/usr/bsd/os.c
@@ -82,3 +82,8 @@ int bsd_setsockopt(int s, int level, int optname, const void *optval,
 	return setsockopt(s, level, optname, optval, optlen);
 }
 
+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 1803858..733f5d4 100644
--- a/usr/linux/os.c
+++ b/usr/linux/os.c
@@ -123,3 +123,9 @@ int os_getnameinfo_ss(struct sockaddr_storage *ss, char *host, size_t hostlen,
 	return getnameinfo((struct sockaddr *)ss, sizeof(*ss), host, hostlen,
 			   serv, servlen, flags);
 }
+
+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 e72ce3a..2061e30 100644
--- a/usr/os.h
+++ b/usr/os.h
@@ -26,4 +26,9 @@ struct sockaddr_storage;
 int os_getnameinfo_ss(struct sockaddr_storage *ss, char *host, size_t hostlen,
                       char *serv, size_t servlen, int flags);
 
+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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux