summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-12-16 13:47:10 +0100
committerMattias Andrée <maandree@kth.se>2023-12-16 13:47:10 +0100
commit522948817bebc886ad236450745466975633e977 (patch)
treef53fc385c29be9b08d9c8f9c88a00ce9d1543de4
parentAll kinds of stuff (diff)
downloadlibsyscalls-522948817bebc886ad236450745466975633e977.tar.gz
libsyscalls-522948817bebc886ad236450745466975633e977.tar.bz2
libsyscalls-522948817bebc886ad236450745466975633e977.tar.xz
Tell the user whether signals and errors are signed or unsigned
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--common.h3
-rw-r--r--libsyscalls.h10
-rw-r--r--libsyscalls_get_signals.c7
-rw-r--r--libsyscalls_get_syscall_display_info.c6
-rw-r--r--libsyscalls_get_syscall_errors.c7
-rw-r--r--linux/errors.c4
-rw-r--r--linux/signals.c4
-rw-r--r--linux/symbols.c3
-rw-r--r--testcases/errors-LINUX-AMD64300
-rw-r--r--testcases/errors-LINUX-PARISC_32304
-rw-r--r--testcases/signals-LINUX-AMD64128
-rw-r--r--tests/signals13
-rw-r--r--tests/syscall-errors13
-rw-r--r--testutil/get-signals.c14
-rw-r--r--testutil/get-syscall-errors.c14
15 files changed, 421 insertions, 409 deletions
diff --git a/common.h b/common.h
index 446f438..e2a5422 100644
--- a/common.h
+++ b/common.h
@@ -77,6 +77,7 @@ enum endian {
};
+/* Don't forget to update SUPPORTED_ARCHES in Makefile */
#define LIST_ARCH_SPECS(X, D) /* byte intptr size_t endian sign */\
X(LIBSYSCALLS_ARCH_ALPHA_LE, 8, 64, 64, Little, TWOS_COMPLEMENT) D\
X(LIBSYSCALLS_ARCH_ALPHA_BE, 8, 64, 64, Big, TWOS_COMPLEMENT) D\
@@ -123,8 +124,6 @@ enum endian {
X(LIBSYSCALLS_ARCH_I386, 8, 32, 32, Little, TWOS_COMPLEMENT) D\
X(LIBSYSCALLS_ARCH_XTENSA_LE, 8, 32, 32, Little, TWOS_COMPLEMENT) D\
X(LIBSYSCALLS_ARCH_XTENSA_BE, 8, 32, 32, Big, TWOS_COMPLEMENT)
- /* Don't forget to update SUPPORTED_ARCHES in Makefile */
- /* TODO (alignment) means that it is missing in libsyscalls_get_integer_alignment.c and must also be added thither */
#include "generated/oses.h"
diff --git a/libsyscalls.h b/libsyscalls.h
index 382022b..f2d5fdd 100644
--- a/libsyscalls.h
+++ b/libsyscalls.h
@@ -2604,6 +2604,7 @@ libsyscalls_get_syscall(enum libsyscalls_os, enum libsyscalls_arch, long long in
* @param errors_out Output parameter for the error list (may be NULL, never filled with NULL)
* @param num_errors_out Output parameter for the number of errors returned in `*errors_out` (may be NULL)
* (if `errors_out` is NULL, the number that would be returned is stored)
+ * @param are_signed_out Output parameter for whether the error numbers are signed (may be NULL)
* @return LIBSYSCALLS_E_OK - On success
* LIBSYSCALLS_E_OSNOSUP - The library is not compiled with support for
* the selected operating system (`os`)
@@ -2616,9 +2617,9 @@ libsyscalls_get_syscall(enum libsyscalls_os, enum libsyscalls_arch, long long in
* is not supported, however it may be successful even if the
* architecture (`arch`) not supported
*/
-LIBSYSCALLS_GCC_ATTRIBUTES_(__access__(__write_only__, 3), __access__(__write_only__, 4))
+LIBSYSCALLS_GCC_ATTRIBUTES_(__access__(__write_only__, 3), __access__(__write_only__, 4), __access__(__write_only__, 5))
enum libsyscalls_error
-libsyscalls_get_syscall_errors(enum libsyscalls_os, enum libsyscalls_arch, const struct libsyscalls_named_number **, size_t *);
+libsyscalls_get_syscall_errors(enum libsyscalls_os, enum libsyscalls_arch, const struct libsyscalls_named_number **, size_t *, int *);
/**
* Get the system signals defined by an operating system
@@ -2634,6 +2635,7 @@ libsyscalls_get_syscall_errors(enum libsyscalls_os, enum libsyscalls_arch, const
* @param signals_out Output parameter for the signal list (may be NULL, never filled with NULL)
* @param num_signals_out Output parameter for the number of signals returned in `*signals_out` (may be NULL)
* (if `signals_out` is NULL, the number that would be returned is stored)
+ * @param are_signed_ out Output parameter for whether the signal numbers are signed (may be NULL)
* @return LIBSYSCALLS_E_OK - On success
* LIBSYSCALLS_E_OSNOSUP - The library is not compiled with support for
* the selected operating system (`os`)
@@ -2646,9 +2648,9 @@ libsyscalls_get_syscall_errors(enum libsyscalls_os, enum libsyscalls_arch, const
* is not supported, however it may be successful even if the
* architecture (`arch`) not supported
*/
-LIBSYSCALLS_GCC_ATTRIBUTES_(__access__(__write_only__, 3), __access__(__write_only__, 4))
+LIBSYSCALLS_GCC_ATTRIBUTES_(__access__(__write_only__, 3), __access__(__write_only__, 4), __access__(__write_only__, 5))
enum libsyscalls_error
-libsyscalls_get_signals(enum libsyscalls_os, enum libsyscalls_arch, const struct libsyscalls_named_number **, size_t *);
+libsyscalls_get_signals(enum libsyscalls_os, enum libsyscalls_arch, const struct libsyscalls_named_number **, size_t *, int *);
/**
* Get system call information tweak for the arguments passed
diff --git a/libsyscalls_get_signals.c b/libsyscalls_get_signals.c
index 9c49760..5157457 100644
--- a/libsyscalls_get_signals.c
+++ b/libsyscalls_get_signals.c
@@ -6,17 +6,20 @@
enum libsyscalls_error
libsyscalls_get_signals(enum libsyscalls_os os, enum libsyscalls_arch arch,
- const struct libsyscalls_named_number **signals_out, size_t *num_signals_out)
+ const struct libsyscalls_named_number **signals_out,
+ size_t *num_signals_out, int *are_signed_out)
{
const struct libsyscalls_named_number *discard_signals;
size_t discard_num_signals;
+ int discard_are_signed;
if (!signals_out) signals_out = &discard_signals;
if (!num_signals_out) num_signals_out = &discard_num_signals;
+ if (!are_signed_out) are_signed_out = &discard_are_signed;
#define CASE(UPPERCASE, LOWERCASE)\
case LIBSYSCALLS_OS_##UPPERCASE:\
- return get_##LOWERCASE##_signals(arch, signals_out, num_signals_out)
+ return get_##LOWERCASE##_signals(arch, signals_out, num_signals_out, are_signed_out)
switch ((int)os) {
LIST_OSES(CASE, ;);
diff --git a/libsyscalls_get_syscall_display_info.c b/libsyscalls_get_syscall_display_info.c
index 60bbe8a..add65e2 100644
--- a/libsyscalls_get_syscall_display_info.c
+++ b/libsyscalls_get_syscall_display_info.c
@@ -166,14 +166,14 @@ interpol_search_unsigned_named_number(unsigned long long int key, const struct l
static const char *
-extract_signal(enum libsyscalls_os os, enum libsyscalls_arch arch,
- unsigned long long int *valuep, char *fallback_out, int is_signed)
+extract_signal(enum libsyscalls_os os, enum libsyscalls_arch arch, unsigned long long int *valuep, char *fallback_out)
{
const struct libsyscalls_named_number *signals, *found;
size_t nsignals;
struct libsyscalls_named_number key = {.number.u = *valuep};
+ int is_signed;
- if (libsyscalls_get_signals(os, arch, &signals, &nsignals))
+ if (libsyscalls_get_signals(os, arch, &signals, &nsignals, &is_signed))
return NULL;
#ifndef USE_INTERPOLATION_SEARCH
diff --git a/libsyscalls_get_syscall_errors.c b/libsyscalls_get_syscall_errors.c
index 1af1589..9ec7e05 100644
--- a/libsyscalls_get_syscall_errors.c
+++ b/libsyscalls_get_syscall_errors.c
@@ -6,17 +6,20 @@
enum libsyscalls_error
libsyscalls_get_syscall_errors(enum libsyscalls_os os, enum libsyscalls_arch arch,
- const struct libsyscalls_named_number **errors_out, size_t *num_errors_out)
+ const struct libsyscalls_named_number **errors_out,
+ size_t *num_errors_out, int *are_signed_out)
{
const struct libsyscalls_named_number *discard_errors;
size_t discard_num_errors;
+ int discard_are_signed;
if (!errors_out) errors_out = &discard_errors;
if (!num_errors_out) num_errors_out = &discard_num_errors;
+ if (!are_signed_out) are_signed_out = &discard_are_signed;
#define CASE(UPPERCASE, LOWERCASE)\
case LIBSYSCALLS_OS_##UPPERCASE:\
- return get_##LOWERCASE##_syscall_errors(arch, errors_out, num_errors_out)
+ return get_##LOWERCASE##_syscall_errors(arch, errors_out, num_errors_out, are_signed_out)
switch ((int)os) {
LIST_OSES(CASE, ;);
diff --git a/linux/errors.c b/linux/errors.c
index 0b1c2ea..105d343 100644
--- a/linux/errors.c
+++ b/linux/errors.c
@@ -6,7 +6,8 @@
#include "../generated/linux-errors.h"
static enum libsyscalls_error
-get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_named_number **errs_out, size_t *nerrs_out)
+get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_named_number **errs_out,
+ size_t *nerrs_out, int *are_signed_out)
{
#define CASE(ARCH)\
*errs_out = linux_errors_for_##ARCH;\
@@ -139,6 +140,7 @@ get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_na
*nerrs_out = ELEMSOF(linux_errors_for_generic);
out:
+ *are_signed_out = 0;
return LIBSYSCALLS_E_OK;
#undef CASE
diff --git a/linux/signals.c b/linux/signals.c
index 7adc44c..9b9dbe7 100644
--- a/linux/signals.c
+++ b/linux/signals.c
@@ -6,7 +6,8 @@
#include "../generated/linux-signals.h"
static enum libsyscalls_error
-get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_number **sigs_out, size_t *nsigs_out)
+get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_number **sigs_out,
+ size_t *nsigs_out, int *are_signed_out)
{
#define CASE(ARCH)\
*sigs_out = linux_signals_for_##ARCH;\
@@ -139,6 +140,7 @@ get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_num
*nsigs_out = ELEMSOF(linux_signals_for_generic);
out:
+ *are_signed_out = 0;
return LIBSYSCALLS_E_OK;
#undef CASE
diff --git a/linux/symbols.c b/linux/symbols.c
index ac90b80..cbfb661 100644
--- a/linux/symbols.c
+++ b/linux/symbols.c
@@ -27,8 +27,7 @@
static const char *
extract_linux_symbol_signal(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out)
{
- return extract_signal(LIBSYSCALLS_OS_LINUX, data->arch, valuep, fallback_out,
- 0 /* doesn't matter, unsigned is probably faster */);
+ return extract_signal(LIBSYSCALLS_OS_LINUX, data->arch, valuep, fallback_out);
}
diff --git a/testcases/errors-LINUX-AMD64 b/testcases/errors-LINUX-AMD64
index c48ca78..7a637e1 100644
--- a/testcases/errors-LINUX-AMD64
+++ b/testcases/errors-LINUX-AMD64
@@ -1,150 +1,150 @@
-1 1 EPERM
-2 2 ENOENT
-3 3 ESRCH
-4 4 EINTR
-5 5 EIO
-6 6 ENXIO
-7 7 E2BIG
-8 8 ENOEXEC
-9 9 EBADF
-10 10 ECHILD
-11 11 EAGAIN
-12 12 ENOMEM
-13 13 EACCES
-14 14 EFAULT
-15 15 ENOTBLK
-16 16 EBUSY
-17 17 EEXIST
-18 18 EXDEV
-19 19 ENODEV
-20 20 ENOTDIR
-21 21 EISDIR
-22 22 EINVAL
-23 23 ENFILE
-24 24 EMFILE
-25 25 ENOTTY
-26 26 ETXTBSY
-27 27 EFBIG
-28 28 ENOSPC
-29 29 ESPIPE
-30 30 EROFS
-31 31 EMLINK
-32 32 EPIPE
-33 33 EDOM
-34 34 ERANGE
-35 35 EDEADLK
-36 36 ENAMETOOLONG
-37 37 ENOLCK
-38 38 ENOSYS
-39 39 ENOTEMPTY
-40 40 ELOOP
-42 42 ENOMSG
-43 43 EIDRM
-44 44 ECHRNG
-45 45 EL2NSYNC
-46 46 EL3HLT
-47 47 EL3RST
-48 48 ELNRNG
-49 49 EUNATCH
-50 50 ENOCSI
-51 51 EL2HLT
-52 52 EBADE
-53 53 EBADR
-54 54 EXFULL
-55 55 ENOANO
-56 56 EBADRQC
-57 57 EBADSLT
-59 59 EBFONT
-60 60 ENOSTR
-61 61 ENODATA
-62 62 ETIME
-63 63 ENOSR
-64 64 ENONET
-65 65 ENOPKG
-66 66 EREMOTE
-67 67 ENOLINK
-68 68 EADV
-69 69 ESRMNT
-70 70 ECOMM
-71 71 EPROTO
-72 72 EMULTIHOP
-73 73 EDOTDOT
-74 74 EBADMSG
-75 75 EOVERFLOW
-76 76 ENOTUNIQ
-77 77 EBADFD
-78 78 EREMCHG
-79 79 ELIBACC
-80 80 ELIBBAD
-81 81 ELIBSCN
-82 82 ELIBMAX
-83 83 ELIBEXEC
-84 84 EILSEQ
-85 85 ERESTART
-86 86 ESTRPIPE
-87 87 EUSERS
-88 88 ENOTSOCK
-89 89 EDESTADDRREQ
-90 90 EMSGSIZE
-91 91 EPROTOTYPE
-92 92 ENOPROTOOPT
-93 93 EPROTONOSUPPORT
-94 94 ESOCKTNOSUPPORT
-95 95 EOPNOTSUPP
-96 96 EPFNOSUPPORT
-97 97 EAFNOSUPPORT
-98 98 EADDRINUSE
-99 99 EADDRNOTAVAIL
-100 100 ENETDOWN
-101 101 ENETUNREACH
-102 102 ENETRESET
-103 103 ECONNABORTED
-104 104 ECONNRESET
-105 105 ENOBUFS
-106 106 EISCONN
-107 107 ENOTCONN
-108 108 ESHUTDOWN
-109 109 ETOOMANYREFS
-110 110 ETIMEDOUT
-111 111 ECONNREFUSED
-112 112 EHOSTDOWN
-113 113 EHOSTUNREACH
-114 114 EALREADY
-115 115 EINPROGRESS
-116 116 ESTALE
-117 117 EUCLEAN
-118 118 ENOTNAM
-119 119 ENAVAIL
-120 120 EISNAM
-121 121 EREMOTEIO
-122 122 EDQUOT
-123 123 ENOMEDIUM
-124 124 EMEDIUMTYPE
-125 125 ECANCELED
-126 126 ENOKEY
-127 127 EKEYEXPIRED
-128 128 EKEYREVOKED
-129 129 EKEYREJECTED
-130 130 EOWNERDEAD
-131 131 ENOTRECOVERABLE
-132 132 ERFKILL
-133 133 EHWPOISON
-512 512 ERESTARTSYS
-513 513 ERESTARTNOINTR
-514 514 ERESTARTNOHAND
-515 515 ENOIOCTLCMD
-516 516 ERESTART_RESTARTBLOCK
-517 517 EPROBE_DEFER
-518 518 EOPENSTALE
-519 519 ENOPARAM
-521 521 EBADHANDLE
-522 522 ENOTSYNC
-523 523 EBADCOOKIE
-524 524 ENOTSUPP
-525 525 ETOOSMALL
-526 526 ESERVERFAULT
-527 527 EBADTYPE
-528 528 EJUKEBOX
-529 529 EIOCBQUEUED
-530 530 ERECALLCONFLICT
-531 531 ENOGRACE
+1 EPERM
+2 ENOENT
+3 ESRCH
+4 EINTR
+5 EIO
+6 ENXIO
+7 E2BIG
+8 ENOEXEC
+9 EBADF
+10 ECHILD
+11 EAGAIN
+12 ENOMEM
+13 EACCES
+14 EFAULT
+15 ENOTBLK
+16 EBUSY
+17 EEXIST
+18 EXDEV
+19 ENODEV
+20 ENOTDIR
+21 EISDIR
+22 EINVAL
+23 ENFILE
+24 EMFILE
+25 ENOTTY
+26 ETXTBSY
+27 EFBIG
+28 ENOSPC
+29 ESPIPE
+30 EROFS
+31 EMLINK
+32 EPIPE
+33 EDOM
+34 ERANGE
+35 EDEADLK
+36 ENAMETOOLONG
+37 ENOLCK
+38 ENOSYS
+39 ENOTEMPTY
+40 ELOOP
+42 ENOMSG
+43 EIDRM
+44 ECHRNG
+45 EL2NSYNC
+46 EL3HLT
+47 EL3RST
+48 ELNRNG
+49 EUNATCH
+50 ENOCSI
+51 EL2HLT
+52 EBADE
+53 EBADR
+54 EXFULL
+55 ENOANO
+56 EBADRQC
+57 EBADSLT
+59 EBFONT
+60 ENOSTR
+61 ENODATA
+62 ETIME
+63 ENOSR
+64 ENONET
+65 ENOPKG
+66 EREMOTE
+67 ENOLINK
+68 EADV
+69 ESRMNT
+70 ECOMM
+71 EPROTO
+72 EMULTIHOP
+73 EDOTDOT
+74 EBADMSG
+75 EOVERFLOW
+76 ENOTUNIQ
+77 EBADFD
+78 EREMCHG
+79 ELIBACC
+80 ELIBBAD
+81 ELIBSCN
+82 ELIBMAX
+83 ELIBEXEC
+84 EILSEQ
+85 ERESTART
+86 ESTRPIPE
+87 EUSERS
+88 ENOTSOCK
+89 EDESTADDRREQ
+90 EMSGSIZE
+91 EPROTOTYPE
+92 ENOPROTOOPT
+93 EPROTONOSUPPORT
+94 ESOCKTNOSUPPORT
+95 EOPNOTSUPP
+96 EPFNOSUPPORT
+97 EAFNOSUPPORT
+98 EADDRINUSE
+99 EADDRNOTAVAIL
+100 ENETDOWN
+101 ENETUNREACH
+102 ENETRESET
+103 ECONNABORTED
+104 ECONNRESET
+105 ENOBUFS
+106 EISCONN
+107 ENOTCONN
+108 ESHUTDOWN
+109 ETOOMANYREFS
+110 ETIMEDOUT
+111 ECONNREFUSED
+112 EHOSTDOWN
+113 EHOSTUNREACH
+114 EALREADY
+115 EINPROGRESS
+116 ESTALE
+117 EUCLEAN
+118 ENOTNAM
+119 ENAVAIL
+120 EISNAM
+121 EREMOTEIO
+122 EDQUOT
+123 ENOMEDIUM
+124 EMEDIUMTYPE
+125 ECANCELED
+126 ENOKEY
+127 EKEYEXPIRED
+128 EKEYREVOKED
+129 EKEYREJECTED
+130 EOWNERDEAD
+131 ENOTRECOVERABLE
+132 ERFKILL
+133 EHWPOISON
+512 ERESTARTSYS
+513 ERESTARTNOINTR
+514 ERESTARTNOHAND
+515 ENOIOCTLCMD
+516 ERESTART_RESTARTBLOCK
+517 EPROBE_DEFER
+518 EOPENSTALE
+519 ENOPARAM
+521 EBADHANDLE
+522 ENOTSYNC
+523 EBADCOOKIE
+524 ENOTSUPP
+525 ETOOSMALL
+526 ESERVERFAULT
+527 EBADTYPE
+528 EJUKEBOX
+529 EIOCBQUEUED
+530 ERECALLCONFLICT
+531 ENOGRACE
diff --git a/testcases/errors-LINUX-PARISC_32 b/testcases/errors-LINUX-PARISC_32
index eda7276..09816db 100644
--- a/testcases/errors-LINUX-PARISC_32
+++ b/testcases/errors-LINUX-PARISC_32
@@ -1,152 +1,152 @@
-1 1 EPERM
-2 2 ENOENT
-3 3 ESRCH
-4 4 EINTR
-5 5 EIO
-6 6 ENXIO
-7 7 E2BIG
-8 8 ENOEXEC
-9 9 EBADF
-10 10 ECHILD
-11 11 EAGAIN
-12 12 ENOMEM
-13 13 EACCES
-14 14 EFAULT
-15 15 ENOTBLK
-16 16 EBUSY
-17 17 EEXIST
-18 18 EXDEV
-19 19 ENODEV
-20 20 ENOTDIR
-21 21 EISDIR
-22 22 EINVAL
-23 23 ENFILE
-24 24 EMFILE
-25 25 ENOTTY
-26 26 ETXTBSY
-27 27 EFBIG
-28 28 ENOSPC
-29 29 ESPIPE
-30 30 EROFS
-31 31 EMLINK
-32 32 EPIPE
-33 33 EDOM
-34 34 ERANGE
-35 35 ENOMSG
-36 36 EIDRM
-37 37 ECHRNG
-38 38 EL2NSYNC
-39 39 EL3HLT
-40 40 EL3RST
-41 41 ELNRNG
-42 42 EUNATCH
-43 43 ENOCSI
-44 44 EL2HLT
-45 45 EDEADLK
-46 46 ENOLCK
-47 47 EILSEQ
-50 50 ENONET
-51 51 ENODATA
-52 52 ETIME
-53 53 ENOSR
-54 54 ENOSTR
-55 55 ENOPKG
-57 57 ENOLINK
-58 58 EADV
-59 59 ESRMNT
-60 60 ECOMM
-61 61 EPROTO
-64 64 EMULTIHOP
-66 66 EDOTDOT
-67 67 EBADMSG
-68 68 EUSERS
-69 69 EDQUOT
-70 70 ESTALE
-71 71 EREMOTE
-72 72 EOVERFLOW
-160 160 EBADE
-161 161 EBADR
-162 162 EXFULL
-163 163 ENOANO
-164 164 EBADRQC
-165 165 EBADSLT
-166 166 EBFONT
-167 167 ENOTUNIQ
-168 168 EBADFD
-169 169 EREMCHG
-170 170 ELIBACC
-171 171 ELIBBAD
-172 172 ELIBSCN
-173 173 ELIBMAX
-174 174 ELIBEXEC
-175 175 ERESTART
-176 176 ESTRPIPE
-177 177 EUCLEAN
-178 178 ENOTNAM
-179 179 ENAVAIL
-180 180 EISNAM
-181 181 EREMOTEIO
-182 182 ENOMEDIUM
-183 183 EMEDIUMTYPE
-184 184 ENOKEY
-185 185 EKEYEXPIRED
-186 186 EKEYREVOKED
-187 187 EKEYREJECTED
-215 215 ENOSYM
-216 216 ENOTSOCK
-217 217 EDESTADDRREQ
-218 218 EMSGSIZE
-219 219 EPROTOTYPE
-220 220 ENOPROTOOPT
-221 221 EPROTONOSUPPORT
-222 222 ESOCKTNOSUPPORT
-223 223 EOPNOTSUPP
-224 224 EPFNOSUPPORT
-225 225 EAFNOSUPPORT
-226 226 EADDRINUSE
-227 227 EADDRNOTAVAIL
-228 228 ENETDOWN
-229 229 ENETUNREACH
-230 230 ENETRESET
-231 231 ECONNABORTED
-232 232 ECONNRESET
-233 233 ENOBUFS
-234 234 EISCONN
-235 235 ENOTCONN
-236 236 ESHUTDOWN
-237 237 ETOOMANYREFS
-238 238 ETIMEDOUT
-239 239 ECONNREFUSED
-240 240 EREMOTERELEASE
-241 241 EHOSTDOWN
-242 242 EHOSTUNREACH
-244 244 EALREADY
-245 245 EINPROGRESS
-247 247 ENOTEMPTY
-248 248 ENAMETOOLONG
-249 249 ELOOP
-251 251 ENOSYS
-253 253 ECANCELLED
-254 254 EOWNERDEAD
-255 255 ENOTRECOVERABLE
-256 256 ERFKILL
-257 257 EHWPOISON
-512 512 ERESTARTSYS
-513 513 ERESTARTNOINTR
-514 514 ERESTARTNOHAND
-515 515 ENOIOCTLCMD
-516 516 ERESTART_RESTARTBLOCK
-517 517 EPROBE_DEFER
-518 518 EOPENSTALE
-519 519 ENOPARAM
-521 521 EBADHANDLE
-522 522 ENOTSYNC
-523 523 EBADCOOKIE
-524 524 ENOTSUPP
-525 525 ETOOSMALL
-526 526 ESERVERFAULT
-527 527 EBADTYPE
-528 528 EJUKEBOX
-529 529 EIOCBQUEUED
-530 530 ERECALLCONFLICT
-531 531 ENOGRACE
+1 EPERM
+2 ENOENT
+3 ESRCH
+4 EINTR
+5 EIO
+6 ENXIO
+7 E2BIG
+8 ENOEXEC
+9 EBADF
+10 ECHILD
+11 EAGAIN
+12 ENOMEM
+13 EACCES
+14 EFAULT
+15 ENOTBLK
+16 EBUSY
+17 EEXIST
+18 EXDEV
+19 ENODEV
+20 ENOTDIR
+21 EISDIR
+22 EINVAL
+23 ENFILE
+24 EMFILE
+25 ENOTTY
+26 ETXTBSY
+27 EFBIG
+28 ENOSPC
+29 ESPIPE
+30 EROFS
+31 EMLINK
+32 EPIPE
+33 EDOM
+34 ERANGE
+35 ENOMSG
+36 EIDRM
+37 ECHRNG
+38 EL2NSYNC
+39 EL3HLT
+40 EL3RST
+41 ELNRNG
+42 EUNATCH
+43 ENOCSI
+44 EL2HLT
+45 EDEADLK
+46 ENOLCK
+47 EILSEQ
+50 ENONET
+51 ENODATA
+52 ETIME
+53 ENOSR
+54 ENOSTR
+55 ENOPKG
+57 ENOLINK
+58 EADV
+59 ESRMNT
+60 ECOMM
+61 EPROTO
+64 EMULTIHOP
+66 EDOTDOT
+67 EBADMSG
+68 EUSERS
+69 EDQUOT
+70 ESTALE
+71 EREMOTE
+72 EOVERFLOW
+160 EBADE
+161 EBADR
+162 EXFULL
+163 ENOANO
+164 EBADRQC
+165 EBADSLT
+166 EBFONT
+167 ENOTUNIQ
+168 EBADFD
+169 EREMCHG
+170 ELIBACC
+171 ELIBBAD
+172 ELIBSCN
+173 ELIBMAX
+174 ELIBEXEC
+175 ERESTART
+176 ESTRPIPE
+177 EUCLEAN
+178 ENOTNAM
+179 ENAVAIL
+180 EISNAM
+181 EREMOTEIO
+182 ENOMEDIUM
+183 EMEDIUMTYPE
+184 ENOKEY
+185 EKEYEXPIRED
+186 EKEYREVOKED
+187 EKEYREJECTED
+215 ENOSYM
+216 ENOTSOCK
+217 EDESTADDRREQ
+218 EMSGSIZE
+219 EPROTOTYPE
+220 ENOPROTOOPT
+221 EPROTONOSUPPORT
+222 ESOCKTNOSUPPORT
+223 EOPNOTSUPP
+224 EPFNOSUPPORT
+225 EAFNOSUPPORT
+226 EADDRINUSE
+227 EADDRNOTAVAIL
+228 ENETDOWN
+229 ENETUNREACH
+230 ENETRESET
+231 ECONNABORTED
+232 ECONNRESET
+233 ENOBUFS
+234 EISCONN
+235 ENOTCONN
+236 ESHUTDOWN
+237 ETOOMANYREFS
+238 ETIMEDOUT
+239 ECONNREFUSED
+240 EREMOTERELEASE
+241 EHOSTDOWN
+242 EHOSTUNREACH
+244 EALREADY
+245 EINPROGRESS
+247 ENOTEMPTY
+248 ENAMETOOLONG
+249 ELOOP
+251 ENOSYS
+253 ECANCELLED
+254 EOWNERDEAD
+255 ENOTRECOVERABLE
+256 ERFKILL
+257 EHWPOISON
+512 ERESTARTSYS
+513 ERESTARTNOINTR
+514 ERESTARTNOHAND
+515 ENOIOCTLCMD
+516 ERESTART_RESTARTBLOCK
+517 EPROBE_DEFER
+518 EOPENSTALE
+519 ENOPARAM
+521 EBADHANDLE
+522 ENOTSYNC
+523 EBADCOOKIE
+524 ENOTSUPP
+525 ETOOSMALL
+526 ESERVERFAULT
+527 EBADTYPE
+528 EJUKEBOX
+529 EIOCBQUEUED
+530 ERECALLCONFLICT
+531 ENOGRACE
diff --git a/testcases/signals-LINUX-AMD64 b/testcases/signals-LINUX-AMD64
index 4bc3c5d..a972e91 100644
--- a/testcases/signals-LINUX-AMD64
+++ b/testcases/signals-LINUX-AMD64
@@ -1,64 +1,64 @@
-1 1 SIGHUP
-2 2 SIGINT
-3 3 SIGQUIT
-4 4 SIGILL
-5 5 SIGTRAP
-6 6 SIGABRT
-7 7 SIGBUS
-8 8 SIGFPE
-9 9 SIGKILL
-10 10 SIGUSR1
-11 11 SIGSEGV
-12 12 SIGUSR2
-13 13 SIGPIPE
-14 14 SIGALRM
-15 15 SIGTERM
-16 16 SIGSTKFLT
-17 17 SIGCHLD
-18 18 SIGCONT
-19 19 SIGSTOP
-20 20 SIGTSTP
-21 21 SIGTTIN
-22 22 SIGTTOU
-23 23 SIGURG
-24 24 SIGXCPU
-25 25 SIGXFSZ
-26 26 SIGVTALRM
-27 27 SIGPROF
-28 28 SIGWINCH
-29 29 SIGIO
-30 30 SIGPWR
-31 31 SIGSYS
-32 32 _SIGRTMIN
-33 33 _SIGRTMIN+1
-34 34 _SIGRTMIN+2
-35 35 _SIGRTMIN+3
-36 36 _SIGRTMIN+4
-37 37 _SIGRTMIN+5
-38 38 _SIGRTMIN+6
-39 39 _SIGRTMIN+7
-40 40 _SIGRTMIN+8
-41 41 _SIGRTMIN+9
-42 42 _SIGRTMIN+10
-43 43 _SIGRTMIN+11
-44 44 _SIGRTMIN+12
-45 45 _SIGRTMIN+13
-46 46 _SIGRTMIN+14
-47 47 _SIGRTMIN+15
-48 48 _SIGRTMIN+16
-49 49 _SIGRTMIN+17
-50 50 _SIGRTMIN+18
-51 51 _SIGRTMIN+19
-52 52 _SIGRTMIN+20
-53 53 _SIGRTMIN+21
-54 54 _SIGRTMIN+22
-55 55 _SIGRTMIN+23
-56 56 _SIGRTMIN+24
-57 57 _SIGRTMIN+25
-58 58 _SIGRTMIN+26
-59 59 _SIGRTMIN+27
-60 60 _SIGRTMIN+28
-61 61 _SIGRTMIN+29
-62 62 _SIGRTMIN+30
-63 63 _SIGRTMIN+31
-64 64 _SIGRTMIN+32
+1 SIGHUP
+2 SIGINT
+3 SIGQUIT
+4 SIGILL
+5 SIGTRAP
+6 SIGABRT
+7 SIGBUS
+8 SIGFPE
+9 SIGKILL
+10 SIGUSR1
+11 SIGSEGV
+12 SIGUSR2
+13 SIGPIPE
+14 SIGALRM
+15 SIGTERM
+16 SIGSTKFLT
+17 SIGCHLD
+18 SIGCONT
+19 SIGSTOP
+20 SIGTSTP
+21 SIGTTIN
+22 SIGTTOU
+23 SIGURG
+24 SIGXCPU
+25 SIGXFSZ
+26 SIGVTALRM
+27 SIGPROF
+28 SIGWINCH
+29 SIGIO
+30 SIGPWR
+31 SIGSYS
+32 _SIGRTMIN
+33 _SIGRTMIN+1
+34 _SIGRTMIN+2
+35 _SIGRTMIN+3
+36 _SIGRTMIN+4
+37 _SIGRTMIN+5
+38 _SIGRTMIN+6
+39 _SIGRTMIN+7
+40 _SIGRTMIN+8
+41 _SIGRTMIN+9
+42 _SIGRTMIN+10
+43 _SIGRTMIN+11
+44 _SIGRTMIN+12
+45 _SIGRTMIN+13
+46 _SIGRTMIN+14
+47 _SIGRTMIN+15
+48 _SIGRTMIN+16
+49 _SIGRTMIN+17
+50 _SIGRTMIN+18
+51 _SIGRTMIN+19
+52 _SIGRTMIN+20
+53 _SIGRTMIN+21
+54 _SIGRTMIN+22
+55 _SIGRTMIN+23
+56 _SIGRTMIN+24
+57 _SIGRTMIN+25
+58 _SIGRTMIN+26
+59 _SIGRTMIN+27
+60 _SIGRTMIN+28
+61 _SIGRTMIN+29
+62 _SIGRTMIN+30
+63 _SIGRTMIN+31
+64 _SIGRTMIN+32
diff --git a/tests/signals b/tests/signals
index 733baa4..f2fdb80 100644
--- a/tests/signals
+++ b/tests/signals
@@ -8,21 +8,17 @@ for os in $(getnamelist OS); do
get-signals.tu $osn $archn $os $arch > $a
if issupported $os $arch; then
(! test "$(cat $a)" = x)
- grep -v '^[0-9]\{1,\} -' >/dev/null < $a
- grep -v '^-' < $a > $b
- grep '^\([0-9]\{1,\}\) \1 ' < $a | diff -u $a -
if test "$os" = LINUX; then
- signed=1
- grep '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_+]\{1,\}$' >/dev/null < $a
- test -z "$(grep -v '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_+]\{1,\}$' < $a)"
+ grep '^[0-9]\{1,\} [A-Z0-9_+]\{1,\}$' >/dev/null < $a
+ test -z "$(grep -v '^[0-9]\{1,\} [A-Z0-9_+]\{1,\}$' < $a)"
required="SIGKILL SIGTERM SIGCONT SIGSTOP SIGHUP _SIGRTMIN _SIGRTMIN+8"
else
continue;
fi
for req in $required; do
- grep '^-\{0,1\}[0-9]\{1,\} [0-9]\{1,\} '"$req"\$ >/dev/null < $a
+ grep '^[+-]\{0,1\}[0-9]\{1,\} '"$req"\$ >/dev/null < $a
done
- cut -d ' ' -f $(( 2 - signed )) < $a > $b && sort -n < $b | diff -u $b -
+ cut -d ' ' -f 1 < $a > $b && sort -n < $b | diff -u $b -
if test -f testcases/signals-$os-$arch; then
if ! diff -u testcases/signals-$os-$arch $a; then
printf '\033[33m%s\033[m\n' "Maybe new signals have been added for $os on $arch"
@@ -37,7 +33,6 @@ for os in $(getnamelist OS); do
fi
test -z "$(cut -d ' ' -f 1 < $a | sort | uniq -d)"
test -z "$(cut -d ' ' -f 2 < $a | sort | uniq -d)"
- test -z "$(cut -d ' ' -f 3 < $a | sort | uniq -d)"
done
done
test -f testcases/signals-LINUX-AMD64
diff --git a/tests/syscall-errors b/tests/syscall-errors
index 4608fe7..9e04f1f 100644
--- a/tests/syscall-errors
+++ b/tests/syscall-errors
@@ -8,21 +8,17 @@ for os in $(getnamelist OS); do
get-syscall-errors.tu $osn $archn $os $arch > $a
if issupported $os $arch; then
(! test "$(cat $a)" = x)
- grep -v '^[0-9]\{1,\} -' >/dev/null < $a
- grep -v '^-' < $a > $b
- grep '^\([0-9]\{1,\}\) \1 ' < $a | diff -u $a -
if test "$os" = LINUX; then
- signed=1
- grep '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_]\{1,\}$' >/dev/null < $a
- test -z "$(grep -v '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_]\{1,\}$' < $a)"
+ grep '^[0-9]\{1,\} [A-Z0-9_]\{1,\}$' >/dev/null < $a
+ test -z "$(grep -v '^[0-9]\{1,\} [A-Z0-9_]\{1,\}$' < $a)"
required="ERESTARTSYS ERESTARTNOINTR ERESTARTNOHAND ERESTART_RESTARTBLOCK EPERM ENOENT EDOM ELOOP"
else
continue;
fi
for req in $required; do
- grep '^-\{0,1\}[0-9]\{1,\} [0-9]\{1,\} '"$req"\$ >/dev/null < $a
+ grep '^[+-]\{0,1\}[0-9]\{1,\} '"$req"\$ >/dev/null < $a
done
- cut -d ' ' -f $(( 2 - signed )) < $a > $b && sort -n < $b | diff -u $b -
+ cut -d ' ' -f 1 < $a > $b && sort -n < $b | diff -u $b -
if test -f testcases/errors-$os-$arch; then
if ! diff -u testcases/errors-$os-$arch $a; then
printf '\033[33m%s\033[m\n' "Maybe new errors have been added for $os on $arch"
@@ -37,7 +33,6 @@ for os in $(getnamelist OS); do
fi
test -z "$(cut -d ' ' -f 1 < $a | sort | uniq -d)"
test -z "$(cut -d ' ' -f 2 < $a | sort | uniq -d)"
- test -z "$(cut -d ' ' -f 3 < $a | sort | uniq -d)"
done
done
test -f testcases/errors-LINUX-AMD64
diff --git a/testutil/get-signals.c b/testutil/get-signals.c
index f97484f..54fcac4 100644
--- a/testutil/get-signals.c
+++ b/testutil/get-signals.c
@@ -13,7 +13,7 @@
int
main(int argc, char **argv)
{
- int os, arch;
+ int os, arch, are_signed;
const struct libsyscalls_named_number *signals;
size_t i, nsignals;
enum libsyscalls_error err;
@@ -26,7 +26,8 @@ main(int argc, char **argv)
os = atoi(argv[1]);
arch = atoi(argv[2]);
- err = libsyscalls_get_signals((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, &signals, &nsignals);
+ err = libsyscalls_get_signals((enum libsyscalls_os)os, (enum libsyscalls_arch)arch,
+ &signals, &nsignals, &are_signed);
if (err == LIBSYSCALLS_E_OSNOSUP || err == LIBSYSCALLS_E_ARCHNOSUP) {
printf("x\n");
return 0;
@@ -38,8 +39,13 @@ main(int argc, char **argv)
return 1;
}
- for (i = 0; i < nsignals; i++)
- printf("%lli %llu %s\n", signals[i].number.s, signals[i].number.u, signals[i].name);
+ if (are_signed) {
+ for (i = 0; i < nsignals; i++)
+ printf("%+lli %s\n", signals[i].number.s, signals[i].name);
+ } else {
+ for (i = 0; i < nsignals; i++)
+ printf("%llu %s\n", signals[i].number.u, signals[i].name);
+ }
if (fflush(stdout) || fclose(stdout)) {
perror(NULL);
diff --git a/testutil/get-syscall-errors.c b/testutil/get-syscall-errors.c
index d1ddfd7..a5923f4 100644
--- a/testutil/get-syscall-errors.c
+++ b/testutil/get-syscall-errors.c
@@ -13,7 +13,7 @@
int
main(int argc, char **argv)
{
- int os, arch;
+ int os, arch, are_signed;
const struct libsyscalls_named_number *errors;
size_t i, nerrors;
enum libsyscalls_error err;
@@ -26,7 +26,8 @@ main(int argc, char **argv)
os = atoi(argv[1]);
arch = atoi(argv[2]);
- err = libsyscalls_get_syscall_errors((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, &errors, &nerrors);
+ err = libsyscalls_get_syscall_errors((enum libsyscalls_os)os, (enum libsyscalls_arch)arch,
+ &errors, &nerrors, &are_signed);
if (err == LIBSYSCALLS_E_OSNOSUP || err == LIBSYSCALLS_E_ARCHNOSUP) {
printf("x\n");
return 0;
@@ -38,8 +39,13 @@ main(int argc, char **argv)
return 1;
}
- for (i = 0; i < nerrors; i++)
- printf("%lli %llu %s\n", errors[i].number.s, errors[i].number.u, errors[i].name);
+ if (are_signed) {
+ for (i = 0; i < nerrors; i++)
+ printf("%+lli %s\n", errors[i].number.s, errors[i].name);
+ } else {
+ for (i = 0; i < nerrors; i++)
+ printf("%llu %s\n", errors[i].number.u, errors[i].name);
+ }
if (fflush(stdout) || fclose(stdout)) {
perror(NULL);