Skip to content
Snippets Groups Projects
Commit eba2aaa5 authored by Andre Maroneze's avatar Andre Maroneze Committed by Allan Blanchard
Browse files

[libc] minor fixes and improvements

parent 5b1221f5
No related branches found
No related tags found
No related merge requests found
......@@ -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. */
......
......@@ -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 *);
......
......@@ -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;
......
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment