--- /dev/null
+## $Id$ --*- makefile -*--
+
+## Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ENSC_VECTOR_SRCS = ensc_vector/vector-clear.c \
+ ensc_vector/vector-free.c \
+ ensc_vector/vector-init.c \
+ ensc_vector/vector-insert.c \
+ ensc_vector/vector-popback.c \
+ ensc_vector/vector-pushback.c \
+ ensc_vector/vector-resize.c \
+ ensc_vector/vector-search.c \
+ ensc_vector/vector-sort.c \
+ ensc_vector/vector-unique.c
+
+ENSC_VECTOR_HDRS = ensc_vector/vector.h \
+ ensc_vector/vector.hc
+
+ENSC_VECTOR_XHDRS = ensc_vector/vector-resizeinternal.hc \
+ ensc_vector/vector-internal.h
+
+ENSC_VECTOR_LIBS = libensc_vector.a
+libensc_vector_a_SOURCES = $(ENSC_VECTOR_SRCS)
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include <assert.h>
+
+void
+Vector_clear(struct Vector *vec)
+{
+ assert(vec!=0);
+ vec->count = 0;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include <assert.h>
+
+void
+Vector_free(struct Vector *vec)
+{
+ assert(vec!=0);
+ free(vec->data);
+
+#ifndef NDEBUG
+ vec->count = 0xdeadbeef;
+ vec->allocated = 0xdeadbeef;
+ vec->elem_size = 0xdeadbeef;
+ vec->data = (void *)(0xdeadbeef);
+#endif
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include <assert.h>
+
+void
+Vector_init(struct Vector *vec, size_t elem_size)
+{
+ assert(vec!=0);
+ assert(elem_size!=0);
+
+ vec->elem_size = elem_size;
+ vec->data = 0;
+ vec->count = 0;
+ vec->allocated = 0;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include <string.h>
+
+void *
+Vector_insert(struct Vector *vec, void const *key,
+ int (*compare)(const void *, const void *))
+{
+ char * data;
+ char * end_ptr = Vector_pushback(vec);
+
+ for (data=vec->data; data<end_ptr; data += vec->elem_size) {
+ if (compare(key, data)>0) {
+ memmove(data, data+vec->elem_size,
+ (char *)(end_ptr) - (char *)(data));
+ return data;
+ }
+ }
+
+ return end_ptr;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_UTIL_VSERVER_SRC_VECTOR_VECTOR_INTERNAL_H
+#define H_UTIL_VSERVER_SRC_VECTOR_VECTOR_INTERNAL_H
+
+#ifndef VECTOR_SET_THRESHOLD
+# define VECTOR_SET_THRESHOLD 20/16
+#endif
+
+#ifndef VECTOR_DEC_THRESHOLD
+# define VECTOR_DEC_THRESHOLD 24/16
+#endif
+
+
+
+#endif // H_UTIL_VSERVER_SRC_VECTOR_VECTOR_INTERNAL_H
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include <assert.h>
+
+void
+Vector_popback(struct Vector *vec)
+{
+ assert(vec->count>0);
+
+ if (vec->count>0) --vec->count;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include "vector-resizeinternal.hc"
+
+void *
+Vector_pushback(struct Vector *vec)
+{
+ ++vec->count;
+ if (vec->allocated<vec->count)
+ Vector_resizeInternal(vec);
+
+ return (char *)(vec->data) + ((vec->count-1) * vec->elem_size);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+#include "vector-resizeinternal.hc"
+
+void
+Vector_resize(struct Vector *vec)
+{
+ if (vec->allocated * VECTOR_DEC_THRESHOLD > vec->count+1)
+ Vector_resizeInternal(vec);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector-internal.h"
+#include <assert.h>
+
+#define ENSC_WRAPPERS_STDLIB 1
+#include <wrappers.h>
+
+static void
+Vector_resizeInternal(struct Vector *vec)
+{
+ vec->allocated = vec->count * VECTOR_SET_THRESHOLD;
+ ++vec->allocated;
+
+ assert(vec->allocated >= vec->count);
+
+ vec->data = Erealloc(vec->data, vec->allocated * vec->elem_size);
+ assert(vec->data!=0);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+
+#include <stdlib.h>
+#include <assert.h>
+
+
+void *
+Vector_search(struct Vector *vec, void const *key,
+ int (*compare)(const void *, const void *))
+{
+ if (vec->count==0) return 0;
+ assert(vec->data!=0);
+
+ return bsearch(key, vec->data, vec->count, vec->elem_size, compare);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+
+#include <stdlib.h>
+#include <assert.h>
+
+void
+Vector_sort(struct Vector *vec, int (*compare)(const void *, const void *))
+{
+ if (vec->count==0) return;
+
+ qsort(vec->data, vec->count, vec->elem_size, compare);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vector.h"
+
+#include <assert.h>
+#include <string.h>
+
+ // TODO: do not iterate from begin to end but in the reverse direction. This should be more
+ // effective.
+void
+Vector_unique(struct Vector *vec, int (*compare)(const void *, const void *))
+{
+ size_t idx;
+
+ if (vec->count<2) return;
+
+ for (idx=0; idx+1<vec->count; ++idx) {
+ char *ptr = (char *)(vec->data) + idx*vec->elem_size;
+ char *next_ptr = ptr + vec->elem_size;
+ size_t next_idx = idx + 1;
+
+ while (next_idx<vec->count &&
+ compare(ptr, next_ptr)==0) {
+ ++next_idx;
+ next_ptr += vec->elem_size;
+ }
+
+ if (next_idx==vec->count)
+ vec->count = idx+1;
+ else if (next_idx-idx > 1) {
+ memmove(ptr + vec->elem_size,
+ next_ptr, (vec->count - next_idx)*vec->elem_size);
+ vec->count -= (next_idx-idx-1);
+ }
+ }
+}
+
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2002,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+
+#ifndef H_UTILVSERVER_VECTOR_VECTOR_H
+#define H_UTILVSERVER_VECTOR_VECTOR_H
+
+#include <stdlib.h>
+
+struct Vector
+{
+ void *data;
+ size_t count;
+ size_t allocated;
+
+ size_t elem_size;
+};
+
+void Vector_init(struct Vector *, size_t elem_size);
+void Vector_free(struct Vector *);
+void * Vector_search(struct Vector *, void const *key, int (*compar)(const void *, const void *));
+void Vector_sort(struct Vector *, int (*compar)(const void *, const void *));
+void Vector_unique(struct Vector *, int (*compar)(const void *, const void *));
+void * Vector_pushback(struct Vector *);
+void * Vector_insert(struct Vector *, void const *key, int (*compar)(const void *, const void *));
+void Vector_popback(struct Vector *);
+void Vector_resize(struct Vector *vec);
+void Vector_clear(struct Vector *vec);
+static void const * Vector_search_const(struct Vector const *, void const *key, int (*compar)(const void *, const void *));
+static void * Vector_begin(struct Vector *);
+static void * Vector_end(struct Vector *);
+static void const * Vector_begin_const(struct Vector const *);
+static void const * Vector_end_const(struct Vector const *);
+static size_t Vector_count(struct Vector const *vec);
+
+#include "vector.hc"
+
+#endif // H_UTILVSERVER_VECTOR_VECTOR_H
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2002,2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+
+static inline UNUSED void *
+Vector_begin(struct Vector *vec)
+{
+ return vec->data;
+}
+
+static inline UNUSED void *
+Vector_end(struct Vector *vec)
+{
+ return (char *)(vec->data) + (vec->count * vec->elem_size);
+}
+
+static inline UNUSED void const *
+Vector_begin_const(struct Vector const *vec)
+{
+ return vec->data;
+}
+
+static inline UNUSED void const *
+Vector_end_const(struct Vector const *vec)
+{
+ return (char *)(vec->data) + (vec->count * vec->elem_size);
+}
+
+static inline UNUSED size_t
+Vector_count(struct Vector const *vec)
+{
+ return vec->count;
+}
+
+static inline UNUSED void const *
+Vector_search_const(struct Vector const *vec, void const *key, int (*compar)(const void *, const void *))
+{
+ return Vector_search((struct Vector *)(vec), key, compar);
+}
--- /dev/null
+## $Id$ --*- makefile -*--
+
+## Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ENSC_WRAPPERS_HDRS = ensc_wrappers/wrappers-clone.hc \
+ ensc_wrappers/wrappers-dirent.hc \
+ ensc_wrappers/wrappers-fcntl.hc \
+ ensc_wrappers/wrappers-io.hc \
+ ensc_wrappers/wrappers-ioctl.hc \
+ ensc_wrappers/wrappers-iosock.hc \
+ ensc_wrappers/wrappers-mount.hc \
+ ensc_wrappers/wrappers-pivot.hc \
+ ensc_wrappers/wrappers-resource.hc \
+ ensc_wrappers/wrappers-stdlib.hc \
+ ensc_wrappers/wrappers-unistd.hc \
+ ensc_wrappers/wrappers-vserver.hc \
+ ensc_wrappers/wrappers-wait.hc \
+ ensc_wrappers/wrappers.h \
+ ensc_wrappers/wrappers_handler.hc
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL pid_t
+Eclone(int (*fn)(void *), void *child_stack, int flags, void *arg)
+{
+ pid_t res;
+#ifndef __dietlibc__
+ res = clone(fn, child_stack, flags, arg);
+#else
+ res = clone((void*(*)(void*))(fn), child_stack, flags, arg);
+#endif
+ FatalErrnoError(res==-1, "clone()");
+ return res;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL DIR *
+Eopendir(const char *name)
+{
+ DIR * res = opendir(name);
+
+ FatalErrnoError(res==0, "opendir()");
+ return res;
+}
+
+inline static WRAPPER_DECL struct dirent *
+Ereaddir(DIR *dir)
+{
+ struct dirent *res;
+
+ errno = 0;
+ res = readdir(dir);
+
+ FatalErrnoError(res==0 && errno!=0, "readdir()");
+ return res;
+}
+
+#ifndef __dietlibc__
+inline static WRAPPER_DECL void
+Ereaddir_r(DIR *dir, struct dirent *entry, struct dirent **result)
+{
+ errno = 0;
+ FatalErrnoError(readdir_r(dir, entry, result)==0 && errno!=0, "readdir_r()");
+}
+#endif
+
+inline static WRAPPER_DECL void
+Eclosedir(DIR *dir)
+{
+ FatalErrnoError(closedir(dir)==-1, "closedir()");
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL int
+Eopen(char const *fname, int flags, mode_t mode)
+{
+ int res = open(fname, flags, mode);
+ FatalErrnoError(res==-1, "open()");
+
+ return res;
+}
+
+inline static WRAPPER_DECL void
+Emkdir(const char *pathname, mode_t mode)
+{
+ FatalErrnoError(mkdir(pathname,mode)==-1, "mkdir()");
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+#include <stdbool.h>
+
+inline static UNUSED bool
+WwriteAll(int fd, void const *ptr_v, size_t len)
+{
+ register char const *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(write(fd, ptr, len));
+ if (res==(size_t)-1) {
+ perror("write()");
+ return false;
+ }
+
+ if (res==0) return false;
+
+ ptr += res;
+ len -= res;
+ }
+ return true;
+}
+
+inline static UNUSED void
+EwriteAll(int fd, void const *ptr_v, size_t len)
+{
+ register char const *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(write(fd, ptr, len));
+ FatalErrnoError(res==(size_t)-1, "write()");
+
+ ptr += res;
+ len -= res;
+ }
+}
+
+
+inline static UNUSED bool
+WreadAll(int fd, void *ptr_v, size_t len)
+{
+ register char *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(read(fd, ptr, len));
+ if (res==(size_t)-1) {
+ perror("read()");
+ return false;
+ }
+
+ if (res==0) return false;
+
+ ptr += res;
+ len -= res;
+ }
+ return true;
+}
+
+inline static UNUSED bool
+EreadAll(int fd, void *ptr_v, size_t len)
+{
+ register char *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(read(fd, ptr, len));
+ FatalErrnoError(res==(size_t)-1, "read()");
+
+ if (res==0) return false;
+
+ ptr += res;
+ len -= res;
+ }
+
+ return true;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL void
+Eioctl(int fd, int request, void *p)
+{
+ int res = ioctl(fd, request, p);
+ FatalErrnoError(res<0, "ioctl()");
+}
+
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+#include <stdbool.h>
+
+inline static UNUSED bool
+WsendAll(int fd, void const *ptr_v, size_t len)
+{
+ register char const *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL));
+ if (res==(size_t)-1) {
+ perror("send()");
+ return false;
+ }
+
+ if (res==0) return false;
+
+ ptr += res;
+ len -= res;
+ }
+ return true;
+}
+
+inline static UNUSED void
+EsendAll(int fd, void const *ptr_v, size_t len)
+{
+ register char const *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL));
+ FatalErrnoError(res==(size_t)-1, "send()");
+
+ ptr += res;
+ len -= res;
+ }
+}
+
+
+inline static UNUSED bool
+WrecvAll(int fd, void *ptr_v, size_t len)
+{
+ register char *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL));
+ if (res==(size_t)-1) {
+ perror("recv()");
+ return false;
+ }
+
+ if (res==0) return false;
+
+ ptr += res;
+ len -= res;
+ }
+ return true;
+}
+
+inline static UNUSED bool
+ErecvAll(int fd, void *ptr_v, size_t len)
+{
+ register char *ptr = ptr_v;
+
+ while (len>0) {
+ size_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL));
+ FatalErrnoError(res==(size_t)-1, "recv()");
+
+ if (res==0) return false;
+
+ ptr += res;
+ len -= res;
+ }
+
+ return true;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL void
+Eumount2(char const *path, int flag)
+{
+ FatalErrnoError(umount2(path,flag)==-1, "umount2()");
+}
+
+inline static WRAPPER_DECL void
+Emount(const char *source, const char *target,
+ const char *filesystemtype, unsigned long mountflags,
+ const void *data)
+{
+ FatalErrnoError(mount(source, target, filesystemtype,
+ mountflags, data)==-1, "mount()");
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL void
+Epivot_root(const char *new_root, const char *put_old)
+{
+ FatalErrnoError(pivot_root(new_root, put_old)==-1, "pivot_root()");
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL void
+Egetrlimit(int resource, struct rlimit *rlim)
+{
+ FatalErrnoError(getrlimit(resource, rlim)==-1, "getrlimit()");
+}
+
+inline static WRAPPER_DECL void
+Esetrlimit(int resource, struct rlimit const *rlim)
+{
+ FatalErrnoError(setrlimit(resource, rlim)==-1, "setrlimit()");
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL void *
+Emalloc(size_t size)
+{
+ register void *res = malloc(size);
+ FatalErrnoError(res==0 && size!=0, "malloc()");
+ return res;
+}
+
+/*@unused@*/
+inline static WRAPPER_DECL /*@null@*//*@only@*/ void *
+Erealloc(/*@only@*//*@out@*//*@null@*/ void *ptr,
+ size_t new_size)
+ /*@ensures maxSet(result) == new_size@*/
+ /*@modifies *ptr@*/
+{
+ register void *res = realloc(ptr, new_size);
+ FatalErrnoError(res==0 && new_size!=0, "realloc()");
+
+ return res;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL void
+Eclose(int s)
+{
+ FatalErrnoError(close(s)==-1, "close()");
+}
+
+inline static WRAPPER_DECL void
+Echdir(char const path[])
+{
+ FatalErrnoError(chdir(path)==-1, "chdir()");
+}
+
+inline static WRAPPER_DECL void
+Efchdir(int fd)
+{
+ FatalErrnoError(fchdir(fd)==-1, "fchdir()");
+}
+
+inline static WRAPPER_DECL void
+Echroot(char const path[])
+{
+ FatalErrnoError(chroot(path)==-1, "chroot()");
+}
+
+inline static WRAPPER_DECL void
+Eexecv(char const *path, char *argv[])
+{
+ FatalErrnoError(execv(path,argv)==-1, "execv()");
+}
+
+inline static WRAPPER_DECL void
+Epipe(int filedes[2])
+{
+ FatalErrnoError(pipe(filedes)==-1, "pipe()");
+}
+
+inline static WRAPPER_DECL pid_t
+Efork()
+{
+ pid_t res;
+ res = fork();
+ FatalErrnoError(res==-1, "fork()");
+ return res;
+}
+
+inline static WRAPPER_DECL size_t
+Eread(int fd, void *ptr, size_t len)
+{
+ size_t res = read(fd, ptr, len);
+ FatalErrnoError((ssize_t)(res)==-1, "read()");
+
+ return res;
+}
+
+inline static WRAPPER_DECL size_t
+Ewrite(int fd, void const *ptr, size_t len)
+{
+ size_t res = write(fd, ptr, len);
+ FatalErrnoError((ssize_t)(res)==-1, "write()");
+
+ return res;
+}
+
+inline static WRAPPER_DECL void
+Ereadlink(const char *path, char *buf, size_t bufsiz)
+{
+ FatalErrnoError(readlink(path, buf, bufsiz)==-1, "readlink()");
+}
+
+inline static WRAPPER_DECL void
+Esymlink(const char *oldpath, const char *newpath)
+{
+ FatalErrnoError(symlink(oldpath, newpath)==-1, "symlink()");
+}
+
+inline static WRAPPER_DECL void
+Eunlink(char const *pathname)
+{
+ FatalErrnoError(unlink(pathname)==-1, "unlink()");
+}
+
+inline static void
+Esetuid(uid_t uid)
+{
+ FatalErrnoError(setuid(uid)==-1, "setuid()");
+}
+
+inline static void
+Esetgid(gid_t gid)
+{
+ FatalErrnoError(setgid(gid)==-1, "setgid()");
+}
+
+#if defined(_GRP_H) && (defined(__USE_BSD) || defined(__dietlibc__))
+inline static void
+Esetgroups(size_t size, const gid_t *list)
+{
+ FatalErrnoError(setgroups(size, list)==-1, "setgroups()");
+}
+#endif
+
+inline static WRAPPER_DECL int
+Edup2(int oldfd, int newfd)
+{
+ register int res = dup2(oldfd, newfd);
+ FatalErrnoError(res==-1, "dup2()");
+
+ return res;
+}
+
+inline static WRAPPER_DECL pid_t
+Esetsid()
+{
+ register pid_t const res = setsid();
+ FatalErrnoError(res==-1, "setsid()");
+
+ return res;
+}
+
+inline static WRAPPER_DECL int
+Emkstemp(char *template)
+{
+ int res = mkstemp(template);
+ FatalErrnoError(res==-1, "mkstemp()");
+ return res;
+}
+
+inline static WRAPPER_DECL off_t
+Elseek(int fildes, off_t offset, int whence)
+{
+ off_t res = lseek(fildes, offset, whence);
+ FatalErrnoError(res==(off_t)-1, "lseek()");
+ return res;
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+#include <vserver.h>
+
+inline static UNUSED xid_t
+Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags)
+{
+ register xid_t res = vc_new_s_context(ctx,remove_cap,flags);
+ FatalErrnoError(res==VC_NOCTX, "vc_new_s_context()");
+ return res;
+}
+
+inline static UNUSED xid_t
+Evc_get_task_xid(pid_t pid)
+{
+ register xid_t res = vc_get_task_xid(pid);
+ FatalErrnoError(res==VC_NOCTX, "vc_get_task_xid()");
+ return res;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+inline static WRAPPER_DECL pid_t
+Ewait4(pid_t pid, int *status, int options,
+ struct rusage *rusage)
+{
+ pid_t res;
+ res = wait4(pid, status, options, rusage);
+ FatalErrnoError(res==-1, "wait4()");
+ return res;
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_UTIL_VSERVER_SRC_WRAPPERS_H
+#define H_UTIL_VSERVER_SRC_WRAPPERS_H
+
+#define WRAPPER_DECL UNUSED ALWAYSINLINE
+#define H_ENSC_IN_WRAPPERS_H 1
+
+#include "wrappers_handler.hc"
+
+#ifdef ENSC_WRAPPERS_UNISTD
+# include "wrappers-unistd.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_FCNTL
+# include "wrappers-fcntl.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_MOUNT
+# include "wrappers-mount.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_RESOURCE
+# include "wrappers-resource.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_IOCTL
+# include "wrappers-ioctl.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_WAIT
+# include "wrappers-wait.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_VSERVER
+# include "wrappers-vserver.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_IO
+# include "wrappers-io.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_IOSOCK
+# include "wrappers-iosock.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_DIRENT
+# include "wrappers-dirent.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_CLONE
+# include "wrappers-clone.hc"
+#endif
+
+#ifdef ENSC_WRAPPERS_STDLIB
+# include "wrappers-stdlib.hc"
+#endif
+
+#undef H_ENSC_IN_WRAPPERS_H
+#undef WRAPPER_DECL
+
+#endif // H_UTIL_VSERVER_SRC_WRAPPERS_H
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_IN_WRAPPERS_H
+# error wrappers_handler.hc can not be used in this way
+#endif
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+static UNUSED void
+FatalErrnoError(bool condition, char const msg[]) /*@*/
+{
+ extern int wrapper_exit_code;
+
+ if (!condition) return;
+ perror(msg);
+
+ exit(wrapper_exit_code);
+}