diff --git a/headers/compatibility/bsd/errno.h b/headers/compatibility/bsd/errno.h new file mode 100644 index 0000000000..afdbb0138d --- /dev/null +++ b/headers/compatibility/bsd/errno.h @@ -0,0 +1,14 @@ +/* + * Copyright 2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _BSD_ERRNO_H_ +#define _BSD_ERRNO_H_ + + +#include_next + + +#define EDOOFUS EINVAL + +#endif /* _BSD_ERRNO_H_ */ diff --git a/headers/compatibility/bsd/libutil.h b/headers/compatibility/bsd/libutil.h index 169a572c45..c8295aab99 100644 --- a/headers/compatibility/bsd/libutil.h +++ b/headers/compatibility/bsd/libutil.h @@ -40,7 +40,6 @@ #define _LIBUTIL_H_ #include -#include #include #define PROPERTY_MAX_NAME 64 @@ -53,6 +52,7 @@ typedef struct _property { char *value; } *properties; +#ifdef _SYS_PARAM_H /* for pidfile.c */ struct pidfh { int pf_fd; @@ -60,6 +60,7 @@ struct pidfh { dev_t pf_dev; ino_t pf_ino; }; +#endif /* Avoid pulling in all the include files for no need */ struct termios; @@ -119,10 +120,12 @@ const char *pw_tempname(void); int pw_tmp(int _mfd); #endif +#ifdef _SYS_PARAM_H struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr); int pidfile_write(struct pidfh *pfh); int pidfile_close(struct pidfh *pfh); int pidfile_remove(struct pidfh *pfh); +#endif __END_DECLS diff --git a/headers/compatibility/bsd/signal.h b/headers/compatibility/bsd/signal.h index a9ef3abf1b..ccd54cffb6 100644 --- a/headers/compatibility/bsd/signal.h +++ b/headers/compatibility/bsd/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _BSD_SIGNAL_H_ @@ -9,6 +9,9 @@ #include_next +#define sigmask(sig) (1 << ((sig) - 1)) + + #ifdef __cplusplus extern "C" { #endif diff --git a/src/libs/util/Jamfile b/src/libs/util/Jamfile index 22a89b2866..78712840db 100644 --- a/src/libs/util/Jamfile +++ b/src/libs/util/Jamfile @@ -9,6 +9,7 @@ SubDirCcFlags $(defines) ; StaticLibrary libutil.a : fparseln.c + pidfile.c realhostname.c trimdomain.c ; diff --git a/src/libs/util/pidfile.c b/src/libs/util/pidfile.c index dbf6aa737c..ec6fa99320 100644 --- a/src/libs/util/pidfile.c +++ b/src/libs/util/pidfile.c @@ -172,7 +172,7 @@ pidfile_write(struct pidfh *pfh) return (-1); } - snprintf(pidstr, sizeof(pidstr), "%u", getpid()); + snprintf(pidstr, sizeof(pidstr), "%lu", getpid()); if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) { error = errno; _pidfile_remove(pfh, 0); diff --git a/src/libs/util/realhostname.c b/src/libs/util/realhostname.c index 3fffcdb6e1..3366d73efa 100644 --- a/src/libs/util/realhostname.c +++ b/src/libs/util/realhostname.c @@ -89,7 +89,9 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen) { int result, error; char buf[NI_MAXHOST]; +#ifdef INET6 struct sockaddr_in lsin; +#endif result = HOSTNAME_INVALIDADDR;