Update header files to support UNIX Domain Sockets. Contributed by Thomas Cort

This commit is contained in:
Thomas Veerman
2010-07-15 12:48:15 +00:00
parent ca0bed1400
commit 17a0731f28
11 changed files with 120 additions and 9 deletions

View File

@@ -1,8 +1,7 @@
/*
sys/un.h
*/
#ifndef SYS_UN_H
#define SYS_UN_H
/* Open Group Base Specifications Issue 6 */
#include <stdint.h>
#ifndef _SA_FAMILY_T
#define _SA_FAMILY_T
@@ -10,10 +9,23 @@ sys/un.h
typedef uint8_t sa_family_t;
#endif /* _SA_FAMILY_T */
#define UNIX_PATH_MAX 127
struct sockaddr_un
{
sa_family_t sun_family;
char sun_path[127];
char sun_path[UNIX_PATH_MAX];
};
/* Note: UNIX domain sockets are not implemented! */
#include <string.h>
/* Compute the actual length of a struct sockaddr_un pointed
* to by 'unp'. sun_path must be NULL terminated. Length does
* not include the NULL byte. This is not a POSIX standard
* definition, but BSD and Linux have it, so it is here for
* compatibility.
*/
#define SUN_LEN(unp) \
((size_t)((sizeof(*(unp)) - sizeof((unp)->sun_path)) + strlen((unp)->sun_path)))
#endif