Author: bonefish Date: 2011-05-25 01:39:50 +0200 (Wed, 25 May 2011) New Revision: 41724 Changeset: https://dev.haiku-os.org/changeset/41724 Modified: haiku/branches/developer/bonefish/signals/src/system/libroot/posix/sys/select.c Log: pselect() has sigset_t* parameter. Added versioned symbols for binary compatibility. Modified: haiku/branches/developer/bonefish/signals/src/system/libroot/posix/sys/select.c =================================================================== --- haiku/branches/developer/bonefish/signals/src/system/libroot/posix/sys/select.c 2011-05-24 23:30:37 UTC (rev 41723) +++ haiku/branches/developer/bonefish/signals/src/system/libroot/posix/sys/select.c 2011-05-24 23:39:50 UTC (rev 41724) @@ -1,24 +1,52 @@ -/* - * Copyright 2002-2007, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. +/* + * Copyright 2002-2007, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * All rights reserved. * Distributed under the terms of the MIT License. */ +#include <sys/select.h> #include <errno.h> -#include <sys/select.h> + +#include <syscall_utils.h> + +#include <symbol_versioning.h> #include <syscalls.h> +#include "../signal/signal_private.h" -#define RETURN_AND_SET_ERRNO(err) \ - if (err < 0) { \ - errno = err; \ - return -1; \ - } \ - return err; +int __pselect_beos(int numBits, struct fd_set *readBits, + struct fd_set *writeBits, struct fd_set *errorBits, + const struct timespec *tv, const sigset_t *beosSignalMask); +int __pselect_current(int numBits, struct fd_set *readBits, + struct fd_set *writeBits, struct fd_set *errorBits, + const struct timespec *tv, const sigset_t *sigMask); -int -pselect(int numBits, struct fd_set *readBits, struct fd_set *writeBits, + +int +__pselect_beos(int numBits, struct fd_set *readBits, struct fd_set *writeBits, + struct fd_set *errorBits, const struct timespec *tv, + const sigset_t *beosSignalMask) +{ + int status; + sigset_t signalMask; + bigtime_t timeout = -1LL; + if (tv) + timeout = tv->tv_sec * 1000000LL + tv->tv_nsec / 1000LL; + + if (beosSignalMask != NULL) + signalMask = from_beos_sigset(*beosSignalMask); + + status = _kern_select(numBits, readBits, writeBits, errorBits, timeout, + beosSignalMask != NULL ? &signalMask : NULL); + + RETURN_AND_SET_ERRNO(status); +} + + +int +__pselect_current(int numBits, struct fd_set *readBits, struct fd_set *writeBits, struct fd_set *errorBits, const struct timespec *tv, const sigset_t *sigMask) { int status; @@ -26,13 +54,14 @@ if (tv) timeout = tv->tv_sec * 1000000LL + tv->tv_nsec / 1000LL; - status = _kern_select(numBits, readBits, writeBits, errorBits, timeout, sigMask); + status = _kern_select(numBits, readBits, writeBits, errorBits, timeout, + sigMask); RETURN_AND_SET_ERRNO(status); } -int +int select(int numBits, struct fd_set *readBits, struct fd_set *writeBits, struct fd_set *errorBits, struct timeval *tv) { @@ -45,3 +74,9 @@ RETURN_AND_SET_ERRNO(status); } + + +DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pselect_beos", "pselect@", "BASE"); + +DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pselect_current", "pselect@@", + "1_ALPHA4");