diff --git a/share/libc/netdb.h b/share/libc/netdb.h index d3efadce2b5aacf50d343166accd17fd451b2eee..e58a1ca1f638e050db9ad497c3a2322da280ad5c 100644 --- a/share/libc/netdb.h +++ b/share/libc/netdb.h @@ -99,6 +99,14 @@ struct addrinfo # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ # define NI_NUMERICSCOPE 32 +// Non-POSIX +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif + # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ diff --git a/share/libc/unistd.h b/share/libc/unistd.h index c0c279864ed3d9f96f2e2da5b868b321a617a4ab..f7cead96aae3269647af9236a9230ee4ccbec876 100644 --- a/share/libc/unistd.h +++ b/share/libc/unistd.h @@ -1079,7 +1079,12 @@ extern pid_t setsid(void); */ extern int setuid(uid_t uid); -extern unsigned int sleep(unsigned int); +/*@ + assigns \result \from seconds; + ensures unslept: 0 <= \result <= seconds; + */ +extern unsigned int sleep(unsigned int seconds); + extern void swab(const void *, void *, ssize_t); extern int symlink(const char *, const char *); diff --git a/tests/libc/netdb_c.c b/tests/libc/netdb_c.c index c2f9a8c9d3440b2ab3533704693e336e39164350..343f21234e09e55b467ba32a66fdcae9585b650b 100644 --- a/tests/libc/netdb_c.c +++ b/tests/libc/netdb_c.c @@ -12,14 +12,6 @@ #define BUF_SIZE 500 -// Non-POSIX -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif - int main() { struct addrinfo hints; struct addrinfo *result, *rp; diff --git a/tests/libc/unistd_h.c b/tests/libc/unistd_h.c index 8f0f40681fda9b3925c1fc47c67b7fc35893b381..5bb417437e2cf0245e3cc735ab6b8f0b288cef99 100644 --- a/tests/libc/unistd_h.c +++ b/tests/libc/unistd_h.c @@ -104,5 +104,8 @@ int main() { r = pipe(pipefd); //@ check ok: r == 0 || r == -1; + int unslept = sleep(42); + //@ assert 0 <= unslept <= 42; + return 0; }