diff options
author | vskipin <vskipin@yandex-team.ru> | 2022-02-10 16:46:00 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:00 +0300 |
commit | 4e4b78bd7b67e2533da4dbb9696374a6d6068e32 (patch) | |
tree | a7a5543d815c451256ece74081d960b4e1d70ec2 /contrib/libs | |
parent | 5b00ed04a5137a452fa6d3423cb0c9b54ac27408 (diff) | |
download | ydb-4e4b78bd7b67e2533da4dbb9696374a6d6068e32.tar.gz |
Restoring authorship annotation for <vskipin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs')
28 files changed, 1554 insertions, 1554 deletions
diff --git a/contrib/libs/grpc/src/core/lib/iomgr/executor.cc b/contrib/libs/grpc/src/core/lib/iomgr/executor.cc index 10b2f948ec..40e94b79c6 100644 --- a/contrib/libs/grpc/src/core/lib/iomgr/executor.cc +++ b/contrib/libs/grpc/src/core/lib/iomgr/executor.cc @@ -85,8 +85,8 @@ const EnqueueFunc {{default_enqueue_short, default_enqueue_long}, {resolver_enqueue_short, resolver_enqueue_long}}; -size_t threads_limit_ = 0; - +size_t threads_limit_ = 0; + } // namespace TraceFlag executor_trace(false, "executor"); @@ -95,17 +95,17 @@ Executor::Executor(const char* name) : name_(name) { adding_thread_lock_ = GPR_SPINLOCK_STATIC_INITIALIZER; gpr_atm_rel_store(&num_threads_, 0); max_threads_ = GPR_MAX(1, 2 * gpr_cpu_num_cores()); - if (threads_limit_) { - max_threads_ = GPR_MIN(max_threads_, threads_limit_); - } -} - -size_t Executor::SetThreadsLimit(size_t count) { - size_t prev = threads_limit_; - threads_limit_ = count; - return prev; + if (threads_limit_) { + max_threads_ = GPR_MIN(max_threads_, threads_limit_); + } } +size_t Executor::SetThreadsLimit(size_t count) { + size_t prev = threads_limit_; + threads_limit_ = count; + return prev; +} + void Executor::Init() { SetThreading(true); } size_t Executor::RunClosures(const char* executor_name, diff --git a/contrib/libs/grpc/src/core/lib/iomgr/executor.h b/contrib/libs/grpc/src/core/lib/iomgr/executor.h index ae523ff212..6a51e17532 100644 --- a/contrib/libs/grpc/src/core/lib/iomgr/executor.h +++ b/contrib/libs/grpc/src/core/lib/iomgr/executor.h @@ -103,9 +103,9 @@ class Executor { // Return if the DEFAULT executor is threaded static bool IsThreadedDefault(); - // Set the maximum numbers of executor treads - static size_t SetThreadsLimit(size_t count); - + // Set the maximum numbers of executor treads + static size_t SetThreadsLimit(size_t count); + private: static size_t RunClosures(const char* executor_name, grpc_closure_list list); static void ThreadMain(void* arg); diff --git a/contrib/libs/libaio/io_cancel.c b/contrib/libs/libaio/io_cancel.c index 298751a6ec..60f570fb8c 100644 --- a/contrib/libs/libaio/io_cancel.c +++ b/contrib/libs/libaio/io_cancel.c @@ -1,22 +1,22 @@ -/* io_cancel.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "libaio.h" -#include "syscall.h" - +/* io_cancel.c + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "libaio.h" +#include "syscall.h" + io_syscall3(int, io_cancel, io_cancel, io_context_t, ctx, struct iocb *, iocb, struct io_event *, event) diff --git a/contrib/libs/libaio/io_destroy.c b/contrib/libs/libaio/io_destroy.c index ba28dd2ec9..39cec7cac7 100644 --- a/contrib/libs/libaio/io_destroy.c +++ b/contrib/libs/libaio/io_destroy.c @@ -1,23 +1,23 @@ -/* io_destroy - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <errno.h> -#include "libaio.h" -#include "syscall.h" - -io_syscall1(int, io_destroy, io_destroy, io_context_t, ctx) +/* io_destroy + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <errno.h> +#include "libaio.h" +#include "syscall.h" + +io_syscall1(int, io_destroy, io_destroy, io_context_t, ctx) diff --git a/contrib/libs/libaio/io_getevents.c b/contrib/libs/libaio/io_getevents.c index b606e43283..5791d1587d 100644 --- a/contrib/libs/libaio/io_getevents.c +++ b/contrib/libs/libaio/io_getevents.c @@ -1,56 +1,56 @@ -/* io_getevents.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "libaio.h" -#include <errno.h> -#include <stdlib.h> -#include <time.h> -#include "syscall.h" - -io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx, long, min_nr, long, nr, struct io_event *, events, struct timespec *, timeout) - -#define AIO_RING_MAGIC 0xa10a10a1 - -/* Ben will hate me for this */ -struct aio_ring { - unsigned id; /* kernel internal index number */ - unsigned nr; /* number of io_events */ - unsigned head; - unsigned tail; - - unsigned magic; - unsigned compat_features; - unsigned incompat_features; - unsigned header_length; /* size of aio_ring */ -}; - +/* io_getevents.c + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "libaio.h" +#include <errno.h> +#include <stdlib.h> +#include <time.h> +#include "syscall.h" + +io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx, long, min_nr, long, nr, struct io_event *, events, struct timespec *, timeout) + +#define AIO_RING_MAGIC 0xa10a10a1 + +/* Ben will hate me for this */ +struct aio_ring { + unsigned id; /* kernel internal index number */ + unsigned nr; /* number of io_events */ + unsigned head; + unsigned tail; + + unsigned magic; + unsigned compat_features; + unsigned incompat_features; + unsigned header_length; /* size of aio_ring */ +}; + int io_getevents(io_context_t ctx, long min_nr, long nr, struct io_event * events, struct timespec * timeout) -{ - struct aio_ring *ring; - ring = (struct aio_ring*)ctx; - if (ring==NULL || ring->magic != AIO_RING_MAGIC) - goto do_syscall; - if (timeout!=NULL && timeout->tv_sec == 0 && timeout->tv_nsec == 0) { - if (ring->head == ring->tail) - return 0; - } - -do_syscall: - return __io_getevents_0_4(ctx, min_nr, nr, events, timeout); -} +{ + struct aio_ring *ring; + ring = (struct aio_ring*)ctx; + if (ring==NULL || ring->magic != AIO_RING_MAGIC) + goto do_syscall; + if (timeout!=NULL && timeout->tv_sec == 0 && timeout->tv_nsec == 0) { + if (ring->head == ring->tail) + return 0; + } + +do_syscall: + return __io_getevents_0_4(ctx, min_nr, nr, events, timeout); +} diff --git a/contrib/libs/libaio/io_queue_init.c b/contrib/libs/libaio/io_queue_init.c index 62e8dc0335..6f5c7d8799 100644 --- a/contrib/libs/libaio/io_queue_init.c +++ b/contrib/libs/libaio/io_queue_init.c @@ -1,33 +1,33 @@ -/* io_queue_init.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "libaio.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> - -#include "syscall.h" - -int io_queue_init(int maxevents, io_context_t *ctxp) -{ - if (maxevents > 0) { - *ctxp = NULL; - return io_setup(maxevents, ctxp); - } - return -EINVAL; -} +/* io_queue_init.c + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "libaio.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> + +#include "syscall.h" + +int io_queue_init(int maxevents, io_context_t *ctxp) +{ + if (maxevents > 0) { + *ctxp = NULL; + return io_setup(maxevents, ctxp); + } + return -EINVAL; +} diff --git a/contrib/libs/libaio/io_queue_release.c b/contrib/libs/libaio/io_queue_release.c index 522d7651e4..45fa150199 100644 --- a/contrib/libs/libaio/io_queue_release.c +++ b/contrib/libs/libaio/io_queue_release.c @@ -1,27 +1,27 @@ -/* io_queue_release.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "libaio.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> - -int io_queue_release(io_context_t ctx) -{ - return io_destroy(ctx); -} +/* io_queue_release.c + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "libaio.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> + +int io_queue_release(io_context_t ctx) +{ + return io_destroy(ctx); +} diff --git a/contrib/libs/libaio/io_queue_run.c b/contrib/libs/libaio/io_queue_run.c index 3780ca093a..0b7244a8c8 100644 --- a/contrib/libs/libaio/io_queue_run.c +++ b/contrib/libs/libaio/io_queue_run.c @@ -1,39 +1,39 @@ -/* io_submit - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "libaio.h" -#include <errno.h> -#include <stdlib.h> -#include <time.h> - -int io_queue_run(io_context_t ctx) -{ - static struct timespec timeout = { 0, 0 }; - struct io_event event; - int ret; - - /* FIXME: batch requests? */ - while (1 == (ret = io_getevents(ctx, 0, 1, &event, &timeout))) { - io_callback_t cb = (io_callback_t)event.data; - struct iocb *iocb = event.obj; - - cb(ctx, iocb, event.res, event.res2); - } - - return ret; -} +/* io_submit + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "libaio.h" +#include <errno.h> +#include <stdlib.h> +#include <time.h> + +int io_queue_run(io_context_t ctx) +{ + static struct timespec timeout = { 0, 0 }; + struct io_event event; + int ret; + + /* FIXME: batch requests? */ + while (1 == (ret = io_getevents(ctx, 0, 1, &event, &timeout))) { + io_callback_t cb = (io_callback_t)event.data; + struct iocb *iocb = event.obj; + + cb(ctx, iocb, event.res, event.res2); + } + + return ret; +} diff --git a/contrib/libs/libaio/io_queue_wait.c b/contrib/libs/libaio/io_queue_wait.c index e706901953..a4bf196ff0 100644 --- a/contrib/libs/libaio/io_queue_wait.c +++ b/contrib/libs/libaio/io_queue_wait.c @@ -1,30 +1,30 @@ -/* io_submit - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#define NO_SYSCALL_ERRNO -#include <sys/types.h> -#include "libaio.h" -#include <errno.h> -#include "syscall.h" - -struct timespec; - +/* io_submit + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define NO_SYSCALL_ERRNO +#include <sys/types.h> +#include "libaio.h" +#include <errno.h> +#include "syscall.h" + +struct timespec; + int io_queue_wait(io_context_t ctx, struct timespec *timeout) -{ - return io_getevents(ctx, 0, 0, NULL, timeout); -} +{ + return io_getevents(ctx, 0, 0, NULL, timeout); +} diff --git a/contrib/libs/libaio/io_setup.c b/contrib/libs/libaio/io_setup.c index a3a44bb4d5..04806c1c3b 100644 --- a/contrib/libs/libaio/io_setup.c +++ b/contrib/libs/libaio/io_setup.c @@ -1,23 +1,23 @@ -/* io_setup - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <errno.h> -#include "libaio.h" -#include "syscall.h" - -io_syscall2(int, io_setup, io_setup, int, maxevents, io_context_t *, ctxp) +/* io_setup + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <errno.h> +#include "libaio.h" +#include "syscall.h" + +io_syscall2(int, io_setup, io_setup, int, maxevents, io_context_t *, ctxp) diff --git a/contrib/libs/libaio/io_submit.c b/contrib/libs/libaio/io_submit.c index 3cc9590703..21d323ab5b 100644 --- a/contrib/libs/libaio/io_submit.c +++ b/contrib/libs/libaio/io_submit.c @@ -1,23 +1,23 @@ -/* io_submit - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <errno.h> -#include "libaio.h" -#include "syscall.h" - -io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr, struct iocb **, iocbs) +/* io_submit + libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include <errno.h> +#include "libaio.h" +#include "syscall.h" + +io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr, struct iocb **, iocbs) diff --git a/contrib/libs/libaio/libaio.h b/contrib/libs/libaio/libaio.h index 4a4e0f5cba..39605ca3cd 100644 --- a/contrib/libs/libaio/libaio.h +++ b/contrib/libs/libaio/libaio.h @@ -1,271 +1,271 @@ -/* /usr/include/libaio.h - * - * Copyright 2000,2001,2002 Red Hat, Inc. - * - * Written by Benjamin LaHaise <bcrl@redhat.com> - * - * libaio Linux async I/O interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef __LIBAIO_H -#define __LIBAIO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <string.h> - -struct timespec; -struct sockaddr; -struct iovec; - -typedef struct io_context *io_context_t; - -typedef enum io_iocb_cmd { - IO_CMD_PREAD = 0, - IO_CMD_PWRITE = 1, - - IO_CMD_FSYNC = 2, - IO_CMD_FDSYNC = 3, - - IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */ - IO_CMD_NOOP = 6, - IO_CMD_PREADV = 7, - IO_CMD_PWRITEV = 8, -} io_iocb_cmd_t; - -/* little endian, 32 bits */ -#if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \ - defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \ - defined(__cris__) || \ - (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4) -#define PADDED(x, y) x; unsigned y -#define PADDEDptr(x, y) x; unsigned y -#define PADDEDul(x, y) unsigned long x; unsigned y - -/* little endian, 64 bits */ -#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \ - (defined(__aarch64__) && defined(__AARCH64EL__)) || \ - (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 8) -#define PADDED(x, y) x, y -#define PADDEDptr(x, y) x -#define PADDEDul(x, y) unsigned long x - -/* big endian, 64 bits */ -#elif defined(__powerpc64__) || defined(__s390x__) || \ - (defined(__sparc__) && defined(__arch64__)) || \ - (defined(__aarch64__) && defined(__AARCH64EB__)) || \ - (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 8) -#define PADDED(x, y) unsigned y; x -#define PADDEDptr(x,y) x -#define PADDEDul(x, y) unsigned long x - -/* big endian, 32 bits */ -#elif defined(__PPC__) || defined(__s390__) || \ - (defined(__arm__) && defined(__ARMEB__)) || \ - defined(__sparc__) || defined(__MIPSEB__) || defined(__m68k__) || \ - defined(__hppa__) || defined(__frv__) || defined(__avr32__) || \ - (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ - __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 4) -#define PADDED(x, y) unsigned y; x -#define PADDEDptr(x, y) unsigned y; x -#define PADDEDul(x, y) unsigned y; unsigned long x - -#else -#error endian? -#endif - -struct io_iocb_poll { - PADDED(int events, __pad1); -}; /* result code is the set of result flags or -'ve errno */ - -struct io_iocb_sockaddr { - struct sockaddr *addr; - int len; -}; /* result code is the length of the sockaddr, or -'ve errno */ - -struct io_iocb_common { - PADDEDptr(void *buf, __pad1); - PADDEDul(nbytes, __pad2); - long long offset; - long long __pad3; - unsigned flags; - unsigned resfd; -}; /* result code is the amount read or -'ve errno */ - -struct io_iocb_vector { - const struct iovec *vec; - int nr; - long long offset; -}; /* result code is the amount read or -'ve errno */ - -struct iocb { - PADDEDptr(void *data, __pad1); /* Return in the io completion event */ - PADDED(unsigned key, __pad2); /* For use in identifying io requests */ - - short aio_lio_opcode; - short aio_reqprio; - int aio_fildes; - - union { - struct io_iocb_common c; - struct io_iocb_vector v; - struct io_iocb_poll poll; - struct io_iocb_sockaddr saddr; - } u; -}; - -struct io_event { - PADDEDptr(void *data, __pad1); - PADDEDptr(struct iocb *obj, __pad2); - PADDEDul(res, __pad3); - PADDEDul(res2, __pad4); -}; - -#undef PADDED -#undef PADDEDptr -#undef PADDEDul - -typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2); - -/* library wrappers */ -extern int io_queue_init(int maxevents, io_context_t *ctxp); -/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/ -extern int io_queue_release(io_context_t ctx); -/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/ -extern int io_queue_run(io_context_t ctx); - -/* Actual syscalls */ -extern int io_setup(int maxevents, io_context_t *ctxp); -extern int io_destroy(io_context_t ctx); -extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]); -extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt); -extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); - - -static inline void io_set_callback(struct iocb *iocb, io_callback_t cb) -{ - iocb->data = (void *)cb; -} - -static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_PREAD; - iocb->aio_reqprio = 0; - iocb->u.c.buf = buf; - iocb->u.c.nbytes = count; - iocb->u.c.offset = offset; -} - -static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_PWRITE; - iocb->aio_reqprio = 0; - iocb->u.c.buf = buf; - iocb->u.c.nbytes = count; - iocb->u.c.offset = offset; -} - -static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_PREADV; - iocb->aio_reqprio = 0; - iocb->u.c.buf = (void *)iov; - iocb->u.c.nbytes = iovcnt; - iocb->u.c.offset = offset; -} - -static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_PWRITEV; - iocb->aio_reqprio = 0; - iocb->u.c.buf = (void *)iov; - iocb->u.c.nbytes = iovcnt; - iocb->u.c.offset = offset; -} - -/* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3. - * AFAICT, it was never in mainline, and should not be used. --RR */ -static inline void io_prep_poll(struct iocb *iocb, int fd, int events) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_POLL; - iocb->aio_reqprio = 0; - iocb->u.poll.events = events; -} - -static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events) -{ - io_prep_poll(iocb, fd, events); - io_set_callback(iocb, cb); - return io_submit(ctx, 1, &iocb); -} - -static inline void io_prep_fsync(struct iocb *iocb, int fd) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_FSYNC; - iocb->aio_reqprio = 0; -} - -static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) -{ - io_prep_fsync(iocb, fd); - io_set_callback(iocb, cb); - return io_submit(ctx, 1, &iocb); -} - -static inline void io_prep_fdsync(struct iocb *iocb, int fd) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_FDSYNC; - iocb->aio_reqprio = 0; -} - -static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) -{ - io_prep_fdsync(iocb, fd); - io_set_callback(iocb, cb); - return io_submit(ctx, 1, &iocb); -} - -static inline void io_set_eventfd(struct iocb *iocb, int eventfd) -{ - iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */; - iocb->u.c.resfd = eventfd; -} - -#ifdef __cplusplus -} -#endif - -#endif /* __LIBAIO_H */ +/* /usr/include/libaio.h + * + * Copyright 2000,2001,2002 Red Hat, Inc. + * + * Written by Benjamin LaHaise <bcrl@redhat.com> + * + * libaio Linux async I/O interface + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __LIBAIO_H +#define __LIBAIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/types.h> +#include <string.h> + +struct timespec; +struct sockaddr; +struct iovec; + +typedef struct io_context *io_context_t; + +typedef enum io_iocb_cmd { + IO_CMD_PREAD = 0, + IO_CMD_PWRITE = 1, + + IO_CMD_FSYNC = 2, + IO_CMD_FDSYNC = 3, + + IO_CMD_POLL = 5, /* Never implemented in mainline, see io_prep_poll */ + IO_CMD_NOOP = 6, + IO_CMD_PREADV = 7, + IO_CMD_PWRITEV = 8, +} io_iocb_cmd_t; + +/* little endian, 32 bits */ +#if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \ + defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \ + defined(__cris__) || \ + (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4) +#define PADDED(x, y) x; unsigned y +#define PADDEDptr(x, y) x; unsigned y +#define PADDEDul(x, y) unsigned long x; unsigned y + +/* little endian, 64 bits */ +#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \ + (defined(__aarch64__) && defined(__AARCH64EL__)) || \ + (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ + __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 8) +#define PADDED(x, y) x, y +#define PADDEDptr(x, y) x +#define PADDEDul(x, y) unsigned long x + +/* big endian, 64 bits */ +#elif defined(__powerpc64__) || defined(__s390x__) || \ + (defined(__sparc__) && defined(__arch64__)) || \ + (defined(__aarch64__) && defined(__AARCH64EB__)) || \ + (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ + __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 8) +#define PADDED(x, y) unsigned y; x +#define PADDEDptr(x,y) x +#define PADDEDul(x, y) unsigned long x + +/* big endian, 32 bits */ +#elif defined(__PPC__) || defined(__s390__) || \ + (defined(__arm__) && defined(__ARMEB__)) || \ + defined(__sparc__) || defined(__MIPSEB__) || defined(__m68k__) || \ + defined(__hppa__) || defined(__frv__) || defined(__avr32__) || \ + (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ + __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 4) +#define PADDED(x, y) unsigned y; x +#define PADDEDptr(x, y) unsigned y; x +#define PADDEDul(x, y) unsigned y; unsigned long x + +#else +#error endian? +#endif + +struct io_iocb_poll { + PADDED(int events, __pad1); +}; /* result code is the set of result flags or -'ve errno */ + +struct io_iocb_sockaddr { + struct sockaddr *addr; + int len; +}; /* result code is the length of the sockaddr, or -'ve errno */ + +struct io_iocb_common { + PADDEDptr(void *buf, __pad1); + PADDEDul(nbytes, __pad2); + long long offset; + long long __pad3; + unsigned flags; + unsigned resfd; +}; /* result code is the amount read or -'ve errno */ + +struct io_iocb_vector { + const struct iovec *vec; + int nr; + long long offset; +}; /* result code is the amount read or -'ve errno */ + +struct iocb { + PADDEDptr(void *data, __pad1); /* Return in the io completion event */ + PADDED(unsigned key, __pad2); /* For use in identifying io requests */ + + short aio_lio_opcode; + short aio_reqprio; + int aio_fildes; + + union { + struct io_iocb_common c; + struct io_iocb_vector v; + struct io_iocb_poll poll; + struct io_iocb_sockaddr saddr; + } u; +}; + +struct io_event { + PADDEDptr(void *data, __pad1); + PADDEDptr(struct iocb *obj, __pad2); + PADDEDul(res, __pad3); + PADDEDul(res2, __pad4); +}; + +#undef PADDED +#undef PADDEDptr +#undef PADDEDul + +typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2); + +/* library wrappers */ +extern int io_queue_init(int maxevents, io_context_t *ctxp); +/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/ +extern int io_queue_release(io_context_t ctx); +/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/ +extern int io_queue_run(io_context_t ctx); + +/* Actual syscalls */ +extern int io_setup(int maxevents, io_context_t *ctxp); +extern int io_destroy(io_context_t ctx); +extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]); +extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt); +extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); + + +static inline void io_set_callback(struct iocb *iocb, io_callback_t cb) +{ + iocb->data = (void *)cb; +} + +static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_PREAD; + iocb->aio_reqprio = 0; + iocb->u.c.buf = buf; + iocb->u.c.nbytes = count; + iocb->u.c.offset = offset; +} + +static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_PWRITE; + iocb->aio_reqprio = 0; + iocb->u.c.buf = buf; + iocb->u.c.nbytes = count; + iocb->u.c.offset = offset; +} + +static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_PREADV; + iocb->aio_reqprio = 0; + iocb->u.c.buf = (void *)iov; + iocb->u.c.nbytes = iovcnt; + iocb->u.c.offset = offset; +} + +static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_PWRITEV; + iocb->aio_reqprio = 0; + iocb->u.c.buf = (void *)iov; + iocb->u.c.nbytes = iovcnt; + iocb->u.c.offset = offset; +} + +/* Jeff Moyer says this was implemented in Red Hat AS2.1 and RHEL3. + * AFAICT, it was never in mainline, and should not be used. --RR */ +static inline void io_prep_poll(struct iocb *iocb, int fd, int events) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_POLL; + iocb->aio_reqprio = 0; + iocb->u.poll.events = events; +} + +static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events) +{ + io_prep_poll(iocb, fd, events); + io_set_callback(iocb, cb); + return io_submit(ctx, 1, &iocb); +} + +static inline void io_prep_fsync(struct iocb *iocb, int fd) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_FSYNC; + iocb->aio_reqprio = 0; +} + +static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) +{ + io_prep_fsync(iocb, fd); + io_set_callback(iocb, cb); + return io_submit(ctx, 1, &iocb); +} + +static inline void io_prep_fdsync(struct iocb *iocb, int fd) +{ + memset(iocb, 0, sizeof(*iocb)); + iocb->aio_fildes = fd; + iocb->aio_lio_opcode = IO_CMD_FDSYNC; + iocb->aio_reqprio = 0; +} + +static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) +{ + io_prep_fdsync(iocb, fd); + io_set_callback(iocb, cb); + return io_submit(ctx, 1, &iocb); +} + +static inline void io_set_eventfd(struct iocb *iocb, int eventfd) +{ + iocb->u.c.flags |= (1 << 0) /* IOCB_FLAG_RESFD */; + iocb->u.c.resfd = eventfd; +} + +#ifdef __cplusplus +} +#endif + +#endif /* __LIBAIO_H */ diff --git a/contrib/libs/libaio/raw_syscall.c b/contrib/libs/libaio/raw_syscall.c index c3fe4b8deb..08688ba15b 100644 --- a/contrib/libs/libaio/raw_syscall.c +++ b/contrib/libs/libaio/raw_syscall.c @@ -1,19 +1,19 @@ -#include "syscall.h" - -#if defined(__ia64__) -/* based on code from glibc by Jes Sorensen */ -__asm__(".text\n" - ".globl __ia64_aio_raw_syscall\n" - ".proc __ia64_aio_raw_syscall\n" - "__ia64_aio_raw_syscall:\n" - "alloc r2=ar.pfs,1,0,8,0\n" - "mov r15=r32\n" - "break 0x100000\n" - ";;" - "br.ret.sptk.few b0\n" - ".size __ia64_aio_raw_syscall, . - __ia64_aio_raw_syscall\n" - ".endp __ia64_aio_raw_syscall" -); -#endif - -; +#include "syscall.h" + +#if defined(__ia64__) +/* based on code from glibc by Jes Sorensen */ +__asm__(".text\n" + ".globl __ia64_aio_raw_syscall\n" + ".proc __ia64_aio_raw_syscall\n" + "__ia64_aio_raw_syscall:\n" + "alloc r2=ar.pfs,1,0,8,0\n" + "mov r15=r32\n" + "break 0x100000\n" + ";;" + "br.ret.sptk.few b0\n" + ".size __ia64_aio_raw_syscall, . - __ia64_aio_raw_syscall\n" + ".endp __ia64_aio_raw_syscall" +); +#endif + +; diff --git a/contrib/libs/libaio/static/ya.make b/contrib/libs/libaio/static/ya.make index c4a7e200bb..d7d509dba9 100644 --- a/contrib/libs/libaio/static/ya.make +++ b/contrib/libs/libaio/static/ya.make @@ -1,6 +1,6 @@ -# sources downloaded from: https://git.fedorahosted.org/cgit/libaio.git -LIBRARY() - +# sources downloaded from: https://git.fedorahosted.org/cgit/libaio.git +LIBRARY() + IF (ARCH_ARMV7 OR ARCH_ARM64) LICENSE( GPL-2.0-only AND @@ -21,11 +21,11 @@ OWNER( g:contrib g:cpp-contrib ) + +NO_UTIL() -NO_UTIL() - -NO_RUNTIME() - +NO_RUNTIME() + PROVIDES(libaio) SRCDIR(contrib/libs/libaio) @@ -34,17 +34,17 @@ ADDINCL( contrib/libs/libaio ) -SRCS( - io_cancel.c - io_destroy.c - io_getevents.c - io_queue_init.c - io_queue_release.c - io_queue_run.c - io_queue_wait.c - io_setup.c - io_submit.c - raw_syscall.c -) - -END() +SRCS( + io_cancel.c + io_destroy.c + io_getevents.c + io_queue_init.c + io_queue_release.c + io_queue_run.c + io_queue_wait.c + io_setup.c + io_submit.c + raw_syscall.c +) + +END() diff --git a/contrib/libs/libaio/syscall-alpha.h b/contrib/libs/libaio/syscall-alpha.h index 467b74f07e..2e3bc67a5e 100644 --- a/contrib/libs/libaio/syscall-alpha.h +++ b/contrib/libs/libaio/syscall-alpha.h @@ -1,145 +1,145 @@ -#define __NR_io_setup 398 -#define __NR_io_destroy 399 -#define __NR_io_getevents 400 -#define __NR_io_submit 401 -#define __NR_io_cancel 402 - -#define inline_syscall_r0_asm -#define inline_syscall_r0_out_constraint "=v" - -#define inline_syscall_clobbers \ - "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ - "$22", "$23", "$24", "$25", "$27", "$28", "memory" - -#define inline_syscall0(name, args...) \ -{ \ +#define __NR_io_setup 398 +#define __NR_io_destroy 399 +#define __NR_io_getevents 400 +#define __NR_io_submit 401 +#define __NR_io_cancel 402 + +#define inline_syscall_r0_asm +#define inline_syscall_r0_out_constraint "=v" + +#define inline_syscall_clobbers \ + "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ + "$22", "$23", "$24", "$25", "$27", "$28", "memory" + +#define inline_syscall0(name, args...) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19) \ - : "0"(_sc_0) \ - : inline_syscall_clobbers, \ - "$16", "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall1(name,arg1) \ -{ \ + \ + _sc_0 = name; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19) \ + : "0"(_sc_0) \ + : inline_syscall_clobbers, \ + "$16", "$17", "$18", "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define inline_syscall1(name,arg1) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_16 __asm__("$16"); \ register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16) \ - : "0"(_sc_0), "2"(_sc_16) \ - : inline_syscall_clobbers, \ - "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall2(name,arg1,arg2) \ -{ \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16) \ + : "0"(_sc_0), "2"(_sc_16) \ + : inline_syscall_clobbers, \ + "$17", "$18", "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define inline_syscall2(name,arg1,arg2) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_16 __asm__("$16"); \ register long _sc_17 __asm__("$17"); \ register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17) \ - : inline_syscall_clobbers, \ - "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall3(name,arg1,arg2,arg3) \ -{ \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17) \ + : inline_syscall_clobbers, \ + "$18", "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define inline_syscall3(name,arg1,arg2,arg3) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_16 __asm__("$16"); \ register long _sc_17 __asm__("$17"); \ register long _sc_18 __asm__("$18"); \ register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ - "4"(_sc_18) \ - : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ -{ \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ + "=r"(_sc_18) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ + "4"(_sc_18) \ + : inline_syscall_clobbers, "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_16 __asm__("$16"); \ register long _sc_17 __asm__("$17"); \ register long _sc_18 __asm__("$18"); \ register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - _sc_19 = (long) (arg4); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ - "4"(_sc_18), "1"(_sc_19) \ - : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ -{ \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + _sc_19 = (long) (arg4); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ + "=r"(_sc_18) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ + "4"(_sc_18), "1"(_sc_19) \ + : inline_syscall_clobbers, "$20", "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_16 __asm__("$16"); \ register long _sc_17 __asm__("$17"); \ register long _sc_18 __asm__("$18"); \ register long _sc_19 __asm__("$19"); \ register long _sc_20 __asm__("$20"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - _sc_19 = (long) (arg4); \ - _sc_20 = (long) (arg5); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18), "=r"(_sc_20) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ - "4"(_sc_18), "1"(_sc_19), "5"(_sc_20) \ - : inline_syscall_clobbers, "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ -{ \ + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + _sc_19 = (long) (arg4); \ + _sc_20 = (long) (arg5); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ + "=r"(_sc_18), "=r"(_sc_20) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ + "4"(_sc_18), "1"(_sc_19), "5"(_sc_20) \ + : inline_syscall_clobbers, "$21"); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ +{ \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_16 __asm__("$16"); \ register long _sc_17 __asm__("$17"); \ @@ -147,63 +147,63 @@ register long _sc_19 __asm__("$19"); \ register long _sc_20 __asm__("$20"); \ register long _sc_21 __asm__("$21"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - _sc_19 = (long) (arg4); \ - _sc_20 = (long) (arg5); \ - _sc_21 = (long) (arg6); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18), "=r"(_sc_20), "=r"(_sc_21) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), "4"(_sc_18), \ - "1"(_sc_19), "5"(_sc_20), "6"(_sc_21) \ - : inline_syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define INLINE_SYSCALL1(name, nr, args...) \ -({ \ - long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ - if (_sc_err != 0) \ - { \ - _sc_ret = -(_sc_ret); \ - } \ - _sc_ret; \ -}) - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 1, arg1); \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 2, arg1, arg2); \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 3, arg1, arg2, arg3); \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 4, arg1, arg2, arg3, arg4); \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 5, arg1, arg2, arg3, arg4, arg5);\ -} + \ + _sc_0 = name; \ + _sc_16 = (long) (arg1); \ + _sc_17 = (long) (arg2); \ + _sc_18 = (long) (arg3); \ + _sc_19 = (long) (arg4); \ + _sc_20 = (long) (arg5); \ + _sc_21 = (long) (arg6); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ + : inline_syscall_r0_out_constraint (_sc_0), \ + "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ + "=r"(_sc_18), "=r"(_sc_20), "=r"(_sc_21) \ + : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), "4"(_sc_18), \ + "1"(_sc_19), "5"(_sc_20), "6"(_sc_21) \ + : inline_syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; \ +} + +#define INLINE_SYSCALL1(name, nr, args...) \ +({ \ + long _sc_ret, _sc_err; \ + inline_syscall##nr(__NR_##name, args); \ + if (_sc_err != 0) \ + { \ + _sc_ret = -(_sc_ret); \ + } \ + _sc_ret; \ +}) + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) \ +{ \ + return (type)INLINE_SYSCALL1(sname, 1, arg1); \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) \ +{ \ + return (type)INLINE_SYSCALL1(sname, 2, arg1, arg2); \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) \ +{ \ + return (type)INLINE_SYSCALL1(sname, 3, arg1, arg2, arg3); \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + return (type)INLINE_SYSCALL1(sname, 4, arg1, arg2, arg3, arg4); \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ + return (type)INLINE_SYSCALL1(sname, 5, arg1, arg2, arg3, arg4, arg5);\ +} diff --git a/contrib/libs/libaio/syscall-arm.h b/contrib/libs/libaio/syscall-arm.h index 4a9b665969..d703c0beea 100644 --- a/contrib/libs/libaio/syscall-arm.h +++ b/contrib/libs/libaio/syscall-arm.h @@ -1,116 +1,116 @@ -/* - * linux/include/asm-arm/unistd.h - * - * Copyright (C) 2001-2005 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Please forward _all_ changes to this file to rmk@arm.linux.org.uk, - * no matter what the change is. Thanks! - */ - -#define __NR_OABI_SYSCALL_BASE 0x900000 - -#if defined(__thumb__) || defined(__ARM_EABI__) -#define __NR_SYSCALL_BASE 0 -#else -#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE -#endif - -#define __NR_io_setup (__NR_SYSCALL_BASE+243) -#define __NR_io_destroy (__NR_SYSCALL_BASE+244) -#define __NR_io_getevents (__NR_SYSCALL_BASE+245) -#define __NR_io_submit (__NR_SYSCALL_BASE+246) -#define __NR_io_cancel (__NR_SYSCALL_BASE+247) - -#define __sys2(x) #x -#define __sys1(x) __sys2(x) - -#if defined(__thumb__) || defined(__ARM_EABI__) -#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name; -#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs -#define __syscall(name) "swi\t0" -#else -#define __SYS_REG(name) -#define __SYS_REG_LIST(regs...) regs -#define __syscall(name) "swi\t" __sys1(__NR_##name) "" -#endif - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) { \ - __SYS_REG(sname) \ +/* + * linux/include/asm-arm/unistd.h + * + * Copyright (C) 2001-2005 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Please forward _all_ changes to this file to rmk@arm.linux.org.uk, + * no matter what the change is. Thanks! + */ + +#define __NR_OABI_SYSCALL_BASE 0x900000 + +#if defined(__thumb__) || defined(__ARM_EABI__) +#define __NR_SYSCALL_BASE 0 +#else +#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE +#endif + +#define __NR_io_setup (__NR_SYSCALL_BASE+243) +#define __NR_io_destroy (__NR_SYSCALL_BASE+244) +#define __NR_io_getevents (__NR_SYSCALL_BASE+245) +#define __NR_io_submit (__NR_SYSCALL_BASE+246) +#define __NR_io_cancel (__NR_SYSCALL_BASE+247) + +#define __sys2(x) #x +#define __sys1(x) __sys2(x) + +#if defined(__thumb__) || defined(__ARM_EABI__) +#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name; +#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs +#define __syscall(name) "swi\t0" +#else +#define __SYS_REG(name) +#define __SYS_REG_LIST(regs...) regs +#define __syscall(name) "swi\t" __sys1(__NR_##name) "" +#endif + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) { \ + __SYS_REG(sname) \ register long __r0 __asm__("r0") = (long)arg1; \ register long __res_r0 __asm__("r0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_r0) \ - : __SYS_REG_LIST( "0" (__r0) ) \ - : "memory" ); \ - return (type) __res_r0; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) { \ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0) ) \ + : "memory" ); \ + return (type) __res_r0; \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) { \ + __SYS_REG(sname) \ register long __r0 __asm__("r0") = (long)arg1; \ register long __r1 __asm__("r1") = (long)arg2; \ register long __res_r0 __asm__("r0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_r0) \ - : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) \ - : "memory" ); \ - return (type) __res_r0; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) { \ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) \ + : "memory" ); \ + return (type) __res_r0; \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) { \ + __SYS_REG(sname) \ register long __r0 __asm__("r0") = (long)arg1; \ register long __r1 __asm__("r1") = (long)arg2; \ register long __r2 __asm__("r2") = (long)arg3; \ register long __res_r0 __asm__("r0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_r0) \ - : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) \ - : "memory" ); \ - return (type) __res_r0; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) \ + : "memory" ); \ + return (type) __res_r0; \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + __SYS_REG(sname) \ register long __r0 __asm__("r0") = (long)arg1; \ register long __r1 __asm__("r1") = (long)arg2; \ register long __r2 __asm__("r2") = (long)arg3; \ register long __r3 __asm__("r3") = (long)arg4; \ register long __res_r0 __asm__("r0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_r0) \ - : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) \ - : "memory" ); \ - return (type) __res_r0; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {\ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) \ + : "memory" ); \ + return (type) __res_r0; \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {\ + __SYS_REG(sname) \ register long __r0 __asm__("r0") = (long)arg1; \ register long __r1 __asm__("r1") = (long)arg2; \ register long __r2 __asm__("r2") = (long)arg3; \ register long __r3 __asm__("r3") = (long)arg4; \ register long __r4 __asm__("r4") = (long)arg5; \ register long __res_r0 __asm__("r0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_r0) \ - : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ - "r" (__r3), "r" (__r4) ) \ - : "memory" ); \ - return (type) __res_r0; \ -} - + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ + "r" (__r3), "r" (__r4) ) \ + : "memory" ); \ + return (type) __res_r0; \ +} + diff --git a/contrib/libs/libaio/syscall-arm64.h b/contrib/libs/libaio/syscall-arm64.h index 031c571824..fb2c5e024e 100644 --- a/contrib/libs/libaio/syscall-arm64.h +++ b/contrib/libs/libaio/syscall-arm64.h @@ -1,101 +1,101 @@ -/* - * linux/include/asm-arm/unistd.h - * - * Copyright (C) 2001-2005 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Please forward _all_ changes to this file to rmk@arm.linux.org.uk, - * no matter what the change is. Thanks! - */ - -#define __NR_io_setup 0 -#define __NR_io_destroy 1 -#define __NR_io_submit 2 -#define __NR_io_cancel 3 -#define __NR_io_getevents 4 - -#define __sys2(x) #x -#define __sys1(x) __sys2(x) - -#define __SYS_REG(name) register long __sysreg __asm__("w8") = __NR_##name; -#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs -#define __syscall(name) "svc\t#0" - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) { \ - __SYS_REG(sname) \ +/* + * linux/include/asm-arm/unistd.h + * + * Copyright (C) 2001-2005 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Please forward _all_ changes to this file to rmk@arm.linux.org.uk, + * no matter what the change is. Thanks! + */ + +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_io_getevents 4 + +#define __sys2(x) #x +#define __sys1(x) __sys2(x) + +#define __SYS_REG(name) register long __sysreg __asm__("w8") = __NR_##name; +#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs +#define __syscall(name) "svc\t#0" + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) { \ + __SYS_REG(sname) \ register long __x0 __asm__("x0") = (long)arg1; \ register long __res_x0 __asm__("x0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_x0) \ - : __SYS_REG_LIST( "0" (__x0) ) \ - : "memory" ); \ - return (type) __res_x0; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) { \ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_x0) \ + : __SYS_REG_LIST( "0" (__x0) ) \ + : "memory" ); \ + return (type) __res_x0; \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) { \ + __SYS_REG(sname) \ register long __x0 __asm__("x0") = (long)arg1; \ register long __x1 __asm__("x1") = (long)arg2; \ register long __res_x0 __asm__("x0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_x0) \ - : __SYS_REG_LIST( "0" (__x0), "r" (__x1) ) \ - : "memory" ); \ - return (type) __res_x0; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) { \ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_x0) \ + : __SYS_REG_LIST( "0" (__x0), "r" (__x1) ) \ + : "memory" ); \ + return (type) __res_x0; \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) { \ + __SYS_REG(sname) \ register long __x0 __asm__("x0") = (long)arg1; \ register long __x1 __asm__("x1") = (long)arg2; \ register long __x2 __asm__("x2") = (long)arg3; \ register long __res_x0 __asm__("x0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_x0) \ - : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2) ) \ - : "memory" ); \ - return (type) __res_x0; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_x0) \ + : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2) ) \ + : "memory" ); \ + return (type) __res_x0; \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + __SYS_REG(sname) \ register long __x0 __asm__("x0") = (long)arg1; \ register long __x1 __asm__("x1") = (long)arg2; \ register long __x2 __asm__("x2") = (long)arg3; \ register long __x3 __asm__("x3") = (long)arg4; \ register long __res_x0 __asm__("x0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_x0) \ - : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2), "r" (__x3) ) \ - : "memory" ); \ - return (type) __res_x0; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {\ - __SYS_REG(sname) \ + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_x0) \ + : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2), "r" (__x3) ) \ + : "memory" ); \ + return (type) __res_x0; \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {\ + __SYS_REG(sname) \ register long __x0 __asm__("x0") = (long)arg1; \ register long __x1 __asm__("x1") = (long)arg2; \ register long __x2 __asm__("x2") = (long)arg3; \ register long __x3 __asm__("x3") = (long)arg4; \ register long __x4 __asm__("x4") = (long)arg5; \ register long __res_x0 __asm__("x0"); \ - __asm__ __volatile__ ( \ - __syscall(sname) \ - : "=r" (__res_x0) \ - : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2), \ - "r" (__x3), "r" (__x4) ) \ - : "memory" ); \ - return (type) __res_x0; \ -} + __asm__ __volatile__ ( \ + __syscall(sname) \ + : "=r" (__res_x0) \ + : __SYS_REG_LIST( "0" (__x0), "r" (__x1), "r" (__x2), \ + "r" (__x3), "r" (__x4) ) \ + : "memory" ); \ + return (type) __res_x0; \ +} diff --git a/contrib/libs/libaio/syscall-generic.h b/contrib/libs/libaio/syscall-generic.h index 24d7c7c816..24b3a3dec1 100644 --- a/contrib/libs/libaio/syscall-generic.h +++ b/contrib/libs/libaio/syscall-generic.h @@ -1,29 +1,29 @@ -#include <errno.h> -#include <unistd.h> -#include <sys/syscall.h> - -#define _body_io_syscall(sname, args...) \ -{ \ - int ret = syscall(__NR_##sname, ## args); \ - return ret < 0 ? -errno : ret; \ -} - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -_body_io_syscall(sname, (long)arg1) - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -_body_io_syscall(sname, (long)arg1, (long)arg2) - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3) - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4) - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5) +#include <errno.h> +#include <unistd.h> +#include <sys/syscall.h> + +#define _body_io_syscall(sname, args...) \ +{ \ + int ret = syscall(__NR_##sname, ## args); \ + return ret < 0 ? -errno : ret; \ +} + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) \ +_body_io_syscall(sname, (long)arg1) + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) \ +_body_io_syscall(sname, (long)arg1, (long)arg2) + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) \ +_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3) + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4) + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, type5,arg5) \ +type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +_body_io_syscall(sname, (long)arg1, (long)arg2, (long)arg3, (long)arg4, (long)arg5) diff --git a/contrib/libs/libaio/syscall-i386.h b/contrib/libs/libaio/syscall-i386.h index 9576975a19..568dd2aaff 100644 --- a/contrib/libs/libaio/syscall-i386.h +++ b/contrib/libs/libaio/syscall-i386.h @@ -1,72 +1,72 @@ -#define __NR_io_setup 245 -#define __NR_io_destroy 246 -#define __NR_io_getevents 247 -#define __NR_io_submit 248 -#define __NR_io_cancel 249 - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1))); \ -return __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2))); \ -return __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3))); \ -return __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4))); \ -return __res; \ +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile ("xchgl %%edi,%%ebx\n" \ + "int $0x80\n" \ + "xchgl %%edi,%%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1))); \ +return __res; \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile ("xchgl %%edi,%%ebx\n" \ + "int $0x80\n" \ + "xchgl %%edi,%%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2))); \ +return __res; \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile ("xchgl %%edi,%%ebx\n" \ + "int $0x80\n" \ + "xchgl %%edi,%%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +return __res; \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ volatile ("xchgl %%edi,%%ebx\n" \ + "int $0x80\n" \ + "xchgl %%edi,%%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +return __res; \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +long tmp; \ +__asm__ volatile ("movl %%ebx,%7\n" \ + "movl %2,%%ebx\n" \ + "int $0x80\n" \ + "movl %7,%%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##sname),"rm" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ + "m" (tmp)); \ +return __res; \ } - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -long tmp; \ -__asm__ volatile ("movl %%ebx,%7\n" \ - "movl %2,%%ebx\n" \ - "int $0x80\n" \ - "movl %7,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"rm" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ - "m" (tmp)); \ -return __res; \ -} diff --git a/contrib/libs/libaio/syscall-ia64.h b/contrib/libs/libaio/syscall-ia64.h index 52ce9dd7d6..bb6a330a01 100644 --- a/contrib/libs/libaio/syscall-ia64.h +++ b/contrib/libs/libaio/syscall-ia64.h @@ -1,45 +1,45 @@ -#define __NR_io_setup 1238 -#define __NR_io_destroy 1239 -#define __NR_io_getevents 1240 -#define __NR_io_submit 1241 -#define __NR_io_cancel 1242 - -#define __ia64_raw_syscall(fname, sname) \ - __asm__ (".text\n" \ - ".globl " SYMSTR(fname) "\n" \ - ".proc " SYMSTR(fname) "\n" \ - SYMSTR(fname) ":\n" \ - " mov r15=" SYMSTR( __NR_ ## sname ) "\n" \ - " break 0x100000\n" \ - " ;;\n" \ - " cmp.eq p6,p0=-1,r10\n" \ - " ;;\n" \ - " (p6) sub r8=0,r8\n" \ - " br.ret.sptk.few b0\n" \ - ".size " SYMSTR(fname) ", . - " SYMSTR(fname) "\n" \ - ".endp " SYMSTR(fname) "\n" \ - ); - -#define io_syscall0(type, name) \ - extern type name(void); \ - __ia64_raw_syscall(name); - -#define io_syscall1(type, fname, sname, type1, arg1) \ - extern type fname(type1 arg1); \ - __ia64_raw_syscall(fname, sname); - -#define io_syscall2(type, fname, sname, type1, arg1, type2, arg2) \ - extern type fname(type1 arg1, type2 arg2); \ - __ia64_raw_syscall(fname, sname); - -#define io_syscall3(type, fname, sname, type1, arg1, type2, arg2, type3, arg3) \ - extern type fname(type1 arg1, type2 arg2, type3 arg3); \ - __ia64_raw_syscall(fname, sname); - -#define io_syscall4(type, fname, sname, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \ - extern type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4); \ - __ia64_raw_syscall(fname, sname); - -#define io_syscall5(type, fname, sname, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \ - extern type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5); \ - __ia64_raw_syscall(fname, sname); +#define __NR_io_setup 1238 +#define __NR_io_destroy 1239 +#define __NR_io_getevents 1240 +#define __NR_io_submit 1241 +#define __NR_io_cancel 1242 + +#define __ia64_raw_syscall(fname, sname) \ + __asm__ (".text\n" \ + ".globl " SYMSTR(fname) "\n" \ + ".proc " SYMSTR(fname) "\n" \ + SYMSTR(fname) ":\n" \ + " mov r15=" SYMSTR( __NR_ ## sname ) "\n" \ + " break 0x100000\n" \ + " ;;\n" \ + " cmp.eq p6,p0=-1,r10\n" \ + " ;;\n" \ + " (p6) sub r8=0,r8\n" \ + " br.ret.sptk.few b0\n" \ + ".size " SYMSTR(fname) ", . - " SYMSTR(fname) "\n" \ + ".endp " SYMSTR(fname) "\n" \ + ); + +#define io_syscall0(type, name) \ + extern type name(void); \ + __ia64_raw_syscall(name); + +#define io_syscall1(type, fname, sname, type1, arg1) \ + extern type fname(type1 arg1); \ + __ia64_raw_syscall(fname, sname); + +#define io_syscall2(type, fname, sname, type1, arg1, type2, arg2) \ + extern type fname(type1 arg1, type2 arg2); \ + __ia64_raw_syscall(fname, sname); + +#define io_syscall3(type, fname, sname, type1, arg1, type2, arg2, type3, arg3) \ + extern type fname(type1 arg1, type2 arg2, type3 arg3); \ + __ia64_raw_syscall(fname, sname); + +#define io_syscall4(type, fname, sname, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \ + extern type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4); \ + __ia64_raw_syscall(fname, sname); + +#define io_syscall5(type, fname, sname, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \ + extern type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5); \ + __ia64_raw_syscall(fname, sname); diff --git a/contrib/libs/libaio/syscall-ppc.h b/contrib/libs/libaio/syscall-ppc.h index ca70dd2092..149348614c 100644 --- a/contrib/libs/libaio/syscall-ppc.h +++ b/contrib/libs/libaio/syscall-ppc.h @@ -1,94 +1,94 @@ -#define __NR_io_setup 227 -#define __NR_io_destroy 228 -#define __NR_io_getevents 229 -#define __NR_io_submit 230 -#define __NR_io_cancel 231 - -/* On powerpc a system call basically clobbers the same registers like a - * function call, with the exception of LR (which is needed for the - * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal - * an error return status). - */ - -#define __syscall_nr(nr, type, name, args...) \ - unsigned long __sc_ret, __sc_err; \ - { \ - register unsigned long __sc_0 __asm__ ("r0"); \ - register unsigned long __sc_3 __asm__ ("r3"); \ - register unsigned long __sc_4 __asm__ ("r4"); \ - register unsigned long __sc_5 __asm__ ("r5"); \ - register unsigned long __sc_6 __asm__ ("r6"); \ - register unsigned long __sc_7 __asm__ ("r7"); \ - register unsigned long __sc_8 __asm__ ("r8"); \ - \ - __sc_loadargs_##nr(name, args); \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %0 " \ - : "=&r" (__sc_0), \ - "=&r" (__sc_3), "=&r" (__sc_4), \ - "=&r" (__sc_5), "=&r" (__sc_6), \ - "=&r" (__sc_7), "=&r" (__sc_8) \ - : __sc_asm_input_##nr \ - : "cr0", "ctr", "memory", \ - "r9", "r10","r11", "r12"); \ - __sc_ret = __sc_3; \ - __sc_err = __sc_0; \ - } \ - if (__sc_err & 0x10000000) return -((int)__sc_ret); \ - return (type) __sc_ret - -#define __sc_loadargs_0(name, dummy...) \ - __sc_0 = __NR_##name -#define __sc_loadargs_1(name, arg1) \ - __sc_loadargs_0(name); \ - __sc_3 = (unsigned long) (arg1) -#define __sc_loadargs_2(name, arg1, arg2) \ - __sc_loadargs_1(name, arg1); \ - __sc_4 = (unsigned long) (arg2) -#define __sc_loadargs_3(name, arg1, arg2, arg3) \ - __sc_loadargs_2(name, arg1, arg2); \ - __sc_5 = (unsigned long) (arg3) -#define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \ - __sc_loadargs_3(name, arg1, arg2, arg3); \ - __sc_6 = (unsigned long) (arg4) -#define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \ - __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \ - __sc_7 = (unsigned long) (arg5) - -#define __sc_asm_input_0 "0" (__sc_0) -#define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3) -#define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4) -#define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5) -#define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6) -#define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7) - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ - __syscall_nr(1, type, sname, arg1); \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1, type2 arg2) \ -{ \ - __syscall_nr(2, type, sname, arg1, arg2); \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1, type2 arg2, type3 arg3) \ -{ \ - __syscall_nr(3, type, sname, arg1, arg2, arg3); \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - __syscall_nr(4, type, sname, arg1, arg2, arg3, arg4); \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ -{ \ - __syscall_nr(5, type, sname, arg1, arg2, arg3, arg4, arg5); \ -} +#define __NR_io_setup 227 +#define __NR_io_destroy 228 +#define __NR_io_getevents 229 +#define __NR_io_submit 230 +#define __NR_io_cancel 231 + +/* On powerpc a system call basically clobbers the same registers like a + * function call, with the exception of LR (which is needed for the + * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal + * an error return status). + */ + +#define __syscall_nr(nr, type, name, args...) \ + unsigned long __sc_ret, __sc_err; \ + { \ + register unsigned long __sc_0 __asm__ ("r0"); \ + register unsigned long __sc_3 __asm__ ("r3"); \ + register unsigned long __sc_4 __asm__ ("r4"); \ + register unsigned long __sc_5 __asm__ ("r5"); \ + register unsigned long __sc_6 __asm__ ("r6"); \ + register unsigned long __sc_7 __asm__ ("r7"); \ + register unsigned long __sc_8 __asm__ ("r8"); \ + \ + __sc_loadargs_##nr(name, args); \ + __asm__ __volatile__ \ + ("sc \n\t" \ + "mfcr %0 " \ + : "=&r" (__sc_0), \ + "=&r" (__sc_3), "=&r" (__sc_4), \ + "=&r" (__sc_5), "=&r" (__sc_6), \ + "=&r" (__sc_7), "=&r" (__sc_8) \ + : __sc_asm_input_##nr \ + : "cr0", "ctr", "memory", \ + "r9", "r10","r11", "r12"); \ + __sc_ret = __sc_3; \ + __sc_err = __sc_0; \ + } \ + if (__sc_err & 0x10000000) return -((int)__sc_ret); \ + return (type) __sc_ret + +#define __sc_loadargs_0(name, dummy...) \ + __sc_0 = __NR_##name +#define __sc_loadargs_1(name, arg1) \ + __sc_loadargs_0(name); \ + __sc_3 = (unsigned long) (arg1) +#define __sc_loadargs_2(name, arg1, arg2) \ + __sc_loadargs_1(name, arg1); \ + __sc_4 = (unsigned long) (arg2) +#define __sc_loadargs_3(name, arg1, arg2, arg3) \ + __sc_loadargs_2(name, arg1, arg2); \ + __sc_5 = (unsigned long) (arg3) +#define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \ + __sc_loadargs_3(name, arg1, arg2, arg3); \ + __sc_6 = (unsigned long) (arg4) +#define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \ + __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \ + __sc_7 = (unsigned long) (arg5) + +#define __sc_asm_input_0 "0" (__sc_0) +#define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3) +#define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4) +#define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5) +#define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6) +#define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7) + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) \ +{ \ + __syscall_nr(1, type, sname, arg1); \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1, type2 arg2) \ +{ \ + __syscall_nr(2, type, sname, arg1, arg2); \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1, type2 arg2, type3 arg3) \ +{ \ + __syscall_nr(3, type, sname, arg1, arg2, arg3); \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + __syscall_nr(4, type, sname, arg1, arg2, arg3, arg4); \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ +{ \ + __syscall_nr(5, type, sname, arg1, arg2, arg3, arg4, arg5); \ +} diff --git a/contrib/libs/libaio/syscall-s390.h b/contrib/libs/libaio/syscall-s390.h index 3ec5ee34ee..f595810dda 100644 --- a/contrib/libs/libaio/syscall-s390.h +++ b/contrib/libs/libaio/syscall-s390.h @@ -1,131 +1,131 @@ -#define __NR_io_setup 243 -#define __NR_io_destroy 244 -#define __NR_io_getevents 245 -#define __NR_io_submit 246 -#define __NR_io_cancel 247 - -#define io_svc_clobber "1", "cc", "memory" - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) { \ - register type1 __arg1 asm("2") = arg1; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " .svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1, type2 arg2) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2, \ - type3,arg3) \ -type fname(type1 arg1, type2 arg2, type3 arg3) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2, \ - type3,arg3,type4,arg4) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register type4 __arg4 asm("5") = arg4; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3), \ - "d" (__arg4) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2, \ - type3,arg3,type4,arg4,type5,arg5) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register type4 __arg4 asm("5") = arg4; \ - register type5 __arg5 asm("6") = arg5; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3), \ - "d" (__arg4), \ - "d" (__arg5) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} +#define __NR_io_setup 243 +#define __NR_io_destroy 244 +#define __NR_io_getevents 245 +#define __NR_io_submit 246 +#define __NR_io_cancel 247 + +#define io_svc_clobber "1", "cc", "memory" + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) { \ + register type1 __arg1 asm("2") = arg1; \ + register long __svcres asm("2"); \ + long __res; \ + __asm__ __volatile__ ( \ + " .if %1 < 256\n" \ + " svc %b1\n" \ + " .else\n" \ + " la %%r1,%1\n" \ + " .svc 0\n" \ + " .endif" \ + : "=d" (__svcres) \ + : "i" (__NR_##sname), \ + "0" (__arg1) \ + : io_svc_clobber ); \ + __res = __svcres; \ + return (type) __res; \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1, type2 arg2) { \ + register type1 __arg1 asm("2") = arg1; \ + register type2 __arg2 asm("3") = arg2; \ + register long __svcres asm("2"); \ + long __res; \ + __asm__ __volatile__ ( \ + " .if %1 < 256\n" \ + " svc %b1\n" \ + " .else\n" \ + " la %%r1,%1\n" \ + " svc 0\n" \ + " .endif" \ + : "=d" (__svcres) \ + : "i" (__NR_##sname), \ + "0" (__arg1), \ + "d" (__arg2) \ + : io_svc_clobber ); \ + __res = __svcres; \ + return (type) __res; \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2, \ + type3,arg3) \ +type fname(type1 arg1, type2 arg2, type3 arg3) { \ + register type1 __arg1 asm("2") = arg1; \ + register type2 __arg2 asm("3") = arg2; \ + register type3 __arg3 asm("4") = arg3; \ + register long __svcres asm("2"); \ + long __res; \ + __asm__ __volatile__ ( \ + " .if %1 < 256\n" \ + " svc %b1\n" \ + " .else\n" \ + " la %%r1,%1\n" \ + " svc 0\n" \ + " .endif" \ + : "=d" (__svcres) \ + : "i" (__NR_##sname), \ + "0" (__arg1), \ + "d" (__arg2), \ + "d" (__arg3) \ + : io_svc_clobber ); \ + __res = __svcres; \ + return (type) __res; \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2, \ + type3,arg3,type4,arg4) \ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + register type1 __arg1 asm("2") = arg1; \ + register type2 __arg2 asm("3") = arg2; \ + register type3 __arg3 asm("4") = arg3; \ + register type4 __arg4 asm("5") = arg4; \ + register long __svcres asm("2"); \ + long __res; \ + __asm__ __volatile__ ( \ + " .if %1 < 256\n" \ + " svc %b1\n" \ + " .else\n" \ + " la %%r1,%1\n" \ + " svc 0\n" \ + " .endif" \ + : "=d" (__svcres) \ + : "i" (__NR_##sname), \ + "0" (__arg1), \ + "d" (__arg2), \ + "d" (__arg3), \ + "d" (__arg4) \ + : io_svc_clobber ); \ + __res = __svcres; \ + return (type) __res; \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2, \ + type3,arg3,type4,arg4,type5,arg5) \ +type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5) { \ + register type1 __arg1 asm("2") = arg1; \ + register type2 __arg2 asm("3") = arg2; \ + register type3 __arg3 asm("4") = arg3; \ + register type4 __arg4 asm("5") = arg4; \ + register type5 __arg5 asm("6") = arg5; \ + register long __svcres asm("2"); \ + long __res; \ + __asm__ __volatile__ ( \ + " .if %1 < 256\n" \ + " svc %b1\n" \ + " .else\n" \ + " la %%r1,%1\n" \ + " svc 0\n" \ + " .endif" \ + : "=d" (__svcres) \ + : "i" (__NR_##sname), \ + "0" (__arg1), \ + "d" (__arg2), \ + "d" (__arg3), \ + "d" (__arg4), \ + "d" (__arg5) \ + : io_svc_clobber ); \ + __res = __svcres; \ + return (type) __res; \ +} diff --git a/contrib/libs/libaio/syscall-sparc.h b/contrib/libs/libaio/syscall-sparc.h index dd8033d015..f93c2a29c3 100644 --- a/contrib/libs/libaio/syscall-sparc.h +++ b/contrib/libs/libaio/syscall-sparc.h @@ -1,103 +1,103 @@ -#include <errno.h> - -#define __NR_io_setup 268 -#define __NR_io_destroy 269 -#define __NR_io_submit 270 -#define __NR_io_cancel 271 -#define __NR_io_getevents 272 - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##sname; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__g1) \ - : "cc"); \ -return (type) __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##sname; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__g1) \ - : "cc"); \ -return (type) __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##sname; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ - : "cc"); \ -return (type) __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##sname; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -register long __o3 __asm__ ("o3") = (long)(arg4); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ - : "cc"); \ -return (type) __res; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##sname; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -register long __o3 __asm__ ("o3") = (long)(arg4); \ -register long __o4 __asm__ ("o4") = (long)(arg5); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \ - : "cc"); \ -return (type) __res; \ -} +#include <errno.h> + +#define __NR_io_setup 268 +#define __NR_io_destroy 269 +#define __NR_io_submit 270 +#define __NR_io_cancel 271 +#define __NR_io_getevents 272 + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) \ +{ \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##sname; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__g1) \ + : "cc"); \ +return (type) __res; \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##sname; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__g1) \ + : "cc"); \ +return (type) __res; \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##sname; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ + : "cc"); \ +return (type) __res; \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##sname; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +register long __o3 __asm__ ("o3") = (long)(arg4); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ + : "cc"); \ +return (type) __res; \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##sname; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +register long __o3 __asm__ ("o3") = (long)(arg4); \ +register long __o4 __asm__ ("o4") = (long)(arg5); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \ + : "cc"); \ +return (type) __res; \ +} diff --git a/contrib/libs/libaio/syscall-x86_64.h b/contrib/libs/libaio/syscall-x86_64.h index 9361856723..7e85d7f339 100644 --- a/contrib/libs/libaio/syscall-x86_64.h +++ b/contrib/libs/libaio/syscall-x86_64.h @@ -1,63 +1,63 @@ -#define __NR_io_setup 206 -#define __NR_io_destroy 207 -#define __NR_io_getevents 208 -#define __NR_io_submit 209 -#define __NR_io_cancel 210 - -#define __syscall_clobber "r11","rcx","memory" -#define __syscall "syscall" - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)) : __syscall_clobber ); \ -return __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ -return __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)) : __syscall_clobber); \ -return __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -__asm__ volatile ("movq %5,%%r10 ;" __syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \ -return __res; \ +#define __NR_io_setup 206 +#define __NR_io_destroy 207 +#define __NR_io_getevents 208 +#define __NR_io_submit 209 +#define __NR_io_cancel 210 + +#define __syscall_clobber "r11","rcx","memory" +#define __syscall "syscall" + +#define io_syscall1(type,fname,sname,type1,arg1) \ +type fname(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)) : __syscall_clobber ); \ +return __res; \ +} + +#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ +type fname(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ +return __res; \ +} + +#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ +type fname(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ + "d" ((long)(arg3)) : __syscall_clobber); \ +return __res; \ +} + +#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ volatile ("movq %5,%%r10 ;" __syscall \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ + "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \ +return __res; \ +} + +#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall \ + : "=a" (__res) \ + : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ + "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) : \ + __syscall_clobber,"r8","r10" ); \ +return __res; \ } - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) : \ - __syscall_clobber,"r8","r10" ); \ -return __res; \ -} diff --git a/contrib/libs/libaio/syscall.h b/contrib/libs/libaio/syscall.h index a2da0307a0..9cbde2d8f8 100644 --- a/contrib/libs/libaio/syscall.h +++ b/contrib/libs/libaio/syscall.h @@ -1,34 +1,34 @@ -#include <sys/syscall.h> -#include <unistd.h> - -#define _SYMSTR(str) #str -#define SYMSTR(str) _SYMSTR(str) - -#define SYMVER(compat_sym, orig_sym, ver_sym) \ - __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym)); - -#define DEFSYMVER(compat_sym, orig_sym, ver_sym) \ - __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym)); - -#if defined(__i386__) -#include "syscall-i386.h" -#elif defined(__x86_64__) -#include "syscall-x86_64.h" -#elif defined(__ia64__) -#include "syscall-ia64.h" -#elif defined(__PPC__) -#include "syscall-ppc.h" -#elif defined(__s390__) -#include "syscall-s390.h" -#elif defined(__alpha__) -#include "syscall-alpha.h" -#elif defined(__arm__) -#include "syscall-arm.h" -#elif defined(__sparc__) -#include "syscall-sparc.h" -#elif defined(__aarch64__) -#include "syscall-arm64.h" -#else -#warning "using generic syscall method" -#include "syscall-generic.h" -#endif +#include <sys/syscall.h> +#include <unistd.h> + +#define _SYMSTR(str) #str +#define SYMSTR(str) _SYMSTR(str) + +#define SYMVER(compat_sym, orig_sym, ver_sym) \ + __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym)); + +#define DEFSYMVER(compat_sym, orig_sym, ver_sym) \ + __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym)); + +#if defined(__i386__) +#include "syscall-i386.h" +#elif defined(__x86_64__) +#include "syscall-x86_64.h" +#elif defined(__ia64__) +#include "syscall-ia64.h" +#elif defined(__PPC__) +#include "syscall-ppc.h" +#elif defined(__s390__) +#include "syscall-s390.h" +#elif defined(__alpha__) +#include "syscall-alpha.h" +#elif defined(__arm__) +#include "syscall-arm.h" +#elif defined(__sparc__) +#include "syscall-sparc.h" +#elif defined(__aarch64__) +#include "syscall-arm64.h" +#else +#warning "using generic syscall method" +#include "syscall-generic.h" +#endif diff --git a/contrib/libs/libaio/vsys_def.h b/contrib/libs/libaio/vsys_def.h index 13d032e330..1e93433572 100644 --- a/contrib/libs/libaio/vsys_def.h +++ b/contrib/libs/libaio/vsys_def.h @@ -1,24 +1,24 @@ -/* libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -extern int vsys_io_setup(unsigned nr_reqs, io_context_t *ctxp); -extern int vsys_io_destroy(io_context_t ctx); -extern int vsys_io_submit(io_context_t ctx, long nr, struct iocb *iocbs[]); -extern int vsys_io_cancel(io_context_t ctx, struct iocb *iocb); -extern int vsys_io_wait(io_context_t ctx, struct iocb *iocb, const struct timespec *when); -extern int vsys_io_getevents(io_context_t ctx_id, long nr, struct io_event *events, const struct timespec *timeout); - +/* libaio Linux async I/O interface + Copyright 2002 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +extern int vsys_io_setup(unsigned nr_reqs, io_context_t *ctxp); +extern int vsys_io_destroy(io_context_t ctx); +extern int vsys_io_submit(io_context_t ctx, long nr, struct iocb *iocbs[]); +extern int vsys_io_cancel(io_context_t ctx, struct iocb *iocb); +extern int vsys_io_wait(io_context_t ctx, struct iocb *iocb, const struct timespec *when); +extern int vsys_io_getevents(io_context_t ctx_id, long nr, struct io_event *events, const struct timespec *timeout); + diff --git a/contrib/libs/libaio/ya.make b/contrib/libs/libaio/ya.make index 3eb09b549b..3d5448860d 100644 --- a/contrib/libs/libaio/ya.make +++ b/contrib/libs/libaio/ya.make @@ -1,5 +1,5 @@ -LIBRARY() - +LIBRARY() + # git repository: https://pagure.io/libaio.git # revision: 5a546a834c36070648158d19dd564762d59f8eb8 @@ -13,9 +13,9 @@ OWNER( g:contrib g:cpp-contrib ) - -NO_RUNTIME() - + +NO_RUNTIME() + IF (USE_DYNAMIC_AIO) PEERDIR( contrib/libs/libaio/dynamic @@ -25,8 +25,8 @@ ELSE() contrib/libs/libaio/static ) ENDIF() - -END() + +END() RECURSE( dynamic diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make index 9c4640fdcf..7ef41e85f9 100644 --- a/contrib/libs/ya.make +++ b/contrib/libs/ya.make @@ -395,7 +395,7 @@ IF (OS_LINUX) proc luajit luajit_21 - libaio + libaio libcap libmnl libnfnetlink @@ -405,7 +405,7 @@ IF (OS_LINUX) sdbus-cpp systemd uuid - virtiofsd + virtiofsd ) ENDIF() @@ -440,7 +440,7 @@ IF (OS_IOS AND ARCH_ARM64 OR OS_DARWIN) MoltenVK ) ENDIF() - + IF (MUSL) RECURSE(musl_extra) ENDIF() |