diff --git a/share/machdeps/machdep-schema.yaml b/share/machdeps/machdep-schema.yaml index 82beb3530ac7c4553ba260952756d753d6fd7894..3d8626026e8283545a6e869d0fbbd9745aa4eb3e 100644 --- a/share/machdeps/machdep-schema.yaml +++ b/share/machdeps/machdep-schema.yaml @@ -102,6 +102,22 @@ eof: type: string +errno: + + description: all error macros defined in errno.h + + type: list + + items: + + type: object + name: + description: macro name (lowercase) + type: string + value: + description: actual value + type: string + filename_max: description: value of 'FILENAME_MAX' macro diff --git a/share/machdeps/machdep_avr_16.yaml b/share/machdeps/machdep_avr_16.yaml index 76ce8188aeee8ccce1acd1ed5a85f16658272653..3f4ec114124259142e80c1d5bc8b2905aa874261 100644 --- a/share/machdeps/machdep_avr_16.yaml +++ b/share/machdeps/machdep_avr_16.yaml @@ -17,6 +17,127 @@ cpp_arch_flags: - avr - -m16 eof: (-1) +errno: + e2big: '7' + eacces: '13' + eaddrinuse: '98' + eaddrnotavail: '99' + eafnosupport: '97' + eagain: '11' + ealready: '114' + ebade: '52' + ebadf: '9' + ebadfd: '77' + ebadmsg: '74' + ebadr: '53' + ebadrqc: '56' + ebadslt: '57' + ebusy: '16' + ecanceled: '125' + echild: '10' + echrng: '44' + ecomm: '70' + econnaborted: '103' + econnrefused: '111' + econnreset: '104' + edeadlk: '35' + edeadlock: '35' + edestaddrreq: '89' + edom: '33' + edquot: '122' + eexist: '17' + efault: '14' + efbig: '27' + ehostdown: '112' + ehostunreach: '113' + eidrm: '43' + eilseq: '84' + einprogress: '115' + eintr: '4' + einval: '22' + eio: '5' + eisconn: '106' + eisdir: '21' + eisnam: '120' + ekeyexpired: '127' + ekeyrejected: '129' + ekeyrevoked: '128' + el2hlt: '51' + el2nsync: '45' + el3hlt: '46' + el3rst: '47' + elibacc: '79' + elibbad: '80' + elibexec: '83' + elibmax: '82' + elibscn: '81' + eloop: '40' + emediumtype: '124' + emfile: '24' + emlink: '31' + emsgsize: '90' + emultihop: '72' + enametoolong: '36' + enetdown: '100' + enetreset: '102' + enetunreach: '101' + enfile: '23' + enobufs: '105' + enodata: '61' + enodev: '19' + enoent: '2' + enoexec: '8' + enokey: '126' + enolck: '37' + enolink: '67' + enomedium: '123' + enomem: '12' + enomsg: '42' + enonet: '64' + enopkg: '65' + enoprotoopt: '92' + enospc: '28' + enosr: '63' + enostr: '60' + enosys: '38' + enotblk: '15' + enotconn: '107' + enotdir: '20' + enotempty: '39' + enotsock: '88' + enotsup: '95' + enotty: '25' + enotuniq: '76' + enxio: '6' + eopnotsupp: '95' + eoverflow: '75' + eperm: '1' + epfnosupport: '96' + epipe: '32' + eproto: '71' + eprotonosupport: '93' + eprototype: '91' + erange: '34' + eremchg: '78' + eremote: '66' + eremoteio: '121' + erestart: '85' + erofs: '30' + eshutdown: '108' + esocktnosupport: '94' + espipe: '29' + esrch: '3' + estale: '116' + estrpipe: '86' + etime: '62' + etimedout: '110' + etxtbsy: '26' + euclean: '117' + eunatch: '49' + eusers: '87' + ewouldblock: '11' + exdev: '18' + exfull: '54' filename_max: '4096' fopen_max: '16' has__builtin_va_list: true diff --git a/share/machdeps/machdep_gcc_x86_32.yaml b/share/machdeps/machdep_gcc_x86_32.yaml index 5992ccb712121282be7acb3626c9c8b4664ca241..be5520f7fd3a839c9e48dd785dd6554f8c366c18 100644 --- a/share/machdeps/machdep_gcc_x86_32.yaml +++ b/share/machdeps/machdep_gcc_x86_32.yaml @@ -15,6 +15,127 @@ compiler: gcc cpp_arch_flags: - -m32 eof: (-1) +errno: + e2big: '7' + eacces: '13' + eaddrinuse: '98' + eaddrnotavail: '99' + eafnosupport: '97' + eagain: '11' + ealready: '114' + ebade: '52' + ebadf: '9' + ebadfd: '77' + ebadmsg: '74' + ebadr: '53' + ebadrqc: '56' + ebadslt: '57' + ebusy: '16' + ecanceled: '125' + echild: '10' + echrng: '44' + ecomm: '70' + econnaborted: '103' + econnrefused: '111' + econnreset: '104' + edeadlk: '35' + edeadlock: '35' + edestaddrreq: '89' + edom: '33' + edquot: '122' + eexist: '17' + efault: '14' + efbig: '27' + ehostdown: '112' + ehostunreach: '113' + eidrm: '43' + eilseq: '84' + einprogress: '115' + eintr: '4' + einval: '22' + eio: '5' + eisconn: '106' + eisdir: '21' + eisnam: '120' + ekeyexpired: '127' + ekeyrejected: '129' + ekeyrevoked: '128' + el2hlt: '51' + el2nsync: '45' + el3hlt: '46' + el3rst: '47' + elibacc: '79' + elibbad: '80' + elibexec: '83' + elibmax: '82' + elibscn: '81' + eloop: '40' + emediumtype: '124' + emfile: '24' + emlink: '31' + emsgsize: '90' + emultihop: '72' + enametoolong: '36' + enetdown: '100' + enetreset: '102' + enetunreach: '101' + enfile: '23' + enobufs: '105' + enodata: '61' + enodev: '19' + enoent: '2' + enoexec: '8' + enokey: '126' + enolck: '37' + enolink: '67' + enomedium: '123' + enomem: '12' + enomsg: '42' + enonet: '64' + enopkg: '65' + enoprotoopt: '92' + enospc: '28' + enosr: '63' + enostr: '60' + enosys: '38' + enotblk: '15' + enotconn: '107' + enotdir: '20' + enotempty: '39' + enotsock: '88' + enotsup: '95' + enotty: '25' + enotuniq: '76' + enxio: '6' + eopnotsupp: '95' + eoverflow: '75' + eperm: '1' + epfnosupport: '96' + epipe: '32' + eproto: '71' + eprotonosupport: '93' + eprototype: '91' + erange: '34' + eremchg: '78' + eremote: '66' + eremoteio: '121' + erestart: '85' + erofs: '30' + eshutdown: '108' + esocktnosupport: '94' + espipe: '29' + esrch: '3' + estale: '116' + estrpipe: '86' + etime: '62' + etimedout: '110' + etxtbsy: '26' + euclean: '117' + eunatch: '49' + eusers: '87' + ewouldblock: '11' + exdev: '18' + exfull: '54' filename_max: '4096' fopen_max: '16' has__builtin_va_list: true diff --git a/share/machdeps/machdep_gcc_x86_64.yaml b/share/machdeps/machdep_gcc_x86_64.yaml index 2092ac09fb19e6901dce740ada25f0a729c35003..4e076e08a4d2e5906dd6e40e2ffefcc032dc1e3d 100644 --- a/share/machdeps/machdep_gcc_x86_64.yaml +++ b/share/machdeps/machdep_gcc_x86_64.yaml @@ -15,6 +15,127 @@ compiler: gcc cpp_arch_flags: - -m64 eof: (-1) +errno: + e2big: '7' + eacces: '13' + eaddrinuse: '98' + eaddrnotavail: '99' + eafnosupport: '97' + eagain: '11' + ealready: '114' + ebade: '52' + ebadf: '9' + ebadfd: '77' + ebadmsg: '74' + ebadr: '53' + ebadrqc: '56' + ebadslt: '57' + ebusy: '16' + ecanceled: '125' + echild: '10' + echrng: '44' + ecomm: '70' + econnaborted: '103' + econnrefused: '111' + econnreset: '104' + edeadlk: '35' + edeadlock: '35' + edestaddrreq: '89' + edom: '33' + edquot: '122' + eexist: '17' + efault: '14' + efbig: '27' + ehostdown: '112' + ehostunreach: '113' + eidrm: '43' + eilseq: '84' + einprogress: '115' + eintr: '4' + einval: '22' + eio: '5' + eisconn: '106' + eisdir: '21' + eisnam: '120' + ekeyexpired: '127' + ekeyrejected: '129' + ekeyrevoked: '128' + el2hlt: '51' + el2nsync: '45' + el3hlt: '46' + el3rst: '47' + elibacc: '79' + elibbad: '80' + elibexec: '83' + elibmax: '82' + elibscn: '81' + eloop: '40' + emediumtype: '124' + emfile: '24' + emlink: '31' + emsgsize: '90' + emultihop: '72' + enametoolong: '36' + enetdown: '100' + enetreset: '102' + enetunreach: '101' + enfile: '23' + enobufs: '105' + enodata: '61' + enodev: '19' + enoent: '2' + enoexec: '8' + enokey: '126' + enolck: '37' + enolink: '67' + enomedium: '123' + enomem: '12' + enomsg: '42' + enonet: '64' + enopkg: '65' + enoprotoopt: '92' + enospc: '28' + enosr: '63' + enostr: '60' + enosys: '38' + enotblk: '15' + enotconn: '107' + enotdir: '20' + enotempty: '39' + enotsock: '88' + enotsup: '95' + enotty: '25' + enotuniq: '76' + enxio: '6' + eopnotsupp: '95' + eoverflow: '75' + eperm: '1' + epfnosupport: '96' + epipe: '32' + eproto: '71' + eprotonosupport: '93' + eprototype: '91' + erange: '34' + eremchg: '78' + eremote: '66' + eremoteio: '121' + erestart: '85' + erofs: '30' + eshutdown: '108' + esocktnosupport: '94' + espipe: '29' + esrch: '3' + estale: '116' + estrpipe: '86' + etime: '62' + etimedout: '110' + etxtbsy: '26' + euclean: '117' + eunatch: '49' + eusers: '87' + ewouldblock: '11' + exdev: '18' + exfull: '54' filename_max: '4096' fopen_max: '16' has__builtin_va_list: true diff --git a/share/machdeps/machdep_ppc_32.yaml b/share/machdeps/machdep_ppc_32.yaml index fda90435289e8d7bb838481c032f7afa5c5cfb12..c5d951a413026c3ea134bd53197fff75933a6e39 100644 --- a/share/machdeps/machdep_ppc_32.yaml +++ b/share/machdeps/machdep_ppc_32.yaml @@ -17,6 +17,127 @@ cpp_arch_flags: - powerpc-apple-linux - -mcpu=603 eof: (-1) +errno: + e2big: '7' + eacces: '13' + eaddrinuse: '98' + eaddrnotavail: '99' + eafnosupport: '97' + eagain: '11' + ealready: '114' + ebade: '52' + ebadf: '9' + ebadfd: '77' + ebadmsg: '74' + ebadr: '53' + ebadrqc: '56' + ebadslt: '57' + ebusy: '16' + ecanceled: '125' + echild: '10' + echrng: '44' + ecomm: '70' + econnaborted: '103' + econnrefused: '111' + econnreset: '104' + edeadlk: '35' + edeadlock: '35' + edestaddrreq: '89' + edom: '33' + edquot: '122' + eexist: '17' + efault: '14' + efbig: '27' + ehostdown: '112' + ehostunreach: '113' + eidrm: '43' + eilseq: '84' + einprogress: '115' + eintr: '4' + einval: '22' + eio: '5' + eisconn: '106' + eisdir: '21' + eisnam: '120' + ekeyexpired: '127' + ekeyrejected: '129' + ekeyrevoked: '128' + el2hlt: '51' + el2nsync: '45' + el3hlt: '46' + el3rst: '47' + elibacc: '79' + elibbad: '80' + elibexec: '83' + elibmax: '82' + elibscn: '81' + eloop: '40' + emediumtype: '124' + emfile: '24' + emlink: '31' + emsgsize: '90' + emultihop: '72' + enametoolong: '36' + enetdown: '100' + enetreset: '102' + enetunreach: '101' + enfile: '23' + enobufs: '105' + enodata: '61' + enodev: '19' + enoent: '2' + enoexec: '8' + enokey: '126' + enolck: '37' + enolink: '67' + enomedium: '123' + enomem: '12' + enomsg: '42' + enonet: '64' + enopkg: '65' + enoprotoopt: '92' + enospc: '28' + enosr: '63' + enostr: '60' + enosys: '38' + enotblk: '15' + enotconn: '107' + enotdir: '20' + enotempty: '39' + enotsock: '88' + enotsup: '95' + enotty: '25' + enotuniq: '76' + enxio: '6' + eopnotsupp: '95' + eoverflow: '75' + eperm: '1' + epfnosupport: '96' + epipe: '32' + eproto: '71' + eprotonosupport: '93' + eprototype: '91' + erange: '34' + eremchg: '78' + eremote: '66' + eremoteio: '121' + erestart: '85' + erofs: '30' + eshutdown: '108' + esocktnosupport: '94' + espipe: '29' + esrch: '3' + estale: '116' + estrpipe: '86' + etime: '62' + etimedout: '110' + etxtbsy: '26' + euclean: '117' + eunatch: '49' + eusers: '87' + ewouldblock: '11' + exdev: '18' + exfull: '54' filename_max: '4096' fopen_max: '16' has__builtin_va_list: true diff --git a/share/machdeps/machdep_x86_32.yaml b/share/machdeps/machdep_x86_32.yaml index 41c794f237174ffdfec6f22193089f934d3a85c2..1ae9be5b6d86cd6ed93c0f4ced6c8639d2af9d70 100644 --- a/share/machdeps/machdep_x86_32.yaml +++ b/share/machdeps/machdep_x86_32.yaml @@ -15,6 +15,127 @@ compiler: generic cpp_arch_flags: - -m32 eof: (-1) +errno: + e2big: '7' + eacces: '13' + eaddrinuse: '98' + eaddrnotavail: '99' + eafnosupport: '97' + eagain: '11' + ealready: '114' + ebade: '52' + ebadf: '9' + ebadfd: '77' + ebadmsg: '74' + ebadr: '53' + ebadrqc: '56' + ebadslt: '57' + ebusy: '16' + ecanceled: '125' + echild: '10' + echrng: '44' + ecomm: '70' + econnaborted: '103' + econnrefused: '111' + econnreset: '104' + edeadlk: '35' + edeadlock: '35' + edestaddrreq: '89' + edom: '33' + edquot: '122' + eexist: '17' + efault: '14' + efbig: '27' + ehostdown: '112' + ehostunreach: '113' + eidrm: '43' + eilseq: '84' + einprogress: '115' + eintr: '4' + einval: '22' + eio: '5' + eisconn: '106' + eisdir: '21' + eisnam: '120' + ekeyexpired: '127' + ekeyrejected: '129' + ekeyrevoked: '128' + el2hlt: '51' + el2nsync: '45' + el3hlt: '46' + el3rst: '47' + elibacc: '79' + elibbad: '80' + elibexec: '83' + elibmax: '82' + elibscn: '81' + eloop: '40' + emediumtype: '124' + emfile: '24' + emlink: '31' + emsgsize: '90' + emultihop: '72' + enametoolong: '36' + enetdown: '100' + enetreset: '102' + enetunreach: '101' + enfile: '23' + enobufs: '105' + enodata: '61' + enodev: '19' + enoent: '2' + enoexec: '8' + enokey: '126' + enolck: '37' + enolink: '67' + enomedium: '123' + enomem: '12' + enomsg: '42' + enonet: '64' + enopkg: '65' + enoprotoopt: '92' + enospc: '28' + enosr: '63' + enostr: '60' + enosys: '38' + enotblk: '15' + enotconn: '107' + enotdir: '20' + enotempty: '39' + enotsock: '88' + enotsup: '95' + enotty: '25' + enotuniq: '76' + enxio: '6' + eopnotsupp: '95' + eoverflow: '75' + eperm: '1' + epfnosupport: '96' + epipe: '32' + eproto: '71' + eprotonosupport: '93' + eprototype: '91' + erange: '34' + eremchg: '78' + eremote: '66' + eremoteio: '121' + erestart: '85' + erofs: '30' + eshutdown: '108' + esocktnosupport: '94' + espipe: '29' + esrch: '3' + estale: '116' + estrpipe: '86' + etime: '62' + etimedout: '110' + etxtbsy: '26' + euclean: '117' + eunatch: '49' + eusers: '87' + ewouldblock: '11' + exdev: '18' + exfull: '54' filename_max: '4096' fopen_max: '16' has__builtin_va_list: true diff --git a/share/machdeps/machdep_x86_64.yaml b/share/machdeps/machdep_x86_64.yaml index 96d69bf96f1fabb5e11b30b9cee87087c3de3ed0..e0b2e7dd95cafd285e531185608adbe20a0aae71 100644 --- a/share/machdeps/machdep_x86_64.yaml +++ b/share/machdeps/machdep_x86_64.yaml @@ -15,6 +15,127 @@ compiler: generic cpp_arch_flags: - -m64 eof: (-1) +errno: + e2big: '7' + eacces: '13' + eaddrinuse: '98' + eaddrnotavail: '99' + eafnosupport: '97' + eagain: '11' + ealready: '114' + ebade: '52' + ebadf: '9' + ebadfd: '77' + ebadmsg: '74' + ebadr: '53' + ebadrqc: '56' + ebadslt: '57' + ebusy: '16' + ecanceled: '125' + echild: '10' + echrng: '44' + ecomm: '70' + econnaborted: '103' + econnrefused: '111' + econnreset: '104' + edeadlk: '35' + edeadlock: '35' + edestaddrreq: '89' + edom: '33' + edquot: '122' + eexist: '17' + efault: '14' + efbig: '27' + ehostdown: '112' + ehostunreach: '113' + eidrm: '43' + eilseq: '84' + einprogress: '115' + eintr: '4' + einval: '22' + eio: '5' + eisconn: '106' + eisdir: '21' + eisnam: '120' + ekeyexpired: '127' + ekeyrejected: '129' + ekeyrevoked: '128' + el2hlt: '51' + el2nsync: '45' + el3hlt: '46' + el3rst: '47' + elibacc: '79' + elibbad: '80' + elibexec: '83' + elibmax: '82' + elibscn: '81' + eloop: '40' + emediumtype: '124' + emfile: '24' + emlink: '31' + emsgsize: '90' + emultihop: '72' + enametoolong: '36' + enetdown: '100' + enetreset: '102' + enetunreach: '101' + enfile: '23' + enobufs: '105' + enodata: '61' + enodev: '19' + enoent: '2' + enoexec: '8' + enokey: '126' + enolck: '37' + enolink: '67' + enomedium: '123' + enomem: '12' + enomsg: '42' + enonet: '64' + enopkg: '65' + enoprotoopt: '92' + enospc: '28' + enosr: '63' + enostr: '60' + enosys: '38' + enotblk: '15' + enotconn: '107' + enotdir: '20' + enotempty: '39' + enotsock: '88' + enotsup: '95' + enotty: '25' + enotuniq: '76' + enxio: '6' + eopnotsupp: '95' + eoverflow: '75' + eperm: '1' + epfnosupport: '96' + epipe: '32' + eproto: '71' + eprotonosupport: '93' + eprototype: '91' + erange: '34' + eremchg: '78' + eremote: '66' + eremoteio: '121' + erestart: '85' + erofs: '30' + eshutdown: '108' + esocktnosupport: '94' + espipe: '29' + esrch: '3' + estale: '116' + estrpipe: '86' + etime: '62' + etimedout: '110' + etxtbsy: '26' + euclean: '117' + eunatch: '49' + eusers: '87' + ewouldblock: '11' + exdev: '18' + exfull: '54' filename_max: '4096' fopen_max: '16' has__builtin_va_list: true diff --git a/share/machdeps/make_machdep/errno.c b/share/machdeps/make_machdep/errno.c new file mode 100644 index 0000000000000000000000000000000000000000..ad0016ea9e5bd1b53378de4ff99a12d0f71281a5 --- /dev/null +++ b/share/machdeps/make_machdep/errno.c @@ -0,0 +1,359 @@ +#include <errno.h> + +/* Mandatory */ +int edom_is = EDOM; +int eilseq_is = EILSEQ; +int erange_is = ERANGE; + +/* Implementation defined by POSIX and GNU Linux */ +#ifdef E2BIG +int e2big_is = E2BIG; +#endif +#ifdef EACCES +int eacces_is = EACCES; +#endif +#ifdef EADDRINUSE +int eaddrinuse_is = EADDRINUSE; +#endif +#ifdef EADDRNOTAVAIL +int eaddrnotavail_is = EADDRNOTAVAIL; +#endif +#ifdef EAFNOSUPPORT +int eafnosupport_is = EAFNOSUPPORT; +#endif +#ifdef EAGAIN +int eagain_is = EAGAIN; +#endif +#ifdef EALREADY +int ealready_is = EALREADY; +#endif +#ifdef EBADE +int ebade_is = EBADE; +#endif +#ifdef EBADF +int ebadf_is = EBADF; +#endif +#ifdef EBADFD +int ebadfd_is = EBADFD; +#endif +#ifdef EBADMSG +int ebadmsg_is = EBADMSG; +#endif +#ifdef EBADR +int ebadr_is = EBADR; +#endif +#ifdef EBADRQC +int ebadrqc_is = EBADRQC; +#endif +#ifdef EBADSLT +int ebadslt_is = EBADSLT; +#endif +#ifdef EBUSY +int ebusy_is = EBUSY; +#endif +#ifdef ECANCELED +int ecanceled_is = ECANCELED; +#endif +#ifdef ECHILD +int echild_is = ECHILD; +#endif +#ifdef ECHRNG +int echrng_is = ECHRNG; +#endif +#ifdef ECOMM +int ecomm_is = ECOMM; +#endif +#ifdef ECONNABORTED +int econnaborted_is = ECONNABORTED; +#endif +#ifdef ECONNREFUSED +int econnrefused_is = ECONNREFUSED; +#endif +#ifdef ECONNRESET +int econnreset_is = ECONNRESET; +#endif +#ifdef EDEADLK +int edeadlk_is = EDEADLK; +#endif +#ifdef EDEADLOCK +int edeadlock_is = EDEADLOCK; +#endif +#ifdef EDESTADDRREQ +int edestaddrreq_is = EDESTADDRREQ; +#endif +#ifdef EDQUOT +int edquot_is = EDQUOT; +#endif +#ifdef EEXIST +int eexist_is = EEXIST; +#endif +#ifdef EFAULT +int efault_is = EFAULT; +#endif +#ifdef EFBIG +int efbig_is = EFBIG; +#endif +#ifdef EHOSTDOWN +int ehostdown_is = EHOSTDOWN; +#endif +#ifdef EHOSTUNREACH +int ehostunreach_is = EHOSTUNREACH; +#endif +#ifdef EIDRM +int eidrm_is = EIDRM; +#endif +#ifdef EINPROGRESS +int einprogress_is = EINPROGRESS; +#endif +#ifdef EINTR +int eintr_is = EINTR; +#endif +#ifdef EINVAL +int einval_is = EINVAL; +#endif +#ifdef EIO +int eio_is = EIO; +#endif +#ifdef EISCONN +int eisconn_is = EISCONN; +#endif +#ifdef EISDIR +int eisdir_is = EISDIR; +#endif +#ifdef EISNAM +int eisnam_is = EISNAM; +#endif +#ifdef EKEYEXPIRED +int ekeyexpired_is = EKEYEXPIRED; +#endif +#ifdef EKEYREJECTED +int ekeyrejected_is = EKEYREJECTED; +#endif +#ifdef EKEYREVOKED +int ekeyrevoked_is = EKEYREVOKED; +#endif +#ifdef EL2HLT +int el2hlt_is = EL2HLT; +#endif +#ifdef EL2NSYNC +int el2nsync_is = EL2NSYNC; +#endif +#ifdef EL3HLT +int el3hlt_is = EL3HLT; +#endif +#ifdef EL3RST +int el3rst_is = EL3RST; +#endif +#ifdef ELIBACC +int elibacc_is = ELIBACC; +#endif +#ifdef ELIBBAD +int elibbad_is = ELIBBAD; +#endif +#ifdef ELIBMAX +int elibmax_is = ELIBMAX; +#endif +#ifdef ELIBSCN +int elibscn_is = ELIBSCN; +#endif +#ifdef ELIBEXEC +int elibexec_is = ELIBEXEC; +#endif +#ifdef ELOOP +int eloop_is = ELOOP; +#endif +#ifdef EMEDIUMTYPE +int emediumtype_is = EMEDIUMTYPE; +#endif +#ifdef EMFILE +int emfile_is = EMFILE; +#endif +#ifdef EMLINK +int emlink_is = EMLINK; +#endif +#ifdef EMSGSIZE +int emsgsize_is = EMSGSIZE; +#endif +#ifdef EMULTIHOP +int emultihop_is = EMULTIHOP; +#endif +#ifdef ENAMETOOLONG +int enametoolong_is = ENAMETOOLONG; +#endif +#ifdef ENETDOWN +int enetdown_is = ENETDOWN; +#endif +#ifdef ENETRESET +int enetreset_is = ENETRESET; +#endif +#ifdef ENETUNREACH +int enetunreach_is = ENETUNREACH; +#endif +#ifdef ENFILE +int enfile_is = ENFILE; +#endif +#ifdef ENOBUFS +int enobufs_is = ENOBUFS; +#endif +#ifdef ENODATA +int enodata_is = ENODATA; +#endif +#ifdef ENODEV +int enodev_is = ENODEV; +#endif +#ifdef ENOENT +int enoent_is = ENOENT; +#endif +#ifdef ENOEXEC +int enoexec_is = ENOEXEC; +#endif +#ifdef ENOKEY +int enokey_is = ENOKEY; +#endif +#ifdef ENOLCK +int enolck_is = ENOLCK; +#endif +#ifdef ENOLINK +int enolink_is = ENOLINK; +#endif +#ifdef ENOMEDIUM +int enomedium_is = ENOMEDIUM; +#endif +#ifdef ENOMEM +int enomem_is = ENOMEM; +#endif +#ifdef ENOMSG +int enomsg_is = ENOMSG; +#endif +#ifdef ENONET +int enonet_is = ENONET; +#endif +#ifdef ENOPKG +int enopkg_is = ENOPKG; +#endif +#ifdef ENOPROTOOPT +int enoprotoopt_is = ENOPROTOOPT; +#endif +#ifdef ENOSPC +int enospc_is = ENOSPC; +#endif +#ifdef ENOSR +int enosr_is = ENOSR; +#endif +#ifdef ENOSTR +int enostr_is = ENOSTR; +#endif +#ifdef ENOSYS +int enosys_is = ENOSYS; +#endif +#ifdef ENOTBLK +int enotblk_is = ENOTBLK; +#endif +#ifdef ENOTCONN +int enotconn_is = ENOTCONN; +#endif +#ifdef ENOTDIR +int enotdir_is = ENOTDIR; +#endif +#ifdef ENOTEMPTY +int enotempty_is = ENOTEMPTY; +#endif +#ifdef ENOTSOCK +int enotsock_is = ENOTSOCK; +#endif +#ifdef ENOTSUP +int enotsup_is = ENOTSUP; +#endif +#ifdef ENOTTY +int enotty_is = ENOTTY; +#endif +#ifdef ENOTUNIQ +int enotuniq_is = ENOTUNIQ; +#endif +#ifdef ENXIO +int enxio_is = ENXIO; +#endif +#ifdef EOPNOTSUPP +int eopnotsupp_is = EOPNOTSUPP; +#endif +#ifdef EOVERFLOW +int eoverflow_is = EOVERFLOW; +#endif +#ifdef EPERM +int eperm_is = EPERM; +#endif +#ifdef EPFNOSUPPORT +int epfnosupport_is = EPFNOSUPPORT; +#endif +#ifdef EPIPE +int epipe_is = EPIPE; +#endif +#ifdef EPROTO +int eproto_is = EPROTO; +#endif +#ifdef EPROTONOSUPPORT +int eprotonosupport_is = EPROTONOSUPPORT; +#endif +#ifdef EPROTOTYPE +int eprototype_is = EPROTOTYPE; +#endif +#ifdef EREMCHG +int eremchg_is = EREMCHG; +#endif +#ifdef EREMOTE +int eremote_is = EREMOTE; +#endif +#ifdef EREMOTEIO +int eremoteio_is = EREMOTEIO; +#endif +#ifdef ERESTART +int erestart_is = ERESTART; +#endif +#ifdef EROFS +int erofs_is = EROFS; +#endif +#ifdef ESHUTDOWN +int eshutdown_is = ESHUTDOWN; +#endif +#ifdef ESPIPE +int espipe_is = ESPIPE; +#endif +#ifdef ESOCKTNOSUPPORT +int esocktnosupport_is = ESOCKTNOSUPPORT; +#endif +#ifdef ESRCH +int esrch_is = ESRCH; +#endif +#ifdef ESTALE +int estale_is = ESTALE; +#endif +#ifdef ESTRPIPE +int estrpipe_is = ESTRPIPE; +#endif +#ifdef ETIME +int etime_is = ETIME; +#endif +#ifdef ETIMEDOUT +int etimedout_is = ETIMEDOUT; +#endif +#ifdef ETXTBSY +int etxtbsy_is = ETXTBSY; +#endif +#ifdef EUCLEAN +int euclean_is = EUCLEAN; +#endif +#ifdef EUNATCH +int eunatch_is = EUNATCH; +#endif +#ifdef EUSERS +int eusers_is = EUSERS; +#endif +#ifdef EWOULDBLOCK +int ewouldblock_is = EWOULDBLOCK; +#endif +#ifdef EXDEV +int exdev_is = EXDEV; +#endif +#ifdef EXFULL +int exfull_is = EXFULL; +#endif diff --git a/share/machdeps/make_machdep/make_machdep.py b/share/machdeps/make_machdep/make_machdep.py index 55c62051b6e52745e0f5f67688e48f0814eee057..de474f0e2ea49ae1267ba8aa6e9c20a7baded287 100755 --- a/share/machdeps/make_machdep/make_machdep.py +++ b/share/machdeps/make_machdep/make_machdep.py @@ -138,7 +138,6 @@ def make_machdep(): machdep[key] = None return machdep - machdep = make_machdep() compilation_command = [args.compiler] + args.cpp_arch_flags + args.compiler_flags @@ -183,6 +182,7 @@ source_files = [ ("stdio_macros.c", "macro"), ("stdlib_macros.c", "macro"), ("nsig.c", "macro"), + ("errno.c", "macrolist"), ] @@ -231,17 +231,23 @@ def cleanup_cpp(output): return " ".join(macro) -def find_macros_value(output): +def find_macros_value(output,is_list=False,entry=None): msg = re.compile("(\w+)_is = ([^;]+);") + if is_list: + assert(entry) + machdep[entry] = {} for res in re.finditer(msg, output): name = res.group(1) - if name in machdep: - value = res.group(2).strip() - if args.verbose: - print(f"[INFO] setting {name} to {value}") - machdep[name] = value + value = res.group(2).strip() + if is_list: + machdep[entry][name] = value else: - warnings.warn(f"unexpected symbol '{name}', ignoring") + if name in machdep.keys(): + if args.verbose: + print(f"[INFO] setting {name} to {value}") + machdep[name] = value + else: + warnings.warn(f"unexpected symbol '{name}', ignoring") if args.verbose: print(f"compiler output is:{output}") @@ -249,7 +255,7 @@ def find_macros_value(output): for (f, typ) in source_files: p = my_path / f cmd = compilation_command + [str(p)] - if typ == "macro": + if typ == "macro" or typ == "macrolist": # We're just interested in expanding a macro, # treatment is a bit different than the rest. cmd = cmd + ["-E"] @@ -268,6 +274,17 @@ for (f, typ) in source_files: continue find_macros_value(cleanup_cpp(proc.stdout.decode())) continue + if typ == "macrolist": + name = p.stem + if proc.returncode != 0: + warnings.warn(f"error in preprocessing value '{p}', some value might not be filled") + if args.verbose: + print(f"compiler output is:{proc.stderr.decode()}") + if name in machdep: + machdep[name] = {} + continue + find_macros_value(cleanup_cpp(proc.stdout.decode()),is_list=True,entry=name) + continue if typ == "has__builtin_va_list": # Special case: compilation success determines presence or absence machdep["has__builtin_va_list"] = proc.returncode == 0 diff --git a/src/kernel_internals/runtime/machdep.ml b/src/kernel_internals/runtime/machdep.ml index c67516d799a069fffcf94cf5136201c7f8748792..8cde2d22f1321e042cc342948bd8abcd29170095 100644 --- a/src/kernel_internals/runtime/machdep.ml +++ b/src/kernel_internals/runtime/machdep.ml @@ -25,6 +25,9 @@ open Cil_types let gen_define fmt macro pp def = Format.fprintf fmt "#define %s %a@\n" macro pp def +let gen_include fmt file = + Format.fprintf fmt "#include <%s>@\n" file + let gen_undef fmt macro = Format.fprintf fmt "#undef %s@\n" macro let gen_define_string fmt macro def = @@ -248,7 +251,9 @@ let gen_all_defines fmt mach = (* TODO: __FC_E*, errno enumeration *) gen_define_macro fmt "__FC_TIME_T" mach.time_t; gen_define_macro fmt "__FC_NSIG" mach.nsig; - (* TODO: gcc builtins *) + (* NB: should we use Cil.gccMode() here? *) + if mach.compiler = "gcc" then + gen_include fmt "__fc_gcc_builtins.h"; Format.fprintf fmt "#endif // __FC_MACHDEP@\n" diff --git a/src/kernel_services/ast_data/cil_types.ml b/src/kernel_services/ast_data/cil_types.ml index 41556c96c9aba3d600cbeb2a8018a5c8e24a1db8..36c2d0cd2359eef15e75f3de6f191b44a81f084f 100644 --- a/src/kernel_services/ast_data/cil_types.ml +++ b/src/kernel_services/ast_data/cil_types.ml @@ -1915,7 +1915,7 @@ type mach = { rand_max: string; (* expansion of RAND_MAX macro *) mb_cur_max: string; (* expansion of MB_CUR_MAX macro *) nsig: string; (* expansion of non-standard NSIG macro, empty if undefined *) - + errno: (string * string) list; (* list of macros defining errors in errno.h*) } (* diff --git a/src/kernel_services/ast_queries/cil_datatype.ml b/src/kernel_services/ast_queries/cil_datatype.ml index b3342275ccfbe05f82c298f0ec07ca4e4b8152bd..8a146f1e941dd1d16c1c6592cb47924b2737ccd0 100644 --- a/src/kernel_services/ast_queries/cil_datatype.ml +++ b/src/kernel_services/ast_queries/cil_datatype.ml @@ -2677,6 +2677,11 @@ let dummy_machdep = rand_max = "0xFFFFFFFE"; mb_cur_max = "16"; nsig = ""; + errno = [ + "edom", "33"; + "eilseq", "84"; + "erange", "34"; + ]; } module Machdep = Datatype.Make_with_collections(struct diff --git a/tests/misc/custom_machdep.ml b/tests/misc/custom_machdep.ml index f0efefcba8d498f262a6eec0afa47b03b2547c78..d54408c49147ee7551c33516b9d6297d2961a872 100644 --- a/tests/misc/custom_machdep.ml +++ b/tests/misc/custom_machdep.ml @@ -50,6 +50,11 @@ let mach = rand_max = "0xFFFFFFFE"; mb_cur_max = "16"; nsig = ""; + errno = [ + "edom", "33"; + "eilseq", "84"; + "erange", "34"; + ]; } let mach2 = { mach with compiler = "baz" } diff --git a/tests/misc/custom_machdep.yaml b/tests/misc/custom_machdep.yaml index 3517a4968c88a2592b8c92551650347d07a7cada..3d6c9ab0b58e15f69317632be22ce59085ebff6a 100644 --- a/tests/misc/custom_machdep.yaml +++ b/tests/misc/custom_machdep.yaml @@ -46,3 +46,7 @@ mb_cur_max: 16 sig_atomic_t: int time_t: long nsig: '' +errno: + edom: "33" + eilseq: "84" + erange": "34" diff --git a/tests/syntax/machdep_char_unsigned.ml b/tests/syntax/machdep_char_unsigned.ml index df21c1e192b710f9418826bca447b574ad9c149c..df75a01c3917b8ac92fd8d1ef9b5090dbe72e49c 100644 --- a/tests/syntax/machdep_char_unsigned.ml +++ b/tests/syntax/machdep_char_unsigned.ml @@ -48,7 +48,12 @@ let md = { tmp_max = "0xFFFFFFFF"; rand_max = "0xFFFFFFFE"; mb_cur_max = "16"; - nsig = 64; + nsig = "64"; + errno = [ + "edom", "33"; + "eilseq", "84"; + "erange", "34"; + ]; } let () =