* 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:
@@ -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_
|
#define _LIBUTIL_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define PROPERTY_MAX_NAME 64
|
#define PROPERTY_MAX_NAME 64
|
||||||
@@ -53,6 +52,7 @@ typedef struct _property {
|
|||||||
char *value;
|
char *value;
|
||||||
} *properties;
|
} *properties;
|
||||||
|
|
||||||
|
#ifdef _SYS_PARAM_H
|
||||||
/* for pidfile.c */
|
/* for pidfile.c */
|
||||||
struct pidfh {
|
struct pidfh {
|
||||||
int pf_fd;
|
int pf_fd;
|
||||||
@@ -60,6 +60,7 @@ struct pidfh {
|
|||||||
dev_t pf_dev;
|
dev_t pf_dev;
|
||||||
ino_t pf_ino;
|
ino_t pf_ino;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Avoid pulling in all the include files for no need */
|
/* Avoid pulling in all the include files for no need */
|
||||||
struct termios;
|
struct termios;
|
||||||
@@ -119,10 +120,12 @@ const char *pw_tempname(void);
|
|||||||
int pw_tmp(int _mfd);
|
int pw_tmp(int _mfd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _SYS_PARAM_H
|
||||||
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
|
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
|
||||||
int pidfile_write(struct pidfh *pfh);
|
int pidfile_write(struct pidfh *pfh);
|
||||||
int pidfile_close(struct pidfh *pfh);
|
int pidfile_close(struct pidfh *pfh);
|
||||||
int pidfile_remove(struct pidfh *pfh);
|
int pidfile_remove(struct pidfh *pfh);
|
||||||
|
#endif
|
||||||
|
|
||||||
__END_DECLS
|
__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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _BSD_SIGNAL_H_
|
#ifndef _BSD_SIGNAL_H_
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
#include_next <signal.h>
|
#include_next <signal.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define sigmask(sig) (1 << ((sig) - 1))
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ SubDirCcFlags $(defines) ;
|
|||||||
|
|
||||||
StaticLibrary libutil.a :
|
StaticLibrary libutil.a :
|
||||||
fparseln.c
|
fparseln.c
|
||||||
|
pidfile.c
|
||||||
realhostname.c
|
realhostname.c
|
||||||
trimdomain.c
|
trimdomain.c
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ pidfile_write(struct pidfh *pfh)
|
|||||||
return (-1);
|
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)) {
|
if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
|
||||||
error = errno;
|
error = errno;
|
||||||
_pidfile_remove(pfh, 0);
|
_pidfile_remove(pfh, 0);
|
||||||
|
|||||||
@@ -89,7 +89,9 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen)
|
|||||||
{
|
{
|
||||||
int result, error;
|
int result, error;
|
||||||
char buf[NI_MAXHOST];
|
char buf[NI_MAXHOST];
|
||||||
|
#ifdef INET6
|
||||||
struct sockaddr_in lsin;
|
struct sockaddr_in lsin;
|
||||||
|
#endif
|
||||||
|
|
||||||
result = HOSTNAME_INVALIDADDR;
|
result = HOSTNAME_INVALIDADDR;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user