This commit is contained in:
Miku AuahDark
2024-02-14 02:49:21 +02:00
committed by GitHub
7 changed files with 276 additions and 22 deletions

View File

@ -324,8 +324,9 @@ UNIX_OBJS=\
auxiliar.$(O) \
options.$(O) \
timeout.$(O) \
inet.$(O) \
io.$(O) \
usocket.$(O) \
$(SOCKET) \
unixstream.$(O) \
unixdgram.$(O) \
compat.$(O) \
@ -393,7 +394,7 @@ none:
@echo "where PLATFORM is one of these:"
@echo " $(PLATS)"
all: $(SOCKET_SO) $(MIME_SO)
all: $(SOCKET_SO) $(MIME_SO) $(UNIX_SO)
$(SOCKET_SO): $(SOCKET_OBJS)
$(LD) $(SOCKET_OBJS) $(LDFLAGS)$@
@ -401,11 +402,11 @@ $(SOCKET_SO): $(SOCKET_OBJS)
$(MIME_SO): $(MIME_OBJS)
$(LD) $(MIME_OBJS) $(LDFLAGS)$@
all-unix: all $(UNIX_SO) $(SERIAL_SO)
$(UNIX_SO): $(UNIX_OBJS)
$(LD) $(UNIX_OBJS) $(LDFLAGS)$@
all-unix: all $(SERIAL_SO)
$(SERIAL_SO): $(SERIAL_OBJS)
$(LD) $(SERIAL_OBJS) $(LDFLAGS)$@

26
src/unixdef.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef UNIXDEF_H
#define UNIXDEF_H
/*=========================================================================*\
* Unix domain defines
* LuaSocket toolkit
*
* Provides sockaddr_un on Windows and Unix.
\*=========================================================================*/
#ifdef _WIN32
/* Technically it's possible to include <afunix.h> but it's only available
on Windows SDK 17134 (Windows 10 1803). */
#ifndef AF_UNIX
#define AF_UNIX 1
#endif
struct sockaddr_un
{
unsigned short sun_family;
char sun_path[108];
};
#else
#include <sys/un.h>
#endif /* _WIN32 */
#endif /* UNIXDEF_H */

View File

@ -8,12 +8,11 @@
#include "socket.h"
#include "options.h"
#include "unix.h"
#include "unixdef.h"
#include <string.h>
#include <stdlib.h>
#include <sys/un.h>
#define UNIXDGRAM_DATAGRAMSIZE 8192
/* provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android) */

View File

@ -7,10 +7,10 @@
#include "auxiliar.h"
#include "socket.h"
#include "options.h"
#include "unixdef.h"
#include "unixstream.h"
#include <string.h>
#include <sys/un.h>
/*=========================================================================*\
* Internal function prototypes