]> arthur.barton.de Git - netatalk.git/commitdiff
Patches for OpenBSD
authorfranklahm <franklahm>
Sat, 3 Apr 2010 07:11:33 +0000 (07:11 +0000)
committerfranklahm <franklahm>
Sat, 3 Apr 2010 07:11:33 +0000 (07:11 +0000)
configure.in
distrib/initscripts/rc.atalk.bsd.tmpl
etc/afpd/quota.c
include/atalk/compat.h
include/atalk/dsi.h
libatalk/compat/Makefile.am
libatalk/compat/pselect.c [new file with mode: 0644]
libatalk/vfs/ea_sys.c
macros/db3-check.m4

index db8b60153175929e7cc9ba23a13458fe24814210..9dad52e1cfb9aa3b4cc2a51a863dbaee547f3c8c 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.240 2010-03-29 15:22:57 franklahm Exp $
+dnl $Id: configure.in,v 1.241 2010-04-03 07:11:33 franklahm Exp $
 dnl configure.in for netatalk
 
 AC_INIT(etc/afpd/main.c)
@@ -135,9 +135,8 @@ AC_TYPE_SIGNAL
 AC_FUNC_UTIME_NULL
 AC_FUNC_WAIT3
 AC_CHECK_FUNCS(getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strcasestr strstr strtoul strchr memcpy)
-AC_CHECK_FUNCS(backtrace_symbols setlocale nl_langinfo)
+AC_CHECK_FUNCS(backtrace_symbols setlocale nl_langinfo strlcpy strlcat setlinebuf dirfd pselect)
 AC_CHECK_FUNCS(waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
-AC_CHECK_FUNCS(strlcpy strlcat setlinebuf dirfd)
 AC_CHECK_FUNC(renameat, AC_DEFINE([_ATFILE_SOURCE], 1, AT file source)) 
 AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include <time.h>])
 AC_CACHE_SAVE
index 191055de6b8b1b9b6d39b1cb4b68a996e192288a..05010b7ba320b9b6f3cbfad4b1af6177f8287553 100755 (executable)
 ##     /usr/etc/modload -sym :ETCDIR:/netatalk.o;
 ##fi
 
+netatalk_conf=":ETCDIR:/netatalk.conf"
+
+[ -f ${netatalk_conf} ] && . ${netatalk_conf}
+
 echo -n 'starting netatalk daemons:'
+if [ X"${ATALKD_RUN}" != X"no" ]; then
 if [ -x :SBINDIR:/atalkd ]; then
        :SBINDIR:/atalkd;               echo -n ' atalkd'
 fi
@@ -25,21 +30,22 @@ if [ -x :BINDIR:/nbprgstr ]; then
        :BINDIR:/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:netatalk
        echo -n ' nbprgstr'
 fi
+fi
 
-if [ -x :SBINDIR:/papd ]; then
+if [ -x :SBINDIR:/papd -a X"${PAPD_RUN}" != X"no" ]; then
        :SBINDIR:/papd;         echo -n ' papd'
 fi
 
-if [ -x :SBINDIR:/cnid_metad ]; then
+if [ -x :SBINDIR:/cnid_metad -a X"${CNID_METAD_RUN}" != X"no" ]; then
     :SBINDIR:/cnid_metad $CNID_CONFIG
     echo -n ' cnid_metad'
 fi
 
-if [ -x :SBINDIR:/afpd ]; then
+if [ -x :SBINDIR:/afpd -a X"${AFPD_RUN}" != X"no" ]; then
        :SBINDIR:/afpd;         echo -n ' afpd'
 fi
 
-if [ -x :SBINDIR:/timelord ]; then
+if [ -x :SBINDIR:/timelord -a X"${TIMELORD_RUN}" != X"no" ]; then
        :SBINDIR:/timelord;             echo -n ' timelord'
 fi
 
index 26aae15be97f8e9852715d5d0ce8407365bbb190..9992948c1af20576823eca7abb8243f020cca49d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: quota.c,v 1.34 2010-02-10 14:05:37 franklahm Exp $
+ * $Id: quota.c,v 1.35 2010-04-03 07:11:35 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -41,6 +41,7 @@ char *strchr (), *strrchr ();
 
 #include <atalk/logger.h>
 #include <atalk/afp.h>
+#include <atalk/compat.h>
 
 #include "auth.h"
 #include "volume.h"
index 6820f7ba5f110d4b61b22326db81820c59ecb63c..429955349f74c9ca2572357c68851f5f359c1167 100644 (file)
@@ -92,3 +92,14 @@ int snprintf (char *str,size_t count,const char *fmt,...);
 #ifndef HAVE_VSNPRINTF
 int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
 #endif
+
+/* OpenBSD */
+#if defined(__OpenBSD__) && !defined(ENOTSUP)
+#define ENOTSUP EOPNOTSUPP
+#endif
+
+#if !defined(HAVE_PSELECT) || defined(__OpenBSD__)
+extern int pselect(int, fd_set * restrict, fd_set * restrict,
+                   fd_set * restrict, const struct timespec * restrict,
+                   const sigset_t * restrict);
+#endif
index fb45a30e0563dd9135053291cf42e7bd946a6c12..82da7a1595e517b0b0eea4ad761b4cb68d9dbd43 100644 (file)
 #include <atalk/server_child.h>
 #include <netatalk/endian.h>
 
+#ifdef __OpenBSD__
+#include <sys/socket.h>
+#endif
+
 /* What a DSI packet looks like:
  0                               32
  |-------------------------------|
index 63ccddd4dcc6fbd9d48f3df38ff4e69c49b0745f..ebe54b21a8b0d2b52213b3a352fe495af37a319a 100644 (file)
@@ -10,4 +10,5 @@ libcompat_la_SOURCES =        \
        strdup.c        \
        inet_aton.c     \
        rquota_xdr.c    \
+       pselect.c       \
        snprintf.c
diff --git a/libatalk/compat/pselect.c b/libatalk/compat/pselect.c
new file mode 100644 (file)
index 0000000..608996b
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that both the above copyright notice and this
+ * permission notice appear in all copies, that both the above
+ * copyright notice and this permission notice appear in all
+ * supporting documentation, and that the name of M.I.T. not be used
+ * in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.  M.I.T. makes
+ * no representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
+ * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+ * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $ */
+/* modified for OpenBSD by Masahito Yamaga (2010-02-02) */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#if !defined(HAVE_PSELECT) || defined(__OpenBSD__)
+
+#include <sys/select.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <signal.h>
+
+/*
+ * Emulate the POSIX 1003.1g-2000 `pselect' interface.  This is the
+ * same as the traditional BSD `select' function, except that it uses
+ * a timespec rather than a timeval, doesn't modify the timeout argument,
+ * and allows the user to specify a signal mask to apply during the select.
+ */
+int
+pselect(int count, fd_set * restrict rfds, fd_set * restrict wfds,
+        fd_set * restrict efds, const struct timespec * restrict timo,
+        const sigset_t * restrict mask)
+{
+    sigset_t omask;
+    struct timeval tvtimo, *tvp;
+    int rv, sverrno;
+
+    if (timo) {
+        TIMESPEC_TO_TIMEVAL(&tvtimo, timo);
+        tvp = &tvtimo;
+    } else
+        tvp = 0;
+
+    if (mask != 0) {
+        rv = sigprocmask(SIG_SETMASK, mask, &omask);
+        if (rv != 0)
+            return rv;
+    }
+
+    rv = select(count, rfds, wfds, efds, tvp);
+    if (mask != 0) {
+        sverrno = errno;
+        sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
+        errno = sverrno;
+    }
+
+    return rv;
+}
+
+#endif /* not HAVE_PSELECT || __OpenBSD__ */
index 079458562933ced7a034a56cb05d03792eb9ef4a..38e61cd41ee1a197532cdb6b01452130bc9f1b52 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  $Id: ea_sys.c,v 1.6 2010-03-12 15:16:49 franklahm Exp $
+  $Id: ea_sys.c,v 1.7 2010-04-03 07:11:36 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -49,6 +49,7 @@
 #include <atalk/vfs.h>
 #include <atalk/util.h>
 #include <atalk/unix.h>
+#include <atalk/compat.h>
 
 #ifndef ENOATTR
 #define ENOATTR ENODATA
index a9c66325bfa5d48fadf89639c1dcc43105c3a3a3..126c496b3f95c1a2781f390731789b359f82106d 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: db3-check.m4,v 1.21 2009-12-13 11:59:11 franklahm Exp $
+dnl $Id: db3-check.m4,v 1.22 2010-04-03 07:11:36 franklahm Exp $
 dnl Autoconf macros to check for the Berkeley DB library
 
 dnl -- check header for minimum version and return version in
@@ -28,7 +28,7 @@ AC_DEFUN([NETATALK_BDB_TRY_LINK],[
     atalk_cv_bdb_version=no
     maj=$atalk_cv_bdb_MAJOR
     min=$atalk_cv_bdb_MINOR
-    atalk_cv_bdb_try_libs="db$maj$min db$maj.$min db-$maj$min db-$maj.$min"
+    atalk_cv_bdb_try_libs="db$maj$min db$maj.$min db-$maj$min db-$maj.$min db"
 
     for lib in $atalk_cv_bdb_try_libs ; do
         LIBS="-l$lib $savedlibs"