* Added BSD specific errno.h for EDOOFUS (yeah, I know, great error code...)
* Added sigmask() macro. * Fixed libutil.h I broke yesterday: it's thought to add functions only if you've included some other headers before; added the correct header guard we're using for our sys/param.h. * Added pidfile.c to the build. * Fixed warning in realhostname.c, and pidfile.c. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23840 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2362422c38
commit
43711de9d2
14
headers/compatibility/bsd/errno.h
Normal file
14
headers/compatibility/bsd/errno.h
Normal file
@ -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 <errno.h>
|
||||
|
||||
|
||||
#define EDOOFUS EINVAL
|
||||
|
||||
#endif /* _BSD_ERRNO_H_ */
|
@ -40,7 +40,6 @@
|
||||
#define _LIBUTIL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -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 <signal.h>
|
||||
|
||||
|
||||
#define sigmask(sig) (1 << ((sig) - 1))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -9,6 +9,7 @@ SubDirCcFlags $(defines) ;
|
||||
|
||||
StaticLibrary libutil.a :
|
||||
fparseln.c
|
||||
pidfile.c
|
||||
realhostname.c
|
||||
trimdomain.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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user