mirror of
https://github.com/dlang/phobos.git
synced 2025-05-09 13:02:30 +03:00
initial Solaris port
This commit is contained in:
parent
cd79ee5861
commit
e6e77ef6b4
37 changed files with 3646 additions and 1353 deletions
80
etc/c/zlib/solaris.mak
Normal file
80
etc/c/zlib/solaris.mak
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
# Makefile for zlib
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
LD=link
|
||||||
|
CFLAGS=-O -m32
|
||||||
|
LDFLAGS=
|
||||||
|
O=.o
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o .d
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CFLAGS) $*
|
||||||
|
|
||||||
|
.d.o:
|
||||||
|
$(DMD) -c $(DFLAGS) $*
|
||||||
|
|
||||||
|
# variables
|
||||||
|
OBJS = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
|
||||||
|
trees$(O) zutil$(O) inflate$(O) infback$(O) inftrees$(O) inffast$(O)
|
||||||
|
|
||||||
|
all: zlib.a example minigzip
|
||||||
|
|
||||||
|
adler32.o: adler32.c zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
compress.o: compress.c zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
crc32.o: crc32.c zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
deflate.o: deflate.c deflate.h zutil.h zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
gzio.o: gzio.c zutil.h zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
infback.o: infback.c zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
inflate.o: inflate.c zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
inftrees.o: inftrees.c zlib.h zconf.h inftrees.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
inffast.o: inffast.c zlib.h zconf.h inftrees.h inflate.h inffast.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
trees.o: trees.c deflate.h zutil.h zlib.h zconf.h trees.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
uncompr.o: uncompr.c zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
zutil.o: zutil.c zutil.h zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
example.o: example.c zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
minigzip.o: minigzip.c zlib.h zconf.h
|
||||||
|
$(CC) -c $(cvarsdll) $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
zlib.a: $(OBJS)
|
||||||
|
ar -r $@ $(OBJS)
|
||||||
|
|
||||||
|
example: example.o zlib.a
|
||||||
|
$(CC) -o $@ example.o zlib.a -g
|
||||||
|
|
||||||
|
minigzip: minigzip.o zlib.a
|
||||||
|
$(CC) -o $@ minigzip.o zlib.a -g
|
||||||
|
|
||||||
|
test: example minigzip
|
||||||
|
./example
|
||||||
|
echo hello world | minigzip | minigzip -d
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OBJS) zlib.a example.o example minigzip minigzip.o test foo.gz
|
||||||
|
|
15
freebsd.mak
15
freebsd.mak
|
@ -1,4 +1,4 @@
|
||||||
# Makefile to build linux D runtime library libphobos.a.
|
# Makefile to build FreeBSD D runtime library libphobos.a.
|
||||||
# Targets:
|
# Targets:
|
||||||
# make
|
# make
|
||||||
# Same as make unittest
|
# Same as make unittest
|
||||||
|
@ -76,7 +76,7 @@ OBJS = asserterror.o deh2.o complex.o gcstats.o \
|
||||||
pthread.o
|
pthread.o
|
||||||
|
|
||||||
MAKEFILES= \
|
MAKEFILES= \
|
||||||
win32.mak linux.mak osx.mak freebsd.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
SRCS= \
|
SRCS= \
|
||||||
internal/aaA.d internal/adi.d \
|
internal/aaA.d internal/adi.d \
|
||||||
|
@ -165,6 +165,9 @@ SRC_STD_C_FREEBSD= std/c/freebsd/freebsd.d \
|
||||||
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
||||||
std/c/freebsd/math.d
|
std/c/freebsd/math.d
|
||||||
|
|
||||||
|
SRC_STD_C_SOLARIS= std/c/solaris/solaris.d \
|
||||||
|
std/c/solaris/socket.d std/c/solaris/pthread.d
|
||||||
|
|
||||||
SRC_ETC= etc/gamma.d
|
SRC_ETC= etc/gamma.d
|
||||||
|
|
||||||
SRC_ETC_C= etc/c/zlib.d
|
SRC_ETC_C= etc/c/zlib.d
|
||||||
|
@ -201,7 +204,8 @@ SRC_ZLIB= etc/c/zlib/trees.h \
|
||||||
etc/c/zlib/win32.mak \
|
etc/c/zlib/win32.mak \
|
||||||
etc/c/zlib/linux.mak \
|
etc/c/zlib/linux.mak \
|
||||||
etc/c/zlib/osx.mak \
|
etc/c/zlib/osx.mak \
|
||||||
etc/c/zlib/freebsd.mak
|
etc/c/zlib/freebsd.mak \
|
||||||
|
etc/c/zlib/solaris.mak
|
||||||
|
|
||||||
SRC_GC= internal/gc/gc.d \
|
SRC_GC= internal/gc/gc.d \
|
||||||
internal/gc/gcold.d \
|
internal/gc/gcold.d \
|
||||||
|
@ -215,11 +219,12 @@ SRC_GC= internal/gc/gc.d \
|
||||||
internal/gc/win32.mak \
|
internal/gc/win32.mak \
|
||||||
internal/gc/linux.mak \
|
internal/gc/linux.mak \
|
||||||
internal/gc/osx.mak \
|
internal/gc/osx.mak \
|
||||||
internal/gc/freebsd.mak
|
internal/gc/freebsd.mak \
|
||||||
|
internal/gc/solaris.mak
|
||||||
|
|
||||||
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
||||||
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
||||||
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD)
|
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD) $(SRC_STD_C_SOLARIS)
|
||||||
|
|
||||||
|
|
||||||
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
||||||
|
|
|
@ -75,7 +75,7 @@ void _STD_critical_term()
|
||||||
|
|
||||||
/* ================================= linux ============================ */
|
/* ================================= linux ============================ */
|
||||||
|
|
||||||
#if linux || __APPLE__ || __FreeBSD__
|
#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -459,7 +459,7 @@ void _d_monitor_epilog(void *x, void *y, Object *h)
|
||||||
|
|
||||||
/* ======================== linux =============================== */
|
/* ======================== linux =============================== */
|
||||||
|
|
||||||
#if linux || __APPLE__ || __FreeBSD__
|
#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
|
||||||
|
|
||||||
#include "mars.h"
|
#include "mars.h"
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,12 @@ version (FreeBSD)
|
||||||
extern (C) void* __libc_stack_end;
|
extern (C) void* __libc_stack_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{
|
||||||
|
// The bottom of the stack
|
||||||
|
extern (C) void* __libc_stack_end;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* The D main() function supplied by the user's program
|
* The D main() function supplied by the user's program
|
||||||
*/
|
*/
|
||||||
|
@ -72,6 +78,13 @@ extern (C) int main(size_t argc, char **argv)
|
||||||
__libc_stack_end = cast(void*)&argv;
|
__libc_stack_end = cast(void*)&argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{ /* As far as the gc is concerned, argv is at the top
|
||||||
|
* of the main thread's stack, so save the address of that.
|
||||||
|
*/
|
||||||
|
__libc_stack_end = cast(void*)&argv;
|
||||||
|
}
|
||||||
|
|
||||||
version (Posix)
|
version (Posix)
|
||||||
{
|
{
|
||||||
_STI_monitor_staticctor();
|
_STI_monitor_staticctor();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
# makefile to build linux D garbage collector
|
# makefile to build FreeBSD D garbage collector
|
||||||
|
|
||||||
#DMD=../../../dmd
|
#DMD=../../../dmd
|
||||||
DMD=dmd
|
DMD=dmd
|
||||||
|
@ -12,7 +12,7 @@ CC=gcc
|
||||||
OBJS= gc.o gcx.o gcbits.o gclinux.o gcold.o
|
OBJS= gc.o gcx.o gcbits.o gclinux.o gcold.o
|
||||||
|
|
||||||
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcold.d testgc.d \
|
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcold.d testgc.d \
|
||||||
win32.mak linux.mak osx.mak freebsd.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
.SUFFIXES: .c .o .d
|
.SUFFIXES: .c .o .d
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
version (FreeBSD)
|
version (FreeBSD)
|
||||||
import std.c.freebsd.freebsd;
|
import std.c.freebsd.freebsd;
|
||||||
|
else version (Solaris)
|
||||||
|
import std.c.solaris.solaris;
|
||||||
else
|
else
|
||||||
import std.c.linux.linux;
|
import std.c.linux.linux;
|
||||||
|
|
||||||
|
@ -30,6 +32,14 @@ version (FreeBSD)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
extern char etext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/+
|
/+
|
||||||
extern (C)
|
extern (C)
|
||||||
{
|
{
|
||||||
|
@ -151,6 +161,11 @@ void os_query_staticdataseg(void **base, uint *nbytes)
|
||||||
*base = cast(void *)&etext;
|
*base = cast(void *)&etext;
|
||||||
*nbytes = cast(byte *)&_end - cast(byte *)&etext;
|
*nbytes = cast(byte *)&_end - cast(byte *)&etext;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
*base = cast(void *)&etext;
|
||||||
|
*nbytes = cast(byte *)&_end - cast(byte *)&etext;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*base = cast(void *)&__data_start;
|
*base = cast(void *)&__data_start;
|
||||||
|
|
|
@ -12,7 +12,7 @@ CC=gcc
|
||||||
OBJS= gc.o gcx.o gcbits.o gclinux.o gcold.o
|
OBJS= gc.o gcx.o gcbits.o gclinux.o gcold.o
|
||||||
|
|
||||||
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcold.d testgc.d \
|
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcold.d testgc.d \
|
||||||
win32.mak linux.mak osx.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) $*
|
$(CC) -c $(CFLAGS) $*
|
||||||
|
|
|
@ -12,7 +12,7 @@ CC=gcc
|
||||||
OBJS= gc.o gcx.o gcbits.o gclinux.o gcosxc.o gcold.o
|
OBJS= gc.o gcx.o gcbits.o gclinux.o gcosxc.o gcold.o
|
||||||
|
|
||||||
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcosxc.c gcold.d testgc.d \
|
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcosxc.c gcold.d testgc.d \
|
||||||
win32.mak linux.mak osx.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(CFLAGS) $*
|
$(CC) -c $(CFLAGS) $*
|
||||||
|
|
54
internal/gc/solaris.mak
Normal file
54
internal/gc/solaris.mak
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
|
||||||
|
# makefile to build Solaris D garbage collector
|
||||||
|
|
||||||
|
#DMD=../../../dmd
|
||||||
|
DMD=dmd
|
||||||
|
CFLAGS=-g -m32
|
||||||
|
#DFLAGS=-unittest -g -release
|
||||||
|
DFLAGS=-release -O -inline -I../..
|
||||||
|
#DFLAGS=-release -inline -O
|
||||||
|
CC=gcc
|
||||||
|
|
||||||
|
OBJS= gc.o gcx.o gcbits.o gclinux.o gcold.o
|
||||||
|
|
||||||
|
SRC= gc.d gcx.d gcbits.d win32.d gclinux.d gcold.d testgc.d \
|
||||||
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CFLAGS) $*
|
||||||
|
|
||||||
|
.d.o:
|
||||||
|
$(DMD) -c $(DFLAGS) $*
|
||||||
|
|
||||||
|
targets : testgc dmgc.a
|
||||||
|
|
||||||
|
testgc : testgc.o $(OBJS) solaris.mak
|
||||||
|
$(DMD) -of$@ testgc.o gc.o gcx.o gcbits.o gclinux.o -g
|
||||||
|
|
||||||
|
testgc.o : testgc.d
|
||||||
|
$(DMD) -c $(DFLAGS) testgc.d
|
||||||
|
|
||||||
|
dmgc.a : $(OBJS) solaris.mak
|
||||||
|
ar -r $@ $(OBJS)
|
||||||
|
|
||||||
|
gc.o : gc.d
|
||||||
|
$(DMD) -c $(DFLAGS) gc.d
|
||||||
|
|
||||||
|
gcold.o : gcold.d
|
||||||
|
$(DMD) -c $(DFLAGS) gcold.d
|
||||||
|
|
||||||
|
gcx.o : gcx.d
|
||||||
|
$(DMD) -c $(DFLAGS) gcx.d gcbits.d
|
||||||
|
|
||||||
|
#gcbits.o : gcbits.d
|
||||||
|
# $(DMD) -c $(DFLAGS) gcbits.d
|
||||||
|
|
||||||
|
gclinux.o : gclinux.d
|
||||||
|
$(DMD) -c $(DFLAGS) gclinux.d
|
||||||
|
|
||||||
|
zip : $(SRC)
|
||||||
|
$(RM) dmgc.zip
|
||||||
|
zip dmgc $(SRC)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OBJS) dmgc.a testgc testgc.o
|
|
@ -12,7 +12,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#elif linux || __APPLE__ || __FreeBSD__
|
#elif linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
|
||||||
#define USE_PTHREADS 1
|
#define USE_PTHREADS 1
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,11 +119,9 @@ void _d_monitorrelease(Object *h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* =============================== linux ============================ */
|
/* =============================== linux ============================ */
|
||||||
|
|
||||||
#if USE_PTHREADS
|
#elif USE_PTHREADS
|
||||||
|
|
||||||
#if linux || __APPLE__
|
#if linux || __APPLE__
|
||||||
#ifndef PTHREAD_MUTEX_RECURSIVE
|
#ifndef PTHREAD_MUTEX_RECURSIVE
|
||||||
|
@ -207,4 +205,6 @@ void _d_monitorrelease(Object *h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error Unsupported platform
|
||||||
#endif
|
#endif
|
||||||
|
|
11
linux.mak
11
linux.mak
|
@ -75,7 +75,7 @@ OBJS = asserterror.o deh2.o complex.o gcstats.o \
|
||||||
pthread.o
|
pthread.o
|
||||||
|
|
||||||
MAKEFILES= \
|
MAKEFILES= \
|
||||||
win32.mak linux.mak osx.mak freebsd.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
SRCS= \
|
SRCS= \
|
||||||
internal/aaA.d internal/adi.d \
|
internal/aaA.d internal/adi.d \
|
||||||
|
@ -164,6 +164,9 @@ SRC_STD_C_FREEBSD= std/c/freebsd/freebsd.d \
|
||||||
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
||||||
std/c/freebsd/math.d
|
std/c/freebsd/math.d
|
||||||
|
|
||||||
|
SRC_STD_C_SOLARIS= std/c/solaris/solaris.d \
|
||||||
|
std/c/solaris/socket.d std/c/solaris/pthread.d
|
||||||
|
|
||||||
SRC_ETC= etc/gamma.d
|
SRC_ETC= etc/gamma.d
|
||||||
|
|
||||||
SRC_ETC_C= etc/c/zlib.d
|
SRC_ETC_C= etc/c/zlib.d
|
||||||
|
@ -200,7 +203,8 @@ SRC_ZLIB= etc/c/zlib/trees.h \
|
||||||
etc/c/zlib/win32.mak \
|
etc/c/zlib/win32.mak \
|
||||||
etc/c/zlib/linux.mak \
|
etc/c/zlib/linux.mak \
|
||||||
etc/c/zlib/osx.mak \
|
etc/c/zlib/osx.mak \
|
||||||
etc/c/zlib/freebsd.mak
|
etc/c/zlib/freebsd.mak \
|
||||||
|
etc/c/zlib/solaris.mak
|
||||||
|
|
||||||
SRC_GC= internal/gc/gc.d \
|
SRC_GC= internal/gc/gc.d \
|
||||||
internal/gc/gcold.d \
|
internal/gc/gcold.d \
|
||||||
|
@ -214,11 +218,12 @@ SRC_GC= internal/gc/gc.d \
|
||||||
internal/gc/win32.mak \
|
internal/gc/win32.mak \
|
||||||
internal/gc/linux.mak \
|
internal/gc/linux.mak \
|
||||||
internal/gc/osx.mak \
|
internal/gc/osx.mak \
|
||||||
|
internal/gc/solaris.mak \
|
||||||
internal/gc/freebsd.mak
|
internal/gc/freebsd.mak
|
||||||
|
|
||||||
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
||||||
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
||||||
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD)
|
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD) $(SRC_STD_C_SOLARIS)
|
||||||
|
|
||||||
|
|
||||||
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
||||||
|
|
7
osx.mak
7
osx.mak
|
@ -75,7 +75,7 @@ OBJS = asserterror.o deh2.o complex.o gcstats.o \
|
||||||
pthread.o
|
pthread.o
|
||||||
|
|
||||||
MAKEFILES= \
|
MAKEFILES= \
|
||||||
win32.mak linux.mak osx.mak freebsd.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
SRCS= \
|
SRCS= \
|
||||||
internal/aaA.d internal/adi.d \
|
internal/aaA.d internal/adi.d \
|
||||||
|
@ -164,6 +164,9 @@ SRC_STD_C_FREEBSD= std/c/freebsd/freebsd.d \
|
||||||
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
||||||
std/c/freebsd/math.d
|
std/c/freebsd/math.d
|
||||||
|
|
||||||
|
SRC_STD_C_SOLARIS= std/c/solaris/solaris.d \
|
||||||
|
std/c/solaris/socket.d std/c/solaris/pthread.d
|
||||||
|
|
||||||
SRC_ETC= etc/gamma.d
|
SRC_ETC= etc/gamma.d
|
||||||
|
|
||||||
SRC_ETC_C= etc/c/zlib.d
|
SRC_ETC_C= etc/c/zlib.d
|
||||||
|
@ -217,7 +220,7 @@ SRC_GC= internal/gc/gc.d \
|
||||||
|
|
||||||
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
||||||
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
||||||
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD)
|
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD) $(SRC_STD_C_SOLARIS)
|
||||||
|
|
||||||
|
|
||||||
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
||||||
|
|
650
solaris.mak
Normal file
650
solaris.mak
Normal file
|
@ -0,0 +1,650 @@
|
||||||
|
# Makefile to build Solaris D runtime library libphobos.a.
|
||||||
|
# Targets:
|
||||||
|
# make
|
||||||
|
# Same as make unittest
|
||||||
|
# make libphobos.a
|
||||||
|
# Build libphobos.a
|
||||||
|
# make clean
|
||||||
|
# Delete unneeded files created by build process
|
||||||
|
# make unittest
|
||||||
|
# Build libphobos.a, build and run unit tests
|
||||||
|
|
||||||
|
LIB=libphobos.a
|
||||||
|
|
||||||
|
MAKEFILE=solaris.mak
|
||||||
|
|
||||||
|
CFLAGS=-O -m32
|
||||||
|
#CFLAGS=-g -m32
|
||||||
|
|
||||||
|
DFLAGS=-O -release -w
|
||||||
|
#DFLAGS=-unittest -w
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
#DMD=/dmd/bin/dmd
|
||||||
|
DMD=dmd
|
||||||
|
|
||||||
|
.SUFFIXES: .c .o .cpp .d .asm
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CFLAGS) $*.c
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
g -c $(CFLAGS) $*.cpp
|
||||||
|
|
||||||
|
.d.o:
|
||||||
|
$(DMD) -c $(DFLAGS) $*.d
|
||||||
|
|
||||||
|
.asm.o:
|
||||||
|
$(CC) -c $*.asm
|
||||||
|
|
||||||
|
targets : $(LIB)
|
||||||
|
|
||||||
|
test.o : test.d
|
||||||
|
$(DMD) -c test -g
|
||||||
|
|
||||||
|
test : test.o $(LIB)
|
||||||
|
$(CC) -o $@ test.o $(LIB) -lpthread -lm -lsocket -lnsl -g
|
||||||
|
|
||||||
|
OBJS = asserterror.o deh2.o complex.o gcstats.o \
|
||||||
|
critical.o object.o monitor.o \
|
||||||
|
outofmemory.o file.o \
|
||||||
|
compiler.o system.o moduleinit.o md5.o base64.o \
|
||||||
|
path.o string.o math.o mmfile.o \
|
||||||
|
outbuffer.o ctype.o regexp.o random.o \
|
||||||
|
solaris.o solarissocket.o \
|
||||||
|
linux.o \
|
||||||
|
stream.o cstream.o switcherr.o array.o gc.o \
|
||||||
|
thread.o utf.o uri.o \
|
||||||
|
Dcrc32.o conv.o errno.o alloca.o cmath2.o \
|
||||||
|
process.o syserror.o metastrings.o \
|
||||||
|
socket.o socketstream.o stdarg.o stdio.o format.o \
|
||||||
|
perf.o openrj.o uni.o trace.o boxer.o \
|
||||||
|
demangle.o cover.o bitarray.o bind.o \
|
||||||
|
signals.o cpuid.o traits.o typetuple.o loader.o \
|
||||||
|
ti_wchar.o ti_uint.o ti_short.o ti_ushort.o \
|
||||||
|
ti_byte.o ti_ubyte.o ti_long.o ti_ulong.o ti_ptr.o \
|
||||||
|
ti_float.o ti_double.o ti_real.o ti_delegate.o \
|
||||||
|
ti_creal.o ti_ireal.o ti_cfloat.o ti_ifloat.o \
|
||||||
|
ti_cdouble.o ti_idouble.o \
|
||||||
|
ti_AC.o ti_Ag.o ti_Ashort.o \
|
||||||
|
ti_C.o ti_int.o ti_char.o ti_dchar.o \
|
||||||
|
ti_Aint.o ti_Along.o \
|
||||||
|
ti_Afloat.o ti_Adouble.o ti_Areal.o \
|
||||||
|
ti_Acfloat.o ti_Acdouble.o ti_Acreal.o \
|
||||||
|
ti_void.o \
|
||||||
|
date.o dateparse.o llmath.o math2.o Czlib.o Dzlib.o zip.o \
|
||||||
|
pthread.o \
|
||||||
|
Cstdio.o
|
||||||
|
|
||||||
|
MAKEFILES= \
|
||||||
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
|
SRCS= \
|
||||||
|
internal/aaA.d internal/adi.d \
|
||||||
|
internal/aApply.d internal/aApplyR.d internal/memset.d \
|
||||||
|
internal/arraycast.d internal/arraycat.d \
|
||||||
|
internal/switch.d internal/qsort.d internal/invariant.d \
|
||||||
|
internal/dmain2.d internal/cast.d internal/obj.d \
|
||||||
|
internal/arrayfloat.d internal/arraydouble.d internal/arrayreal.d \
|
||||||
|
internal/arraybyte.d internal/arrayshort.d internal/arrayint.d \
|
||||||
|
|
||||||
|
|
||||||
|
ZLIB_OBJS = etc/c/zlib/adler32.o etc/c/zlib/compress.o \
|
||||||
|
etc/c/zlib/crc32.o etc/c/zlib/gzio.o \
|
||||||
|
etc/c/zlib/uncompr.o etc/c/zlib/deflate.o \
|
||||||
|
etc/c/zlib/trees.o etc/c/zlib/zutil.o \
|
||||||
|
etc/c/zlib/inflate.o etc/c/zlib/infback.o \
|
||||||
|
etc/c/zlib/inftrees.o etc/c/zlib/inffast.o
|
||||||
|
|
||||||
|
GC_OBJS= internal/gc/gc.o internal/gc/gcold.o internal/gc/gcx.o \
|
||||||
|
internal/gc/gcbits.o internal/gc/gclinux.o
|
||||||
|
|
||||||
|
SRC= errno.c object.d unittest.d crc32.d gcstats.d
|
||||||
|
|
||||||
|
SRC_STD= std/zlib.d std/zip.d std/stdint.d std/conv.d std/utf.d std/uri.d \
|
||||||
|
std/gc.d std/math.d std/string.d std/path.d std/date.d \
|
||||||
|
std/ctype.d std/file.d std/compiler.d std/system.d std/moduleinit.d \
|
||||||
|
std/outbuffer.d std/math2.d std/thread.d std/md5.d std/base64.d \
|
||||||
|
std/asserterror.d std/dateparse.d std/outofmemory.d std/mmfile.d \
|
||||||
|
std/intrinsic.d std/array.d std/switcherr.d std/syserror.d \
|
||||||
|
std/regexp.d std/random.d std/stream.d std/process.d \
|
||||||
|
std/socket.d std/socketstream.d std/loader.d std/stdarg.d \
|
||||||
|
std/stdio.d std/format.d std/perf.d std/openrj.d std/uni.d \
|
||||||
|
std/boxer.d std/cstream.d std/demangle.d std/cover.d std/bitarray.d \
|
||||||
|
std/signals.d std/cpuid.d std/typetuple.d std/traits.d std/bind.d \
|
||||||
|
std/metastrings.d
|
||||||
|
|
||||||
|
SRC_STD_C= std/c/process.d std/c/stdlib.d std/c/time.d std/c/stdio.d \
|
||||||
|
std/c/math.d std/c/stdarg.d std/c/stddef.d std/c/fenv.d std/c/string.d \
|
||||||
|
std/d/locale.d
|
||||||
|
|
||||||
|
SRC_TI= \
|
||||||
|
std/typeinfo/ti_wchar.d std/typeinfo/ti_uint.d \
|
||||||
|
std/typeinfo/ti_short.d std/typeinfo/ti_ushort.d \
|
||||||
|
std/typeinfo/ti_byte.d std/typeinfo/ti_ubyte.d \
|
||||||
|
std/typeinfo/ti_long.d std/typeinfo/ti_ulong.d \
|
||||||
|
std/typeinfo/ti_ptr.d \
|
||||||
|
std/typeinfo/ti_float.d std/typeinfo/ti_double.d \
|
||||||
|
std/typeinfo/ti_real.d std/typeinfo/ti_delegate.d \
|
||||||
|
std/typeinfo/ti_creal.d std/typeinfo/ti_ireal.d \
|
||||||
|
std/typeinfo/ti_cfloat.d std/typeinfo/ti_ifloat.d \
|
||||||
|
std/typeinfo/ti_cdouble.d std/typeinfo/ti_idouble.d \
|
||||||
|
std/typeinfo/ti_Adchar.d \
|
||||||
|
std/typeinfo/ti_Ashort.d \
|
||||||
|
std/typeinfo/ti_Ag.d \
|
||||||
|
std/typeinfo/ti_AC.d std/typeinfo/ti_C.d \
|
||||||
|
std/typeinfo/ti_int.d std/typeinfo/ti_char.d \
|
||||||
|
std/typeinfo/ti_Aint.d \
|
||||||
|
std/typeinfo/ti_Along.d \
|
||||||
|
std/typeinfo/ti_Afloat.d std/typeinfo/ti_Adouble.d \
|
||||||
|
std/typeinfo/ti_Areal.d \
|
||||||
|
std/typeinfo/ti_Acfloat.d std/typeinfo/ti_Acdouble.d \
|
||||||
|
std/typeinfo/ti_Acreal.d \
|
||||||
|
std/typeinfo/ti_void.d
|
||||||
|
|
||||||
|
SRC_INT= \
|
||||||
|
internal/switch.d internal/complex.c internal/critical.c \
|
||||||
|
internal/minit.asm internal/alloca.d internal/llmath.d internal/deh.c \
|
||||||
|
internal/arraycat.d internal/invariant.d internal/monitor.c \
|
||||||
|
internal/memset.d internal/arraycast.d internal/aaA.d internal/adi.d \
|
||||||
|
internal/dmain2.d internal/cast.d internal/qsort.d internal/deh2.d \
|
||||||
|
internal/cmath2.d internal/obj.d internal/mars.h internal/aApply.d \
|
||||||
|
internal/aApplyR.d internal/object.d internal/trace.d internal/qsort2.d
|
||||||
|
|
||||||
|
SRC_STD_WIN= std/windows/registry.d \
|
||||||
|
std/windows/iunknown.d std/windows/charset.d
|
||||||
|
|
||||||
|
SRC_STD_C_WIN= std/c/windows/windows.d std/c/windows/com.d \
|
||||||
|
std/c/windows/winsock.d std/c/windows/stat.d
|
||||||
|
|
||||||
|
SRC_STD_C_LINUX= std/c/linux/linux.d std/c/linux/linuxextern.d \
|
||||||
|
std/c/linux/socket.d std/c/linux/pthread.d
|
||||||
|
|
||||||
|
SRC_STD_C_OSX= std/c/osx/osx.d
|
||||||
|
|
||||||
|
SRC_STD_C_FREEBSD= std/c/freebsd/freebsd.d \
|
||||||
|
std/c/freebsd/socket.d std/c/freebsd/pthread.d \
|
||||||
|
std/c/freebsd/math.d
|
||||||
|
|
||||||
|
SRC_STD_C_SOLARIS= std/c/solaris/solaris.d \
|
||||||
|
std/c/solaris/socket.d std/c/solaris/pthread.d
|
||||||
|
|
||||||
|
SRC_ETC= etc/gamma.d
|
||||||
|
|
||||||
|
SRC_ETC_C= etc/c/zlib.d
|
||||||
|
|
||||||
|
SRC_ZLIB= etc/c/zlib/trees.h \
|
||||||
|
etc/c/zlib/inffixed.h \
|
||||||
|
etc/c/zlib/inffast.h \
|
||||||
|
etc/c/zlib/crc32.h \
|
||||||
|
etc/c/zlib/algorithm.txt \
|
||||||
|
etc/c/zlib/uncompr.c \
|
||||||
|
etc/c/zlib/compress.c \
|
||||||
|
etc/c/zlib/deflate.h \
|
||||||
|
etc/c/zlib/inftrees.h \
|
||||||
|
etc/c/zlib/infback.c \
|
||||||
|
etc/c/zlib/zutil.c \
|
||||||
|
etc/c/zlib/crc32.c \
|
||||||
|
etc/c/zlib/inflate.h \
|
||||||
|
etc/c/zlib/example.c \
|
||||||
|
etc/c/zlib/inffast.c \
|
||||||
|
etc/c/zlib/trees.c \
|
||||||
|
etc/c/zlib/inflate.c \
|
||||||
|
etc/c/zlib/gzio.c \
|
||||||
|
etc/c/zlib/zconf.h \
|
||||||
|
etc/c/zlib/zconf.in.h \
|
||||||
|
etc/c/zlib/minigzip.c \
|
||||||
|
etc/c/zlib/deflate.c \
|
||||||
|
etc/c/zlib/inftrees.c \
|
||||||
|
etc/c/zlib/zutil.h \
|
||||||
|
etc/c/zlib/zlib.3 \
|
||||||
|
etc/c/zlib/zlib.h \
|
||||||
|
etc/c/zlib/adler32.c \
|
||||||
|
etc/c/zlib/ChangeLog \
|
||||||
|
etc/c/zlib/README \
|
||||||
|
etc/c/zlib/win32.mak \
|
||||||
|
etc/c/zlib/linux.mak \
|
||||||
|
etc/c/zlib/osx.mak \
|
||||||
|
etc/c/zlib/freebsd.mak \
|
||||||
|
etc/c/zlib/solaris.mak
|
||||||
|
|
||||||
|
SRC_GC= internal/gc/gc.d \
|
||||||
|
internal/gc/gcold.d \
|
||||||
|
internal/gc/gcx.d \
|
||||||
|
internal/gc/gcstub.d \
|
||||||
|
internal/gc/gcbits.d \
|
||||||
|
internal/gc/win32.d \
|
||||||
|
internal/gc/gclinux.d \
|
||||||
|
internal/gc/gcosxc.c \
|
||||||
|
internal/gc/testgc.d \
|
||||||
|
internal/gc/win32.mak \
|
||||||
|
internal/gc/linux.mak \
|
||||||
|
internal/gc/osx.mak \
|
||||||
|
internal/gc/freebsd.mak \
|
||||||
|
internal/gc/solaris.mak
|
||||||
|
|
||||||
|
ALLSRCS = $(SRC) $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \
|
||||||
|
$(SRC_STD_C_WIN) $(SRC_STD_C_LINUX) $(SRC_ETC) $(SRC_ETC_C) \
|
||||||
|
$(SRC_ZLIB) $(SRC_GC) $(SRC_STD_C_FREEBSD) $(SRC_STD_C_SOLARIS)
|
||||||
|
|
||||||
|
|
||||||
|
$(LIB) : $(OBJS) $(GC_OBJS) $(ZLIB_OBJS) $(SRCS) $(MAKEFILE)
|
||||||
|
# rm -f $(LIB)
|
||||||
|
# ar -r $@ $(OBJS) $(ZLIB_OBJS) $(GC_OBJS)
|
||||||
|
$(DMD) -lib -of$(LIB) $(DFLAGS) $(SRCS) $(OBJS) $(ZLIB_OBJS) $(GC_OBJS)
|
||||||
|
|
||||||
|
unittest :
|
||||||
|
$(DMD) $(DFLAGS) -unittest -version=Unittest unittest.d $(SRCS) $(LIB) -L-lsocket -L-lnsl
|
||||||
|
./unittest
|
||||||
|
|
||||||
|
cov : $(SRCS) $(LIB)
|
||||||
|
$(DMD) -cov -unittest -ofcov unittest.d $(SRCS) $(LIB)
|
||||||
|
./cov
|
||||||
|
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
$(GC_OBJS):
|
||||||
|
# cd internal/gc
|
||||||
|
# make -f $(MAKEFILE) dmgc.a
|
||||||
|
# cd ../..
|
||||||
|
make DMD=$(DMD) -C ./internal/gc -f $(MAKEFILE)
|
||||||
|
|
||||||
|
$(ZLIB_OBJS):
|
||||||
|
# cd etc/c/zlib
|
||||||
|
# make -f $(MAKEFILE)
|
||||||
|
# cd ../../..
|
||||||
|
make -C ./etc/c/zlib -f $(MAKEFILE)
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
Dcrc32.o : crc32.d
|
||||||
|
$(DMD) -c $(DFLAGS) crc32.d -ofDcrc32.o
|
||||||
|
|
||||||
|
errno.o : errno.c
|
||||||
|
|
||||||
|
gcstats.o : gcstats.d
|
||||||
|
$(DMD) -c $(DFLAGS) gcstats.d
|
||||||
|
|
||||||
|
### internal
|
||||||
|
|
||||||
|
aaA.o : internal/aaA.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/aaA.d
|
||||||
|
|
||||||
|
aApply.o : internal/aApply.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/aApply.d
|
||||||
|
|
||||||
|
aApplyR.o : internal/aApplyR.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/aApplyR.d
|
||||||
|
|
||||||
|
adi.o : internal/adi.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/adi.d
|
||||||
|
|
||||||
|
alloca.o : internal/alloca.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/alloca.d
|
||||||
|
|
||||||
|
arraycast.o : internal/arraycast.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/arraycast.d
|
||||||
|
|
||||||
|
arraycat.o : internal/arraycat.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/arraycat.d
|
||||||
|
|
||||||
|
cast.o : internal/cast.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/cast.d
|
||||||
|
|
||||||
|
cmath2.o : internal/cmath2.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/cmath2.d
|
||||||
|
|
||||||
|
complex.o : internal/complex.c
|
||||||
|
$(CC) -c $(CFLAGS) internal/complex.c
|
||||||
|
|
||||||
|
critical.o : internal/critical.c
|
||||||
|
$(CC) -c $(CFLAGS) internal/critical.c
|
||||||
|
|
||||||
|
#deh.o : internal/mars.h internal/deh.cA
|
||||||
|
# $(CC) -c $(CFLAGS) internal/deh.c
|
||||||
|
|
||||||
|
deh2.o : internal/deh2.d
|
||||||
|
$(DMD) -c $(DFLAGS) -release internal/deh2.d
|
||||||
|
|
||||||
|
dmain2.o : internal/dmain2.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/dmain2.d
|
||||||
|
|
||||||
|
invariant.o : internal/invariant.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/invariant.d
|
||||||
|
|
||||||
|
llmath.o : internal/llmath.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/llmath.d
|
||||||
|
|
||||||
|
memset.o : internal/memset.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/memset.d
|
||||||
|
|
||||||
|
#minit.o : internal/minit.asm
|
||||||
|
# $(CC) -c internal/minit.asm
|
||||||
|
|
||||||
|
monitor.o : internal/mars.h internal/monitor.c
|
||||||
|
$(CC) -c $(CFLAGS) internal/monitor.c
|
||||||
|
|
||||||
|
obj.o : internal/obj.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/obj.d
|
||||||
|
|
||||||
|
object.o : internal/object.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/object.d
|
||||||
|
|
||||||
|
qsort.o : internal/qsort.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/qsort.d
|
||||||
|
|
||||||
|
switch.o : internal/switch.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/switch.d
|
||||||
|
|
||||||
|
trace.o : internal/trace.d
|
||||||
|
$(DMD) -c $(DFLAGS) internal/trace.d
|
||||||
|
|
||||||
|
### std
|
||||||
|
|
||||||
|
array.o : std/array.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/array.d
|
||||||
|
|
||||||
|
asserterror.o : std/asserterror.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/asserterror.d
|
||||||
|
|
||||||
|
base64.o : std/base64.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/base64.d
|
||||||
|
|
||||||
|
bind.o : std/bind.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/bind.d
|
||||||
|
|
||||||
|
bitarray.o : std/bitarray.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/bitarray.d
|
||||||
|
|
||||||
|
boxer.o : std/boxer.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/boxer.d
|
||||||
|
|
||||||
|
compiler.o : std/compiler.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/compiler.d
|
||||||
|
|
||||||
|
conv.o : std/conv.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/conv.d
|
||||||
|
|
||||||
|
cover.o : std/cover.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/cover.d
|
||||||
|
|
||||||
|
cpuid.o : std/cpuid.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/cpuid.d
|
||||||
|
|
||||||
|
cstream.o : std/cstream.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/cstream.d
|
||||||
|
|
||||||
|
ctype.o : std/ctype.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/ctype.d
|
||||||
|
|
||||||
|
date.o : std/dateparse.d std/date.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/date.d
|
||||||
|
|
||||||
|
dateparse.o : std/dateparse.d std/date.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/dateparse.d
|
||||||
|
|
||||||
|
demangle.o : std/demangle.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/demangle.d
|
||||||
|
|
||||||
|
file.o : std/file.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/file.d
|
||||||
|
|
||||||
|
format.o : std/format.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/format.d
|
||||||
|
|
||||||
|
gc.o : std/gc.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/gc.d
|
||||||
|
|
||||||
|
loader.o : std/loader.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/loader.d
|
||||||
|
|
||||||
|
math.o : std/math.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/math.d
|
||||||
|
|
||||||
|
math2.o : std/math2.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/math2.d
|
||||||
|
|
||||||
|
md5.o : std/md5.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/md5.d
|
||||||
|
|
||||||
|
metastrings.o : std/metastrings.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/metastrings.d
|
||||||
|
|
||||||
|
mmfile.o : std/mmfile.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/mmfile.d
|
||||||
|
|
||||||
|
moduleinit.o : std/moduleinit.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/moduleinit.d
|
||||||
|
|
||||||
|
openrj.o : std/openrj.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/openrj.d
|
||||||
|
|
||||||
|
outbuffer.o : std/outbuffer.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/outbuffer.d
|
||||||
|
|
||||||
|
outofmemory.o : std/outofmemory.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/outofmemory.d
|
||||||
|
|
||||||
|
path.o : std/path.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/path.d
|
||||||
|
|
||||||
|
perf.o : std/perf.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/perf.d
|
||||||
|
|
||||||
|
process.o : std/process.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/process.d
|
||||||
|
|
||||||
|
random.o : std/random.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/random.d
|
||||||
|
|
||||||
|
regexp.o : std/regexp.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/regexp.d
|
||||||
|
|
||||||
|
signals.o : std/signals.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/signals.d
|
||||||
|
|
||||||
|
socket.o : std/socket.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/socket.d
|
||||||
|
|
||||||
|
socketstream.o : std/socketstream.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/socketstream.d
|
||||||
|
|
||||||
|
stdio.o : std/stdio.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/stdio.d
|
||||||
|
|
||||||
|
stream.o : std/stream.d
|
||||||
|
$(DMD) -c $(DFLAGS) -d std/stream.d
|
||||||
|
|
||||||
|
string.o : std/string.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/string.d
|
||||||
|
|
||||||
|
switcherr.o : std/switcherr.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/switcherr.d
|
||||||
|
|
||||||
|
system.o : std/system.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/system.d
|
||||||
|
|
||||||
|
syserror.o : std/syserror.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/syserror.d
|
||||||
|
|
||||||
|
thread.o : std/thread.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/thread.d
|
||||||
|
|
||||||
|
traits.o : std/traits.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/traits.d
|
||||||
|
|
||||||
|
typetuple.o : std/typetuple.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typetuple.d
|
||||||
|
|
||||||
|
uri.o : std/uri.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/uri.d
|
||||||
|
|
||||||
|
uni.o : std/uni.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/uni.d
|
||||||
|
|
||||||
|
utf.o : std/utf.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/utf.d
|
||||||
|
|
||||||
|
Dzlib.o : std/zlib.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/zlib.d -ofDzlib.o
|
||||||
|
|
||||||
|
zip.o : std/zip.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/zip.d
|
||||||
|
|
||||||
|
### std/c
|
||||||
|
|
||||||
|
stdarg.o : std/c/stdarg.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/c/stdarg.d
|
||||||
|
|
||||||
|
Cstdio.o : std/c/stdio.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/c/stdio.d -ofCstdio.o
|
||||||
|
|
||||||
|
### std/c/solaris
|
||||||
|
|
||||||
|
solaris.o : std/c/solaris/solaris.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/c/solaris/solaris.d
|
||||||
|
|
||||||
|
solarissocket.o : std/c/solaris/socket.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/c/solaris/socket.d -ofsolarissocket.o
|
||||||
|
|
||||||
|
pthread.o : std/c/solaris/pthread.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/c/solaris/pthread.d
|
||||||
|
|
||||||
|
### std/c/linux
|
||||||
|
|
||||||
|
linux.o : std/c/linux/linux.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/c/linux/linux.d
|
||||||
|
|
||||||
|
### etc
|
||||||
|
|
||||||
|
### etc/c
|
||||||
|
|
||||||
|
Czlib.o : etc/c/zlib.d
|
||||||
|
$(DMD) -c $(DFLAGS) etc/c/zlib.d -ofCzlib.o
|
||||||
|
|
||||||
|
### std/typeinfo
|
||||||
|
|
||||||
|
ti_void.o : std/typeinfo/ti_void.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_void.d
|
||||||
|
|
||||||
|
ti_wchar.o : std/typeinfo/ti_wchar.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_wchar.d
|
||||||
|
|
||||||
|
ti_dchar.o : std/typeinfo/ti_dchar.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_dchar.d
|
||||||
|
|
||||||
|
ti_uint.o : std/typeinfo/ti_uint.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_uint.d
|
||||||
|
|
||||||
|
ti_short.o : std/typeinfo/ti_short.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_short.d
|
||||||
|
|
||||||
|
ti_ushort.o : std/typeinfo/ti_ushort.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_ushort.d
|
||||||
|
|
||||||
|
ti_byte.o : std/typeinfo/ti_byte.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_byte.d
|
||||||
|
|
||||||
|
ti_ubyte.o : std/typeinfo/ti_ubyte.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_ubyte.d
|
||||||
|
|
||||||
|
ti_long.o : std/typeinfo/ti_long.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_long.d
|
||||||
|
|
||||||
|
ti_ulong.o : std/typeinfo/ti_ulong.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_ulong.d
|
||||||
|
|
||||||
|
ti_ptr.o : std/typeinfo/ti_ptr.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_ptr.d
|
||||||
|
|
||||||
|
ti_float.o : std/typeinfo/ti_float.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_float.d
|
||||||
|
|
||||||
|
ti_double.o : std/typeinfo/ti_double.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_double.d
|
||||||
|
|
||||||
|
ti_real.o : std/typeinfo/ti_real.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_real.d
|
||||||
|
|
||||||
|
ti_delegate.o : std/typeinfo/ti_delegate.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_delegate.d
|
||||||
|
|
||||||
|
ti_creal.o : std/typeinfo/ti_creal.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_creal.d
|
||||||
|
|
||||||
|
ti_ireal.o : std/typeinfo/ti_ireal.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_ireal.d
|
||||||
|
|
||||||
|
ti_cfloat.o : std/typeinfo/ti_cfloat.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_cfloat.d
|
||||||
|
|
||||||
|
ti_ifloat.o : std/typeinfo/ti_ifloat.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_ifloat.d
|
||||||
|
|
||||||
|
ti_cdouble.o : std/typeinfo/ti_cdouble.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_cdouble.d
|
||||||
|
|
||||||
|
ti_idouble.o : std/typeinfo/ti_idouble.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_idouble.d
|
||||||
|
|
||||||
|
ti_AC.o : std/typeinfo/ti_AC.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_AC.d
|
||||||
|
|
||||||
|
ti_Ag.o : std/typeinfo/ti_Ag.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Ag.d
|
||||||
|
|
||||||
|
ti_Abit.o : std/typeinfo/ti_Abit.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Abit.d
|
||||||
|
|
||||||
|
ti_Ashort.o : std/typeinfo/ti_Ashort.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Ashort.d
|
||||||
|
|
||||||
|
ti_Aint.o : std/typeinfo/ti_Aint.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Aint.d
|
||||||
|
|
||||||
|
ti_Along.o : std/typeinfo/ti_Along.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Along.d
|
||||||
|
|
||||||
|
ti_Afloat.o : std/typeinfo/ti_Afloat.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Afloat.d
|
||||||
|
|
||||||
|
ti_Adouble.o : std/typeinfo/ti_Adouble.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Adouble.d
|
||||||
|
|
||||||
|
ti_Areal.o : std/typeinfo/ti_Areal.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Areal.d
|
||||||
|
|
||||||
|
ti_Acfloat.o : std/typeinfo/ti_Acfloat.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Acfloat.d
|
||||||
|
|
||||||
|
ti_Acdouble.o : std/typeinfo/ti_Acdouble.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Acdouble.d
|
||||||
|
|
||||||
|
ti_Acreal.o : std/typeinfo/ti_Acreal.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_Acreal.d
|
||||||
|
|
||||||
|
ti_C.o : std/typeinfo/ti_C.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_C.d
|
||||||
|
|
||||||
|
ti_char.o : std/typeinfo/ti_char.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_char.d
|
||||||
|
|
||||||
|
ti_int.o : std/typeinfo/ti_int.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_int.d
|
||||||
|
|
||||||
|
ti_bit.o : std/typeinfo/ti_bit.d
|
||||||
|
$(DMD) -c $(DFLAGS) std/typeinfo/ti_bit.d
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################
|
||||||
|
|
||||||
|
zip : $(ALLSRCS) $(MAKEFILES) phoboslicense.txt
|
||||||
|
$(RM) phobos.zip
|
||||||
|
zip phobos $(ALLSRCS) $(MAKEFILES) phoboslicense.txt
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(LIB) $(OBJS) unittest unittest.o
|
||||||
|
make -C ./internal/gc -f $(MAKEFILE) clean
|
||||||
|
make -C ./etc/c/zlib -f $(MAKEFILE) clean
|
||||||
|
|
42
std/c/fenv.d
42
std/c/fenv.d
|
@ -157,6 +157,48 @@ else version (FreeBSD)
|
||||||
|
|
||||||
alias ushort fexcept_t; /// Floating point status flags
|
alias ushort fexcept_t; /// Floating point status flags
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
/// Entire floating point environment
|
||||||
|
|
||||||
|
struct fenv_t
|
||||||
|
{
|
||||||
|
struct __fex_handler_t
|
||||||
|
{
|
||||||
|
int __mode;
|
||||||
|
void (*__handler)();
|
||||||
|
}
|
||||||
|
|
||||||
|
__fex_handler_t[12] __handlers;
|
||||||
|
uint __fsr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Default floating point environment
|
||||||
|
extern fenv_t __fenv_dfl_env;
|
||||||
|
|
||||||
|
fenv_t* FE_DFL_ENV = &__fenv_dfl_env;
|
||||||
|
|
||||||
|
alias int fexcept_t; /// Floating point status flags
|
||||||
|
|
||||||
|
int fetestexcept(int excepts); ///
|
||||||
|
int feraiseexcept(int excepts); ///
|
||||||
|
int feclearexcept(int excepts); ///
|
||||||
|
//int fegetexcept(fexcept_t *flagp,int excepts); ///
|
||||||
|
//int fesetexcept(fexcept_t *flagp,int excepts); ///
|
||||||
|
int fegetround(); ///
|
||||||
|
int fesetround(int round); ///
|
||||||
|
int fegetprec(); ///
|
||||||
|
int fesetprec(int prec); ///
|
||||||
|
int fegetenv(fenv_t *envp); ///
|
||||||
|
int fesetenv(fenv_t *envp); ///
|
||||||
|
//void feprocentry(fenv_t *envp); ///
|
||||||
|
//void feprocexit(const fenv_t *envp); ///
|
||||||
|
|
||||||
|
int fegetexceptflag(fexcept_t *flagp,int excepts); ///
|
||||||
|
int fesetexceptflag(fexcept_t *flagp,int excepts); ///
|
||||||
|
int feholdexcept(fenv_t *envp); ///
|
||||||
|
int feupdateenv(fenv_t *envp); ///
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
|
@ -12,6 +12,10 @@ version (FreeBSD)
|
||||||
{
|
{
|
||||||
public import std.c.freebsd.freebsd;
|
public import std.c.freebsd.freebsd;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
public import std.c.solaris.solaris;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
public import std.c.linux.linuxextern;
|
public import std.c.linux.linuxextern;
|
||||||
|
|
|
@ -9,6 +9,10 @@ version (FreeBSD)
|
||||||
{
|
{
|
||||||
public import std.c.freebsd.pthread;
|
public import std.c.freebsd.pthread;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
public import std.c.solaris.pthread;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,10 @@ version (FreeBSD)
|
||||||
{
|
{
|
||||||
public import std.c.freebsd.socket;
|
public import std.c.freebsd.socket;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
public import std.c.solaris.socket;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
21
std/c/posix/posix.d
Normal file
21
std/c/posix/posix.d
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
module std.c.posix.posix;
|
||||||
|
|
||||||
|
version (linux)
|
||||||
|
{
|
||||||
|
public import std.c.linux.linux;
|
||||||
|
}
|
||||||
|
else version (OSX)
|
||||||
|
{
|
||||||
|
// We really should separate osx out from linux
|
||||||
|
public import std.c.linux.linux;
|
||||||
|
}
|
||||||
|
version (FreeBSD)
|
||||||
|
{
|
||||||
|
public import std.c.freebsd.freebsd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static asssert(0);
|
||||||
|
}
|
||||||
|
|
21
std/c/posix/pthread.d
Normal file
21
std/c/posix/pthread.d
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
module std.c.posix.pthread;
|
||||||
|
|
||||||
|
version (linux)
|
||||||
|
{
|
||||||
|
public import std.c.linux.pthread;
|
||||||
|
}
|
||||||
|
else version (OSX)
|
||||||
|
{
|
||||||
|
// We really should separate osx out from linux
|
||||||
|
public import std.c.linux.pthread;
|
||||||
|
}
|
||||||
|
version (FreeBSD)
|
||||||
|
{
|
||||||
|
public import std.c.freebsd.pthread;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static asssert(0);
|
||||||
|
}
|
||||||
|
|
21
std/c/posix/socket.d
Normal file
21
std/c/posix/socket.d
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
module std.c.posix.socket;
|
||||||
|
|
||||||
|
version (linux)
|
||||||
|
{
|
||||||
|
public import std.c.linux.socket;
|
||||||
|
}
|
||||||
|
else version (OSX)
|
||||||
|
{
|
||||||
|
// We really should separate osx out from linux
|
||||||
|
public import std.c.linux.socket;
|
||||||
|
}
|
||||||
|
version (FreeBSD)
|
||||||
|
{
|
||||||
|
public import std.c.freebsd.socket;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static asssert(0);
|
||||||
|
}
|
||||||
|
|
188
std/c/solaris/pthread.d
Normal file
188
std/c/solaris/pthread.d
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
/* Written by Walter Bright
|
||||||
|
* http://www.digitalmars.com
|
||||||
|
* Placed into public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module std.c.solaris.pthread;
|
||||||
|
|
||||||
|
version (Solaris) { } else { static assert(0); }
|
||||||
|
|
||||||
|
import std.c.solaris.solaris;
|
||||||
|
|
||||||
|
extern (C):
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PTHREAD_DESTRUCTOR_ITERATIONS = 4,
|
||||||
|
PTHREAD_KEYS_MAX = 128,
|
||||||
|
PTHREAD_STACK_MIN = 4096,
|
||||||
|
// TODO: Should this be unit.max?
|
||||||
|
PTHREAD_THREADS_MAX = 64,
|
||||||
|
PTHREAD_BARRIER_SERIAL_THREAD = -2
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PTHREAD_DETACHED = 0x40,
|
||||||
|
PTHREAD_SCOPE_SYSTEM = 0x01,
|
||||||
|
PTHREAD_INHERIT_SCHED = 0x01,
|
||||||
|
PTHREAD_CREATE_DETACHED = PTHREAD_DETACHED,
|
||||||
|
PTHREAD_CREATE_JOINABLE = 0,
|
||||||
|
PTHREAD_SCOPE_PROCESS = 0,
|
||||||
|
PTHREAD_EXPLICIT_SCHED = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PTHREAD_PROCESS_PRIVATE = 0,
|
||||||
|
PTHREAD_PROCESS_SHARED = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PTHREAD_CANCEL_ENABLE = 0,
|
||||||
|
PTHREAD_CANCEL_DISABLE = 1,
|
||||||
|
PTHREAD_CANCEL_DEFERRED = 0,
|
||||||
|
PTHREAD_CANCEL_ASYNCHRONOUS = 2,
|
||||||
|
PTHREAD_CANCELED = cast(void*)-19
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PTHREAD_PRIO_NONE = 0x0,
|
||||||
|
PTHREAD_PRIO_INHERIT = 0x10,
|
||||||
|
PTHREAD_PRIO_PROTECT = 0x20
|
||||||
|
}
|
||||||
|
|
||||||
|
enum pthread_mutextype
|
||||||
|
{
|
||||||
|
PTHREAD_MUTEX_ERRORCHECK = 2,
|
||||||
|
PTHREAD_MUTEX_RECURSIVE = 4,
|
||||||
|
PTHREAD_MUTEX_NORMAL = 0,
|
||||||
|
PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void* pthread_t;
|
||||||
|
typedef void* pthread_attr_t;
|
||||||
|
typedef void* pthread_mutex_t;
|
||||||
|
typedef void* pthread_mutexattr_t;
|
||||||
|
typedef void* pthread_cond_t;
|
||||||
|
typedef void* pthread_condattr_t;
|
||||||
|
typedef uint pthread_key_t;
|
||||||
|
typedef void* pthread_rwlock_t;
|
||||||
|
typedef void* pthread_rwlockattr_t;
|
||||||
|
typedef void* pthread_barrier_t;
|
||||||
|
typedef void* pthread_barrierattr_t;
|
||||||
|
typedef void* pthread_spinlock_t;
|
||||||
|
typedef void* pthread_addr_t;
|
||||||
|
|
||||||
|
alias void* function(void*) pthread_startroutine_t;
|
||||||
|
|
||||||
|
struct pthread_once_t
|
||||||
|
{
|
||||||
|
ulong[4] __pthread_once_pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_atfork(void function(), void function(), void function());
|
||||||
|
int pthread_attr_destroy(pthread_attr_t*);
|
||||||
|
int pthread_attr_getdetachstate(in pthread_attr_t*, int*);
|
||||||
|
int pthread_attr_getguardsize(in pthread_attr_t*, size_t*);
|
||||||
|
int pthread_attr_getinheritsched(in pthread_attr_t*, int*);
|
||||||
|
int pthread_attr_getschedparam(in pthread_attr_t*, sched_param*);
|
||||||
|
int pthread_attr_getschedpolicy(in pthread_attr_t*, int*);
|
||||||
|
int pthread_attr_getscope(in pthread_attr_t*, int*);
|
||||||
|
int pthread_attr_getstack(in pthread_attr_t*, void**, size_t*);
|
||||||
|
int pthread_attr_getstackaddr(in pthread_attr_t*, void**);
|
||||||
|
int pthread_attr_getstacksize(in pthread_attr_t*, size_t*);
|
||||||
|
int pthread_attr_init(pthread_attr_t*);
|
||||||
|
int pthread_attr_setdetachstate(pthread_attr_t*, int);
|
||||||
|
int pthread_attr_setguardsize(pthread_attr_t*, size_t);
|
||||||
|
int pthread_attr_setinheritsched(pthread_attr_t*, int);
|
||||||
|
int pthread_attr_setschedparam(pthread_attr_t*, in sched_param*);
|
||||||
|
int pthread_attr_setschedpolicy(pthread_attr_t*, int);
|
||||||
|
int pthread_attr_setscope(pthread_attr_t*, int);
|
||||||
|
int pthread_attr_setstack(pthread_attr_t*, void*, size_t);
|
||||||
|
int pthread_attr_setstackaddr(pthread_attr_t*, void*);
|
||||||
|
int pthread_attr_setstacksize(pthread_attr_t*, size_t);
|
||||||
|
int pthread_barrier_destroy(pthread_barrier_t*);
|
||||||
|
int pthread_barrier_init(pthread_barrier_t*, in pthread_barrierattr_t*, uint);
|
||||||
|
int pthread_barrier_wait(pthread_barrier_t*);
|
||||||
|
int pthread_barrierattr_destroy(pthread_barrierattr_t*);
|
||||||
|
int pthread_barrierattr_getpshared(in pthread_barrierattr_t*, int*);
|
||||||
|
int pthread_barrierattr_init(pthread_barrierattr_t*);
|
||||||
|
int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
|
||||||
|
int pthread_cancel(pthread_t);
|
||||||
|
int pthread_cond_broadcast(pthread_cond_t*);
|
||||||
|
int pthread_cond_destroy(pthread_cond_t*);
|
||||||
|
int pthread_cond_init(pthread_cond_t*, in pthread_condattr_t*);
|
||||||
|
int pthread_cond_signal(pthread_cond_t*);
|
||||||
|
int pthread_cond_timedwait(pthread_cond_t*, pthread_mutex_t*, in timespec*);
|
||||||
|
int pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*);
|
||||||
|
int pthread_condattr_destroy(pthread_condattr_t*);
|
||||||
|
int pthread_condattr_getclock(in pthread_condattr_t*, clockid_t*);
|
||||||
|
int pthread_condattr_getpshared(in pthread_condattr_t*, int*);
|
||||||
|
int pthread_condattr_init(pthread_condattr_t*);
|
||||||
|
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
|
||||||
|
int pthread_condattr_setpshared(pthread_condattr_t*, int);
|
||||||
|
int pthread_create(pthread_t*, in pthread_attr_t*, void* function(void*), void*);
|
||||||
|
int pthread_detach(pthread_t);
|
||||||
|
int pthread_equal(pthread_t, pthread_t);
|
||||||
|
int pthread_getconcurrency();
|
||||||
|
int pthread_getprio(pthread_t);
|
||||||
|
int pthread_getschedparam(pthread_t pthread, int*, sched_param*);
|
||||||
|
int pthread_join(pthread_t, void**);
|
||||||
|
int pthread_key_create(pthread_key_t*, void function(void*));
|
||||||
|
int pthread_key_delete(pthread_key_t);
|
||||||
|
int pthread_kill(pthread_t, int);
|
||||||
|
int pthread_mutex_destroy(pthread_mutex_t*);
|
||||||
|
int pthread_mutex_getprioceiling(pthread_mutex_t*, int*);
|
||||||
|
int pthread_mutex_init(pthread_mutex_t*, in pthread_mutexattr_t*);
|
||||||
|
int pthread_mutex_lock(pthread_mutex_t*);
|
||||||
|
int pthread_mutex_setprioceiling(pthread_mutex_t*, int, int*);
|
||||||
|
int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*);
|
||||||
|
int pthread_mutex_trylock(pthread_mutex_t*);
|
||||||
|
int pthread_mutex_unlock(pthread_mutex_t*);
|
||||||
|
int pthread_mutexattr_destroy(pthread_mutexattr_t*);
|
||||||
|
int pthread_mutexattr_getprioceiling(pthread_mutexattr_t*, int*);
|
||||||
|
int pthread_mutexattr_getprotocol(pthread_mutexattr_t*, int*);
|
||||||
|
int pthread_mutexattr_getpshared(in pthread_mutexattr_t*, int*);
|
||||||
|
int pthread_mutexattr_gettype(pthread_mutexattr_t*, int*);
|
||||||
|
int pthread_mutexattr_init(pthread_mutexattr_t*);
|
||||||
|
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t*, int);
|
||||||
|
int pthread_mutexattr_setprotocol(pthread_mutexattr_t*, int);
|
||||||
|
int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
|
||||||
|
int pthread_mutexattr_settype(pthread_mutexattr_t*, int);
|
||||||
|
int pthread_once(pthread_once_t*, void function());
|
||||||
|
int pthread_rwlock_destroy(pthread_rwlock_t*);
|
||||||
|
int pthread_rwlock_init(pthread_rwlock_t*, in pthread_rwlockattr_t*);
|
||||||
|
int pthread_rwlock_rdlock(pthread_rwlock_t*);
|
||||||
|
int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*);
|
||||||
|
int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*);
|
||||||
|
int pthread_rwlock_tryrdlock(pthread_rwlock_t*);
|
||||||
|
int pthread_rwlock_trywrlock(pthread_rwlock_t*);
|
||||||
|
int pthread_rwlock_unlock(pthread_rwlock_t*);
|
||||||
|
int pthread_rwlock_wrlock(pthread_rwlock_t*);
|
||||||
|
int pthread_rwlockattr_destroy(pthread_rwlockattr_t*);
|
||||||
|
int pthread_rwlockattr_getpshared(in pthread_rwlockattr_t*, int*);
|
||||||
|
int pthread_rwlockattr_init(pthread_rwlockattr_t*);
|
||||||
|
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
|
||||||
|
int pthread_setcancelstate(int, int*);
|
||||||
|
int pthread_setcanceltype(int, int*);
|
||||||
|
int pthread_setconcurrency(int);
|
||||||
|
int pthread_setprio(pthread_t, int);
|
||||||
|
int pthread_setschedparam(pthread_t, int, in sched_param*);
|
||||||
|
int pthread_setspecific(pthread_key_t, in void*);
|
||||||
|
int pthread_sigmask(int, in __sigset_t*, __sigset_t*);
|
||||||
|
int pthread_spin_destroy(pthread_spinlock_t*);
|
||||||
|
int pthread_spin_init(pthread_spinlock_t*, int);
|
||||||
|
int pthread_spin_lock(pthread_spinlock_t*);
|
||||||
|
int pthread_spin_trylock(pthread_spinlock_t*);
|
||||||
|
int pthread_spin_unlock(pthread_spinlock_t*);
|
||||||
|
pthread_t pthread_self();
|
||||||
|
void pthread_cleanup_pop(int);
|
||||||
|
void pthread_cleanup_push(void function(void*), void*);
|
||||||
|
void pthread_exit(void*);
|
||||||
|
void pthread_testcancel();
|
||||||
|
void pthread_yield();
|
||||||
|
void* pthread_getspecific(pthread_key_t);
|
||||||
|
|
386
std/c/solaris/socket.d
Normal file
386
std/c/solaris/socket.d
Normal file
|
@ -0,0 +1,386 @@
|
||||||
|
/*
|
||||||
|
Written by Christopher E. Miller
|
||||||
|
Placed into public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
module std.c.solaris.socket;
|
||||||
|
|
||||||
|
private import std.stdint;
|
||||||
|
private import std.c.solaris.solaris;
|
||||||
|
|
||||||
|
version (Solaris) { } else { static assert(0); }
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
alias uint socklen_t;
|
||||||
|
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
AF_UNSPEC = 0,
|
||||||
|
AF_UNIX = 1,
|
||||||
|
AF_INET = 2,
|
||||||
|
AF_IPX = 23,
|
||||||
|
AF_APPLETALK = 16,
|
||||||
|
AF_INET6 = 26,
|
||||||
|
// ...
|
||||||
|
|
||||||
|
PF_UNSPEC = AF_UNSPEC,
|
||||||
|
PF_UNIX = AF_UNIX,
|
||||||
|
PF_INET = AF_INET,
|
||||||
|
PF_IPX = AF_IPX,
|
||||||
|
PF_APPLETALK = AF_APPLETALK,
|
||||||
|
PF_INET6 = AF_INET6,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
SOL_SOCKET = 0xFFFF,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
SO_DEBUG = 1,
|
||||||
|
SO_BROADCAST = 0x20,
|
||||||
|
SO_REUSEADDR = 4,
|
||||||
|
SO_LINGER = 0x80,
|
||||||
|
//SO_DONTLINGER = ~SO_LINGER,
|
||||||
|
SO_OOBINLINE = 0x100,
|
||||||
|
SO_SNDBUF = 0x1001,
|
||||||
|
SO_RCVBUF = 0x1002,
|
||||||
|
SO_ACCEPTCONN = 2,
|
||||||
|
SO_DONTROUTE = 0x10,
|
||||||
|
SO_TYPE = 0x1008,
|
||||||
|
|
||||||
|
// netinet/tcp.h
|
||||||
|
TCP_NODELAY = 1,
|
||||||
|
|
||||||
|
// netinet/in.h
|
||||||
|
IP_MULTICAST_LOOP = 0x12,
|
||||||
|
IP_ADD_MEMBERSHIP = 0x13,
|
||||||
|
IP_DROP_MEMBERSHIP = 0x14,
|
||||||
|
|
||||||
|
// netinet6/in6.h
|
||||||
|
//IPV6_ADDRFORM = 1,
|
||||||
|
IPV6_PKTINFO = 0xb,
|
||||||
|
IPV6_HOPOPTS = 0xe,
|
||||||
|
IPV6_DSTOPTS = 0xf,
|
||||||
|
IPV6_RTHDR = 0x10,
|
||||||
|
IPV6_CHECKSUM = 0x18,
|
||||||
|
IPV6_HOPLIMIT = 0xc,
|
||||||
|
IPV6_NEXTHOP = 0xd,
|
||||||
|
//IPV6_AUTHHDR = 10,
|
||||||
|
IPV6_UNICAST_HOPS = 0x5,
|
||||||
|
IPV6_MULTICAST_IF = 0x6,
|
||||||
|
IPV6_MULTICAST_HOPS = 0x7,
|
||||||
|
IPV6_MULTICAST_LOOP = 0x8,
|
||||||
|
IPV6_JOIN_GROUP = 0x9,
|
||||||
|
IPV6_LEAVE_GROUP = 0xa,
|
||||||
|
//IPV6_ROUTER_ALERT = 22,
|
||||||
|
//IPV6_MTU_DISCOVER = 23,
|
||||||
|
//IPV6_MTU = 24,
|
||||||
|
//IPV6_RECVERR = 25,
|
||||||
|
IPV6_V6ONLY = 0x27,
|
||||||
|
//IPV6_JOIN_ANYCAST = 27,
|
||||||
|
//IPV6_LEAVE_ANYCAST = 28,
|
||||||
|
//IPV6_IPSEC_POLICY = 28,
|
||||||
|
//IPV6_XFRM_POLICY = 35,
|
||||||
|
}
|
||||||
|
|
||||||
|
// sys/socket.h
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
MSG_OOB = 0x1,
|
||||||
|
MSG_PEEK = 0x2,
|
||||||
|
MSG_DONTROUTE = 0x4,
|
||||||
|
// Bug: Not supported on Solaris, but std.socket uses it in spades.
|
||||||
|
MSG_NOSIGNAL = 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
SHUT_RD = 0,
|
||||||
|
SHUT_WR = 1,
|
||||||
|
SHUT_RDWR = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum: int // Not defined on Solaris, but that's okay.
|
||||||
|
{
|
||||||
|
SD_RECEIVE = SHUT_RD,
|
||||||
|
SD_SEND = SHUT_WR,
|
||||||
|
SD_BOTH = SHUT_RDWR,
|
||||||
|
}
|
||||||
|
|
||||||
|
alias ushort sa_family_t;
|
||||||
|
struct sockaddr
|
||||||
|
{
|
||||||
|
sa_family_t sa_family;
|
||||||
|
ubyte[14] sa_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
alias uint in_addr_t;
|
||||||
|
alias ushort in_port_t;
|
||||||
|
|
||||||
|
// netinet/in.h
|
||||||
|
struct sockaddr_in
|
||||||
|
{
|
||||||
|
sa_family_t sin_family;
|
||||||
|
in_port_t sin_port;
|
||||||
|
in_addr sin_addr;
|
||||||
|
ubyte[8] sin_zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
// netinet6/in6.h
|
||||||
|
struct sockaddr_in6
|
||||||
|
{
|
||||||
|
sa_family_t sin6_family;
|
||||||
|
in_port_t sin6_port;
|
||||||
|
uint sin6_flowinfo;
|
||||||
|
in6_addr sin6_addr;
|
||||||
|
uint sin6_scope_id;
|
||||||
|
uint __sin6_src_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// netdb.h
|
||||||
|
struct addrinfo
|
||||||
|
{
|
||||||
|
int ai_flags;
|
||||||
|
int ai_family;
|
||||||
|
int ai_socktype;
|
||||||
|
int ai_protocol;
|
||||||
|
socklen_t ai_addrlen;
|
||||||
|
char* ai_canonname;
|
||||||
|
sockaddr* ai_addr;
|
||||||
|
addrinfo* ai_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fcntl.h
|
||||||
|
const int F_GETFL = 3;
|
||||||
|
const int F_SETFL = 4;
|
||||||
|
|
||||||
|
int socket(int af, int type, int protocol);
|
||||||
|
int bind(int s, /*const*/ sockaddr* name, int namelen);
|
||||||
|
int connect(int s, /*const*/ sockaddr* name, int namelen);
|
||||||
|
int listen(int s, int backlog);
|
||||||
|
int accept(int s, sockaddr* addr, int* addrlen);
|
||||||
|
int shutdown(int s, int how);
|
||||||
|
int getpeername(int s, sockaddr* name, int* namelen);
|
||||||
|
int getsockname(int s, sockaddr* name, int* namelen);
|
||||||
|
int send(int s, void* buf, int len, int flags);
|
||||||
|
int sendto(int s, void* buf, int len, int flags, sockaddr* to, int tolen);
|
||||||
|
int recv(int s, void* buf, int len, int flags);
|
||||||
|
int recvfrom(int s, void* buf, int len, int flags, sockaddr* from, int* fromlen);
|
||||||
|
int getsockopt(int s, int level, int optname, void* optval, int* optlen);
|
||||||
|
int setsockopt(int s, int level, int optname, void* optval, int optlen);
|
||||||
|
uint inet_addr(char* cp);
|
||||||
|
char* inet_ntoa(in_addr);
|
||||||
|
hostent* gethostbyname(char* name);
|
||||||
|
int gethostbyname_r(char* name, hostent* ret, void* buf, size_t buflen, hostent** result, int* h_errnop);
|
||||||
|
hostent* gethostbyaddr(void* addr, int len, int type);
|
||||||
|
protoent* getprotobyname(char* name);
|
||||||
|
protoent* getprotobynumber(int number);
|
||||||
|
servent* getservbyname(char* name, char* proto);
|
||||||
|
servent* getservbyport(int port, char* proto);
|
||||||
|
int gethostname(char* name, int namelen);
|
||||||
|
int getaddrinfo(char* nodename, char* servname, addrinfo* hints, addrinfo** res);
|
||||||
|
void freeaddrinfo(addrinfo* ai);
|
||||||
|
int getnameinfo(sockaddr* sa, socklen_t salen, char* node, socklen_t nodelen, char* service, socklen_t servicelen, int flags);
|
||||||
|
|
||||||
|
|
||||||
|
struct linger
|
||||||
|
{
|
||||||
|
int l_onoff;
|
||||||
|
int l_linger;
|
||||||
|
}
|
||||||
|
|
||||||
|
// netdb.h
|
||||||
|
struct protoent
|
||||||
|
{
|
||||||
|
char* p_name;
|
||||||
|
char** p_aliases;
|
||||||
|
int p_proto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// netdb.h
|
||||||
|
struct servent
|
||||||
|
{
|
||||||
|
char* s_name;
|
||||||
|
char** s_aliases;
|
||||||
|
int s_port;
|
||||||
|
char* s_proto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
version(BigEndian)
|
||||||
|
{
|
||||||
|
ushort htons(ushort x)
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint htonl(uint x)
|
||||||
|
{
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else version(LittleEndian)
|
||||||
|
{
|
||||||
|
private import std.intrinsic;
|
||||||
|
|
||||||
|
|
||||||
|
ushort htons(ushort x)
|
||||||
|
{
|
||||||
|
return cast(ushort)((x >> 8) | (x << 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint htonl(uint x)
|
||||||
|
{
|
||||||
|
return bswap(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ushort ntohs(ushort x)
|
||||||
|
{
|
||||||
|
return htons(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint ntohl(uint x)
|
||||||
|
{
|
||||||
|
return htonl(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
SOCK_STREAM = 2,
|
||||||
|
SOCK_DGRAM = 1,
|
||||||
|
SOCK_RAW = 4,
|
||||||
|
SOCK_RDM = 5,
|
||||||
|
SOCK_SEQPACKET = 6,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// netinet/in.h
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
IPPROTO_IP = 0,
|
||||||
|
IPPROTO_ICMP = 1,
|
||||||
|
IPPROTO_IGMP = 2,
|
||||||
|
IPPROTO_GGP = 3,
|
||||||
|
IPPROTO_TCP = 6,
|
||||||
|
IPPROTO_PUP = 12,
|
||||||
|
IPPROTO_UDP = 17,
|
||||||
|
IPPROTO_IDP = 22,
|
||||||
|
IPPROTO_IPV6 = 41,
|
||||||
|
IPPROTO_ND = 77,
|
||||||
|
IPPROTO_RAW = 255,
|
||||||
|
|
||||||
|
IPPROTO_MAX = 256,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum: uint
|
||||||
|
{
|
||||||
|
INADDR_ANY = 0,
|
||||||
|
INADDR_LOOPBACK = 0x7F000001,
|
||||||
|
INADDR_BROADCAST = 0xFFFFFFFF,
|
||||||
|
INADDR_NONE = 0xFFFFFFFF,
|
||||||
|
ADDR_ANY = INADDR_ANY,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// netdb.h
|
||||||
|
enum: int
|
||||||
|
{
|
||||||
|
AI_PASSIVE = 0x8,
|
||||||
|
AI_CANONNAME = 0x10,
|
||||||
|
AI_NUMERICHOST = 0x20,
|
||||||
|
AI_NUMERICSERV = 0x40,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
union in_addr
|
||||||
|
{
|
||||||
|
private union _S_un_t
|
||||||
|
{
|
||||||
|
private struct _S_un_b_t
|
||||||
|
{
|
||||||
|
uint8_t s_b1, s_b2, s_b3, s_b4;
|
||||||
|
}
|
||||||
|
_S_un_b_t S_un_b;
|
||||||
|
|
||||||
|
private struct _S_un_w_t
|
||||||
|
{
|
||||||
|
ushort s_w1, s_w2;
|
||||||
|
}
|
||||||
|
_S_un_w_t S_un_w;
|
||||||
|
|
||||||
|
uint S_addr;
|
||||||
|
}
|
||||||
|
_S_un_t S_un;
|
||||||
|
|
||||||
|
uint s_addr;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint8_t s_net, s_host;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
ushort s_imp;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint8_t s_lh, s_impno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
union in6_addr
|
||||||
|
{
|
||||||
|
private union _in6_u_t
|
||||||
|
{
|
||||||
|
uint8_t[16] u6_addr8;
|
||||||
|
ushort[8] u6_addr16;
|
||||||
|
uint[4] u6_addr32;
|
||||||
|
}
|
||||||
|
_in6_u_t in6_u;
|
||||||
|
|
||||||
|
uint8_t[16] s6_addr8;
|
||||||
|
ushort[8] s6_addr16;
|
||||||
|
uint[4] s6_addr32;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const in6_addr IN6ADDR_ANY = { s6_addr8: [0] };
|
||||||
|
const in6_addr IN6ADDR_LOOPBACK = { s6_addr8: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] };
|
||||||
|
//alias IN6ADDR_ANY IN6ADDR_ANY_INIT;
|
||||||
|
//alias IN6ADDR_LOOPBACK IN6ADDR_LOOPBACK_INIT;
|
||||||
|
|
||||||
|
const uint INET_ADDRSTRLEN = 16;
|
||||||
|
const uint INET6_ADDRSTRLEN = 46;
|
||||||
|
|
||||||
|
// netdb.h
|
||||||
|
struct hostent
|
||||||
|
{
|
||||||
|
char* h_name;
|
||||||
|
char** h_aliases;
|
||||||
|
int h_addrtype;
|
||||||
|
int h_length;
|
||||||
|
char** h_addr_list;
|
||||||
|
|
||||||
|
char* h_addr()
|
||||||
|
{
|
||||||
|
return h_addr_list[0];
|
||||||
|
}
|
||||||
|
}
|
573
std/c/solaris/solaris.d
Normal file
573
std/c/solaris/solaris.d
Normal file
|
@ -0,0 +1,573 @@
|
||||||
|
|
||||||
|
/* Written by Walter Bright, Christopher E. Miller, and many others.
|
||||||
|
* http://www.digitalmars.com/d/
|
||||||
|
* Placed into public domain.
|
||||||
|
* Solaris(R) is the registered trademark of Sun Microsystems, Inc. in the U.S. and other
|
||||||
|
* countries.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module std.c.solaris.solaris;
|
||||||
|
|
||||||
|
version (Solaris) { } else { static assert(0); }
|
||||||
|
|
||||||
|
public import std.c.solaris.pthread;
|
||||||
|
|
||||||
|
private import std.c.stdio;
|
||||||
|
|
||||||
|
// Many of these are different sizes on 64-bit.
|
||||||
|
alias int __time_t;
|
||||||
|
alias int pid_t;
|
||||||
|
alias int off_t;
|
||||||
|
alias uint mode_t;
|
||||||
|
alias int clockid_t;
|
||||||
|
|
||||||
|
alias uint uid_t;
|
||||||
|
alias uint gid_t;
|
||||||
|
|
||||||
|
struct timespec
|
||||||
|
{
|
||||||
|
__time_t tv_sec; /* seconds */
|
||||||
|
int tv_nsec; /* nanosecs. */
|
||||||
|
}
|
||||||
|
|
||||||
|
static if (size_t.sizeof == 4)
|
||||||
|
alias int ssize_t;
|
||||||
|
else
|
||||||
|
alias long ssize_t;
|
||||||
|
|
||||||
|
enum : int
|
||||||
|
{
|
||||||
|
SIGHUP = 1,
|
||||||
|
SIGINT = 2,
|
||||||
|
SIGQUIT = 3,
|
||||||
|
SIGILL = 4,
|
||||||
|
SIGTRAP = 5,
|
||||||
|
SIGABRT = 6,
|
||||||
|
SIGIOT = 6,
|
||||||
|
SIGEMT = 7,
|
||||||
|
SIGFPE = 8,
|
||||||
|
SIGKILL = 9,
|
||||||
|
SIGBUS = 10,
|
||||||
|
SIGSEGV = 11,
|
||||||
|
SIGSYS = 12,
|
||||||
|
SIGPIPE = 13,
|
||||||
|
SIGALRM = 14,
|
||||||
|
SIGTERM = 15,
|
||||||
|
SIGUSR1 = 16,
|
||||||
|
SIGUSR2 = 17,
|
||||||
|
SIGCLD = 18,
|
||||||
|
SIGCHLD = 18,
|
||||||
|
SIGPWR = 19,
|
||||||
|
SIGWINCH = 20,
|
||||||
|
SIGURG = 21,
|
||||||
|
SIGPOLL = 22,
|
||||||
|
SIGIO = 22,
|
||||||
|
SIGSTOP = 23,
|
||||||
|
SIGTSTP = 24,
|
||||||
|
SIGCONT = 25,
|
||||||
|
SIGTTIN = 26,
|
||||||
|
SIGTTOU = 27,
|
||||||
|
SIGVTALRM = 28,
|
||||||
|
SIGPROF = 29,
|
||||||
|
SIGXCPU = 30,
|
||||||
|
SIGXFSZ = 31,
|
||||||
|
SIGWAITING = 32,
|
||||||
|
SIGLWP = 33,
|
||||||
|
SIGFREEZE = 34,
|
||||||
|
SIGTHAW = 35,
|
||||||
|
SIGCANCEL = 36,
|
||||||
|
SIGLOST = 37,
|
||||||
|
SIGXRES = 38,
|
||||||
|
SIGJVM1 = 39,
|
||||||
|
SIGJVM2 = 40,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
O_RDONLY = 0,
|
||||||
|
O_WRONLY = 1,
|
||||||
|
O_RDWR = 2,
|
||||||
|
O_CREAT = 0x100,
|
||||||
|
O_EXCL = 0x400,
|
||||||
|
O_TRUNC = 0x200,
|
||||||
|
O_APPEND = 0x08,
|
||||||
|
O_NONBLOCK = 0x80,
|
||||||
|
O_NDELAY = 0x04,
|
||||||
|
O_SYNC = 0x10,
|
||||||
|
O_DSYNC = 0x40,
|
||||||
|
O_RSYNC = 0x8000,
|
||||||
|
O_NOCTTY = 0x800,
|
||||||
|
O_XATTR = 0x4000,
|
||||||
|
O_NOFOLLOW = 0x20000,
|
||||||
|
O_NOLINKS = 0x40000,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct struct_stat // distinguish it from the stat() function
|
||||||
|
{
|
||||||
|
ulong st_dev; /// device
|
||||||
|
ulong st_ino; /// file serial number
|
||||||
|
uint st_mode; /// file mode
|
||||||
|
uint st_nlink; /// link count
|
||||||
|
uint st_uid; /// user ID of file's owner
|
||||||
|
uint st_gid; /// user ID of group's owner
|
||||||
|
ulong st_rdev; /// if device then device number
|
||||||
|
int st_size; /// file size in bytes
|
||||||
|
int st_atime;
|
||||||
|
int st_atimensec;
|
||||||
|
int st_mtime;
|
||||||
|
int st_mtimensec;
|
||||||
|
int st_ctime;
|
||||||
|
int st_ctimensec;
|
||||||
|
int st_blksize; /// optimal I/O block size
|
||||||
|
long st_blocks; /// number of allocated 512 byte blocks
|
||||||
|
|
||||||
|
char[16] st_fstype;
|
||||||
|
}
|
||||||
|
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
version (Solaris) assert(struct_stat.sizeof == 136);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum : int
|
||||||
|
{
|
||||||
|
S_IFMT = 0xF000,
|
||||||
|
S_IAMB = 0x1FF,
|
||||||
|
|
||||||
|
S_IFIFO = 0x1000,
|
||||||
|
S_IFCHR = 0x2000,
|
||||||
|
S_IFDIR = 0x4000,
|
||||||
|
S_IFBLK = 0x6000,
|
||||||
|
S_IFREG = 0x8000,
|
||||||
|
S_IFLNK = 0xA000,
|
||||||
|
S_IFSOCK = 0xC000,
|
||||||
|
|
||||||
|
S_IFDOOR = 0xD000,
|
||||||
|
S_IFPORT = 0xE000,
|
||||||
|
S_ISUID = 0x800,
|
||||||
|
S_ISGID = 0x400,
|
||||||
|
S_ISVTX = 0x200,
|
||||||
|
|
||||||
|
S_IREAD = 00400,
|
||||||
|
S_IWRITE = 00200,
|
||||||
|
S_IEXEC = 00100,
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
int access(in char*, int);
|
||||||
|
int open(in char*, int, ...);
|
||||||
|
int read(int, void*, int);
|
||||||
|
int write(int, in void*, int);
|
||||||
|
int close(int);
|
||||||
|
int lseek(int, off_t, int);
|
||||||
|
int fstat(int, struct_stat*);
|
||||||
|
int lstat(in char*, struct_stat*);
|
||||||
|
int stat(in char*, struct_stat*);
|
||||||
|
int chdir(in char*);
|
||||||
|
int mkdir(in char*, int);
|
||||||
|
int rmdir(in char*);
|
||||||
|
char* getcwd(char*, int);
|
||||||
|
int chmod(in char*, mode_t);
|
||||||
|
int fork();
|
||||||
|
int dup(int);
|
||||||
|
int dup2(int, int);
|
||||||
|
int pipe(int[2]);
|
||||||
|
pid_t wait(int*);
|
||||||
|
int waitpid(pid_t, int*, int);
|
||||||
|
|
||||||
|
uint alarm(uint);
|
||||||
|
char* basename(char*);
|
||||||
|
//wint_t btowc(int);
|
||||||
|
int chown(in char*, uid_t, gid_t);
|
||||||
|
int chroot(in char*);
|
||||||
|
size_t confstr(int, char*, size_t);
|
||||||
|
int creat(in char*, mode_t);
|
||||||
|
char* ctermid(char*);
|
||||||
|
int dirfd(DIR*);
|
||||||
|
char* dirname(char*);
|
||||||
|
int fattach(int, char*);
|
||||||
|
int fchmod(int, mode_t);
|
||||||
|
int fdatasync(int);
|
||||||
|
int ffs(int);
|
||||||
|
int fmtmsg(int, char*, int, char*, char*, char*);
|
||||||
|
int fpathconf(int, int);
|
||||||
|
int fseeko(FILE*, off_t, int);
|
||||||
|
off_t ftello(FILE*);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct timeval
|
||||||
|
{
|
||||||
|
int tv_sec;
|
||||||
|
int tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct struct_timezone
|
||||||
|
{
|
||||||
|
int tz_minuteswest;
|
||||||
|
int tz_dstime;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tm
|
||||||
|
{
|
||||||
|
int tm_sec;
|
||||||
|
int tm_min;
|
||||||
|
int tm_hour;
|
||||||
|
int tm_mday;
|
||||||
|
int tm_mon;
|
||||||
|
int tm_year;
|
||||||
|
int tm_wday;
|
||||||
|
int tm_yday;
|
||||||
|
int tm_isdst;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
int gettimeofday(timeval*, struct_timezone*);
|
||||||
|
int settimeofday(in timeval*, in struct_timezone*);
|
||||||
|
__time_t time(__time_t*);
|
||||||
|
char* asctime(in tm*);
|
||||||
|
char* ctime(in __time_t*);
|
||||||
|
tm* gmtime(in __time_t*);
|
||||||
|
tm* localtime(in __time_t*);
|
||||||
|
__time_t mktime(tm*);
|
||||||
|
char* asctime_r(in tm* t, char* buf);
|
||||||
|
char* ctime_r(in __time_t* timep, char* buf);
|
||||||
|
tm* gmtime_r(in __time_t* timep, tm* result);
|
||||||
|
tm* localtime_r(in __time_t* timep, tm* result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************/
|
||||||
|
// Memory mapping from <sys/mman.h> and <bits/mman.h>
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROT_NONE = 0,
|
||||||
|
PROT_READ = 1,
|
||||||
|
PROT_WRITE = 2,
|
||||||
|
PROT_EXEC = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Memory mapping sharing types
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ MAP_SHARED = 1,
|
||||||
|
MAP_PRIVATE = 2,
|
||||||
|
MAP_TYPE = 0x0F,
|
||||||
|
MAP_FIXED = 0x10,
|
||||||
|
// MAP_FILE is not in mmap.h on Solaris, but is supposed to work.
|
||||||
|
MAP_FILE = 0,
|
||||||
|
MAP_ANONYMOUS = 0x100,
|
||||||
|
MAP_ANON = 0x100,
|
||||||
|
MAP_ALIGN = 0x200,
|
||||||
|
MAP_TEXT = 0x400,
|
||||||
|
MAP_INITDATA = 0x800,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Values for msync()
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ MS_ASYNC = 1,
|
||||||
|
MS_INVALIDATE = 2,
|
||||||
|
MS_SYNC = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Values for mlockall()
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
MCL_CURRENT = 1,
|
||||||
|
MCL_FUTURE = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Values for madvise
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ MADV_NORMAL = 0,
|
||||||
|
MADV_RANDOM = 1,
|
||||||
|
MADV_SEQUENTIAL = 2,
|
||||||
|
MADV_WILLNEED = 3,
|
||||||
|
MADV_DONTNEED = 4,
|
||||||
|
MADV_FREE = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
void* mmap(void*, size_t, int, int, int, off_t);
|
||||||
|
const void* MAP_FAILED = cast(void*)-1;
|
||||||
|
|
||||||
|
int munmap(void*, size_t);
|
||||||
|
int mprotect(void*, size_t, int);
|
||||||
|
int msync(void*, size_t, int);
|
||||||
|
int madvise(void*, size_t, int);
|
||||||
|
int mlock(void*, size_t);
|
||||||
|
int munlock(void*, size_t);
|
||||||
|
int mlockall(int);
|
||||||
|
int munlockall();
|
||||||
|
int mincore(void*, size_t, ubyte*);
|
||||||
|
int shm_open(in char*, int, int);
|
||||||
|
int shm_unlink(in char*);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern(C)
|
||||||
|
{
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DT_UNKNOWN = 0,
|
||||||
|
DT_FIFO = 1,
|
||||||
|
DT_CHR = 2,
|
||||||
|
DT_DIR = 4,
|
||||||
|
DT_BLK = 6,
|
||||||
|
DT_REG = 8,
|
||||||
|
DT_LNK = 10,
|
||||||
|
DT_SOCK = 12,
|
||||||
|
DT_WHT = 14,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct dirent
|
||||||
|
{
|
||||||
|
uint d_ino;
|
||||||
|
off_t d_off;
|
||||||
|
ushort d_reclen;
|
||||||
|
char[256] d_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct dirent64
|
||||||
|
{
|
||||||
|
ulong d_ino;
|
||||||
|
long d_off;
|
||||||
|
ushort d_reclen;
|
||||||
|
char[256] d_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DIR
|
||||||
|
{
|
||||||
|
// Managed by OS.
|
||||||
|
}
|
||||||
|
|
||||||
|
DIR* opendir(in char* name);
|
||||||
|
int closedir(DIR* dir);
|
||||||
|
dirent* readdir(DIR* dir);
|
||||||
|
void rewinddir(DIR* dir);
|
||||||
|
off_t telldir(DIR* dir);
|
||||||
|
void seekdir(DIR* dir, off_t offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern(C)
|
||||||
|
{
|
||||||
|
private import std.intrinsic;
|
||||||
|
|
||||||
|
|
||||||
|
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds, timeval* timeout);
|
||||||
|
int fcntl(int s, int f, ...);
|
||||||
|
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
EINTR = 4,
|
||||||
|
EINPROGRESS = 150,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use select_large_fdset for > 1024 on Solaris. 64bit uses 65536.
|
||||||
|
const uint FD_SETSIZE = 1024;
|
||||||
|
//const uint NFDBITS = 8 * int.sizeof; // DMD 0.110: 8 * (int).sizeof is not an expression
|
||||||
|
const int NFDBITS = 32;
|
||||||
|
|
||||||
|
|
||||||
|
struct fd_set
|
||||||
|
{
|
||||||
|
int[FD_SETSIZE / NFDBITS] fds_bits;
|
||||||
|
alias fds_bits __fds_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int FDELT(int d)
|
||||||
|
{
|
||||||
|
return d / NFDBITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int FDMASK(int d)
|
||||||
|
{
|
||||||
|
return 1 << (d % NFDBITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Removes.
|
||||||
|
void FD_CLR(int fd, fd_set* set)
|
||||||
|
{
|
||||||
|
btr(cast(uint*)&set.fds_bits.ptr[FDELT(fd)], cast(uint)(fd % NFDBITS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Tests.
|
||||||
|
int FD_ISSET(int fd, fd_set* set)
|
||||||
|
{
|
||||||
|
return bt(cast(uint*)&set.fds_bits.ptr[FDELT(fd)], cast(uint)(fd % NFDBITS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Adds.
|
||||||
|
void FD_SET(int fd, fd_set* set)
|
||||||
|
{
|
||||||
|
bts(cast(uint*)&set.fds_bits.ptr[FDELT(fd)], cast(uint)(fd % NFDBITS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Resets to zero.
|
||||||
|
void FD_ZERO(fd_set* set)
|
||||||
|
{
|
||||||
|
set.fds_bits[] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
/* From <dlfcn.h>
|
||||||
|
* See http://www.opengroup.org/onlinepubs/007908799/xsh/dlsym.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
const int RTLD_NOW = 0x00002;
|
||||||
|
|
||||||
|
void* dlopen(in char* file, int mode);
|
||||||
|
int dlclose(void* handle);
|
||||||
|
void* dlsym(void* handle, char* name);
|
||||||
|
char* dlerror();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
/* from <pwd.h>
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct passwd
|
||||||
|
{
|
||||||
|
char *pw_name;
|
||||||
|
char *pw_passwd;
|
||||||
|
uid_t pw_uid;
|
||||||
|
gid_t pw_gid;
|
||||||
|
char *pw_age;
|
||||||
|
char *pw_comment;
|
||||||
|
char *pw_gecos;
|
||||||
|
char *pw_dir;
|
||||||
|
char *pw_shell;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getpwnam_r(char*, passwd*, void*, size_t, passwd**);
|
||||||
|
passwd* getpwnam(in char*);
|
||||||
|
passwd* getpwuid(uid_t);
|
||||||
|
int getpwuid_r(uid_t, passwd*, char*, size_t, passwd**);
|
||||||
|
int kill(pid_t, int);
|
||||||
|
int sem_close(sem_t*);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
/* from sched.h
|
||||||
|
*/
|
||||||
|
int sched_yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
/* from signal.h
|
||||||
|
*/
|
||||||
|
extern (C) alias void (*__sighandler_t)(int);
|
||||||
|
extern (C) alias void (*__sigaction_t)(int, void*, void*);
|
||||||
|
|
||||||
|
const SA_RESTART = 0x00000004u;
|
||||||
|
|
||||||
|
const size_t _SIGSET_NWORDS = 4;
|
||||||
|
|
||||||
|
struct sigset_t
|
||||||
|
{
|
||||||
|
uint[_SIGSET_NWORDS] __sigbits;
|
||||||
|
}
|
||||||
|
|
||||||
|
alias sigset_t __sigset;
|
||||||
|
alias sigset_t __sigset_t;
|
||||||
|
|
||||||
|
struct sigaction_t
|
||||||
|
{
|
||||||
|
int sa_flags;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
__sighandler_t sa_handler;
|
||||||
|
__sigaction_t sa_sigaction;
|
||||||
|
}
|
||||||
|
sigset_t sa_mask;
|
||||||
|
int sa_resv[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
int sigfillset(sigset_t *);
|
||||||
|
int sigdelset(sigset_t *, int);
|
||||||
|
int sigismember(sigset_t *, int);
|
||||||
|
int sigaction(int, sigaction_t*, sigaction_t*);
|
||||||
|
int sigsuspend(sigset_t*);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
/* from semaphore.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct sem_t
|
||||||
|
{
|
||||||
|
uint sem_count;
|
||||||
|
ushort sem_type;
|
||||||
|
ushort sem_magic;
|
||||||
|
ulong[3] sem_pad1;
|
||||||
|
ulong[2] sem_pad2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sem_init(sem_t*, int, uint);
|
||||||
|
int sem_wait(sem_t*);
|
||||||
|
int sem_trywait(sem_t*);
|
||||||
|
int sem_post(sem_t*);
|
||||||
|
int sem_getvalue(sem_t*, int*);
|
||||||
|
int sem_destroy(sem_t*);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
/* from utime.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct utimbuf
|
||||||
|
{
|
||||||
|
__time_t actime;
|
||||||
|
__time_t modtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
int utime(in char* filename, in utimbuf* buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C)
|
||||||
|
{
|
||||||
|
extern
|
||||||
|
{
|
||||||
|
void* __libc_stack_end;
|
||||||
|
int __data_start;
|
||||||
|
int _end;
|
||||||
|
int timezone;
|
||||||
|
|
||||||
|
void *_deh_beg;
|
||||||
|
void *_deh_end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sched.h
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SCHED_FIFO = 1,
|
||||||
|
SCHED_OTHER = 0,
|
||||||
|
SCHED_RR = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct sched_param
|
||||||
|
{
|
||||||
|
int sched_priority;
|
||||||
|
int[8] sched_pad;
|
||||||
|
}
|
|
@ -25,6 +25,10 @@ else version (FreeBSD)
|
||||||
{
|
{
|
||||||
alias dchar wchar_t;
|
alias dchar wchar_t;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
alias dchar wchar_t;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
|
@ -364,6 +364,62 @@ else version (FreeBSD)
|
||||||
int snprintf(char *,size_t,char *,...);
|
int snprintf(char *,size_t,char *,...);
|
||||||
int vsnprintf(char *,size_t,char *,va_list);
|
int vsnprintf(char *,size_t,char *,va_list);
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
const int EOF = -1;
|
||||||
|
const int BUFSIZ = 1024;
|
||||||
|
const int FOPEN_MAX = 20;
|
||||||
|
const int FILENAME_MAX = 1024;
|
||||||
|
const int TMP_MAX = 17576;
|
||||||
|
const int L_tmpnam = 25;
|
||||||
|
const int _NFILE = 20;
|
||||||
|
|
||||||
|
struct __sbuf
|
||||||
|
{
|
||||||
|
char* _base;
|
||||||
|
int _size;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct _iobuf
|
||||||
|
{
|
||||||
|
align (1):
|
||||||
|
|
||||||
|
int _cnt;
|
||||||
|
ubyte* _ptr;
|
||||||
|
ubyte* _base;
|
||||||
|
ubyte _flag;
|
||||||
|
ubyte _magic;
|
||||||
|
ubyte[2] __bitflags;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum { SEEK_SET, SEEK_CUR, SEEK_END }
|
||||||
|
|
||||||
|
alias _iobuf FILE; ///
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
_IOFBF = 0000,
|
||||||
|
_IOLBF = 0100,
|
||||||
|
_IONBF = 0200,
|
||||||
|
}
|
||||||
|
|
||||||
|
alias long fpos_t;
|
||||||
|
|
||||||
|
extern FILE _iob[_NFILE];
|
||||||
|
|
||||||
|
const FILE *stdin = &_iob[0]; ///
|
||||||
|
const FILE *stdout = &_iob[1]; ///
|
||||||
|
const FILE *stderr = &_iob[2]; ///
|
||||||
|
|
||||||
|
int ferror(FILE *fp);
|
||||||
|
int feof(FILE *fp);
|
||||||
|
void clearerr(FILE *fp);
|
||||||
|
void rewind(FILE *fp);
|
||||||
|
int _bufsize(FILE *fp);
|
||||||
|
int fileno(FILE *fp);
|
||||||
|
int snprintf(char *,size_t,char *,...);
|
||||||
|
int vsnprintf(char *,size_t,char *,va_list);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
|
@ -54,4 +54,9 @@ version (FreeBSD)
|
||||||
int strerror_r(int errnum, char* buf, size_t buflen); ///
|
int strerror_r(int errnum, char* buf, size_t buflen); ///
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{
|
||||||
|
int strerror_r(int errnum, char* buf, size_t buflen); ///
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
23
std/c/time.d
23
std/c/time.d
|
@ -88,6 +88,29 @@ else version (FreeBSD)
|
||||||
char* tm_zone;
|
char* tm_zone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
const clock_t CLOCKS_PER_SEC = 1000000;
|
||||||
|
clock_t CLK_TCK = 0; // deprecated, use sysconf(_SC_CLK_TCK)
|
||||||
|
|
||||||
|
extern (C) int sysconf(int);
|
||||||
|
static this()
|
||||||
|
{
|
||||||
|
CLK_TCK = _sysconf(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tm
|
||||||
|
{ int tm_sec,
|
||||||
|
tm_min,
|
||||||
|
tm_hour,
|
||||||
|
tm_mday,
|
||||||
|
tm_mon,
|
||||||
|
tm_year,
|
||||||
|
tm_wday,
|
||||||
|
tm_yday,
|
||||||
|
tm_isdst;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
21
std/file.d
21
std/file.d
|
@ -1153,6 +1153,12 @@ void getTimes(string name, out d_time ftc, out d_time fta, out d_time ftm)
|
||||||
fta = cast(d_time)statbuf.st_atimespec.tv_sec * std.date.TicksPerSecond;
|
fta = cast(d_time)statbuf.st_atimespec.tv_sec * std.date.TicksPerSecond;
|
||||||
ftm = cast(d_time)statbuf.st_mtimespec.tv_sec * std.date.TicksPerSecond;
|
ftm = cast(d_time)statbuf.st_mtimespec.tv_sec * std.date.TicksPerSecond;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{ // BUG: should add in *nsec fields
|
||||||
|
ftc = cast(d_time)statbuf.st_ctime * std.date.TicksPerSecond;
|
||||||
|
fta = cast(d_time)statbuf.st_atime * std.date.TicksPerSecond;
|
||||||
|
ftm = cast(d_time)statbuf.st_mtime * std.date.TicksPerSecond;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
@ -1277,6 +1283,10 @@ struct DirEntry
|
||||||
{ size_t len = std.c.string.strlen(fd.d_name.ptr);
|
{ size_t len = std.c.string.strlen(fd.d_name.ptr);
|
||||||
name = std.path.join(path, fd.d_name[0 .. len]);
|
name = std.path.join(path, fd.d_name[0 .. len]);
|
||||||
d_type = fd.d_type;
|
d_type = fd.d_type;
|
||||||
|
// Some platforms, like Solaris, don't have this member.
|
||||||
|
// TODO: Bug: d_type is never set on Solaris (see bugzilla 2838 for fix.)
|
||||||
|
static if (is(fd.d_type))
|
||||||
|
d_type = fd.d_type;
|
||||||
didstat = 0;
|
didstat = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1353,6 +1363,12 @@ struct DirEntry
|
||||||
_lastAccessTime = cast(d_time)statbuf.st_atimespec.tv_sec * std.date.TicksPerSecond;
|
_lastAccessTime = cast(d_time)statbuf.st_atimespec.tv_sec * std.date.TicksPerSecond;
|
||||||
_lastWriteTime = cast(d_time)statbuf.st_mtimespec.tv_sec * std.date.TicksPerSecond;
|
_lastWriteTime = cast(d_time)statbuf.st_mtimespec.tv_sec * std.date.TicksPerSecond;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
_creationTime = cast(d_time)statbuf.st_ctime * std.date.TicksPerSecond;
|
||||||
|
_lastAccessTime = cast(d_time)statbuf.st_atime * std.date.TicksPerSecond;
|
||||||
|
_lastWriteTime = cast(d_time)statbuf.st_mtime * std.date.TicksPerSecond;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
@ -1549,6 +1565,11 @@ void copy(string from, string to)
|
||||||
utim.actime = cast(__time_t)statbuf.st_atimespec.tv_sec;
|
utim.actime = cast(__time_t)statbuf.st_atimespec.tv_sec;
|
||||||
utim.modtime = cast(__time_t)statbuf.st_mtimespec.tv_sec;
|
utim.modtime = cast(__time_t)statbuf.st_mtimespec.tv_sec;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
utim.actime = cast(__time_t)statbuf.st_atime;
|
||||||
|
utim.modtime = cast(__time_t)statbuf.st_mtime;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
28
std/math.d
28
std/math.d
|
@ -2852,6 +2852,34 @@ body
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
asm // assembler by W. Bright
|
||||||
|
{
|
||||||
|
// EDX = (A.length - 1) * real.sizeof
|
||||||
|
mov ECX,A[EBP] ; // ECX = A.length
|
||||||
|
dec ECX ;
|
||||||
|
lea EDX,[ECX*8] ;
|
||||||
|
lea EDX,[EDX][ECX*4] ;
|
||||||
|
add EDX,A+4[EBP] ;
|
||||||
|
fld real ptr [EDX] ; // ST0 = coeff[ECX]
|
||||||
|
jecxz return_ST ;
|
||||||
|
fld x[EBP] ; // ST0 = x
|
||||||
|
fxch ST(1) ; // ST1 = x, ST0 = r
|
||||||
|
align 4 ;
|
||||||
|
L2: fmul ST,ST(1) ; // r *= x
|
||||||
|
fld real ptr -12[EDX] ;
|
||||||
|
sub EDX,12 ; // deg--
|
||||||
|
faddp ST(1),ST ;
|
||||||
|
dec ECX ;
|
||||||
|
jne L2 ;
|
||||||
|
fxch ST(1) ; // ST1 = r, ST0 = x
|
||||||
|
fstp ST(0) ; // dump x
|
||||||
|
align 4 ;
|
||||||
|
return_ST: ;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
|
@ -308,6 +308,7 @@ class MmFile
|
||||||
version (linux) flags |= MAP_ANONYMOUS;
|
version (linux) flags |= MAP_ANONYMOUS;
|
||||||
else version (OSX) flags |= MAP_ANON;
|
else version (OSX) flags |= MAP_ANON;
|
||||||
else version (FreeBSD) flags |= MAP_ANON;
|
else version (FreeBSD) flags |= MAP_ANON;
|
||||||
|
else version (Solaris) flags |= MAP_ANON;
|
||||||
else static assert(0);
|
else static assert(0);
|
||||||
}
|
}
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
|
@ -90,6 +90,19 @@ version (FreeBSD)
|
||||||
extern (C) ModuleReference *_Dmodule_ref; // start of linked list
|
extern (C) ModuleReference *_Dmodule_ref; // start of linked list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{
|
||||||
|
// This linked list is created by a compiler generated function inserted
|
||||||
|
// into the .ctor list by the compiler.
|
||||||
|
struct ModuleReference
|
||||||
|
{
|
||||||
|
ModuleReference* next;
|
||||||
|
ModuleInfo mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C) ModuleReference *_Dmodule_ref; // start of linked list
|
||||||
|
}
|
||||||
|
|
||||||
version (OSX)
|
version (OSX)
|
||||||
{
|
{
|
||||||
extern (C)
|
extern (C)
|
||||||
|
@ -143,6 +156,21 @@ extern (C) void _moduleCtor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{
|
||||||
|
int len = 0;
|
||||||
|
ModuleReference *mr;
|
||||||
|
|
||||||
|
for (mr = _Dmodule_ref; mr; mr = mr.next)
|
||||||
|
len++;
|
||||||
|
_moduleinfo_array = new ModuleInfo[len];
|
||||||
|
len = 0;
|
||||||
|
for (mr = _Dmodule_ref; mr; mr = mr.next)
|
||||||
|
{ _moduleinfo_array[len] = mr.mod;
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
version (OSX)
|
version (OSX)
|
||||||
{ /* The ModuleInfo references are stored in the special segment
|
{ /* The ModuleInfo references are stored in the special segment
|
||||||
* __minfodata, which is bracketed by the segments __minfo_beg
|
* __minfodata, which is bracketed by the segments __minfo_beg
|
||||||
|
|
12
std/socket.d
12
std/socket.d
|
@ -67,6 +67,8 @@ else version(BsdSockets)
|
||||||
{
|
{
|
||||||
version (FreeBSD)
|
version (FreeBSD)
|
||||||
private import std.c.freebsd.socket;
|
private import std.c.freebsd.socket;
|
||||||
|
else version (Solaris)
|
||||||
|
private import std.c.solaris.socket;
|
||||||
else
|
else
|
||||||
private import std.c.linux.socket;
|
private import std.c.linux.socket;
|
||||||
private import std.c.linux.linux;
|
private import std.c.linux.linux;
|
||||||
|
@ -127,6 +129,16 @@ class SocketException: Exception
|
||||||
cs = "Unknown error";
|
cs = "Unknown error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
auto errs = strerror_r(errorCode, buf.ptr, buf.length);
|
||||||
|
if (errs == 0)
|
||||||
|
cs = buf.ptr;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cs = "Unknown error";
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
|
|
@ -53,6 +53,11 @@ version (FreeBSD)
|
||||||
version = GENERIC_IO;
|
version = GENERIC_IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version (Solaris)
|
||||||
|
{
|
||||||
|
version = GENERIC_IO;
|
||||||
|
}
|
||||||
|
|
||||||
version (DIGITAL_MARS_STDIO)
|
version (DIGITAL_MARS_STDIO)
|
||||||
{
|
{
|
||||||
extern (C)
|
extern (C)
|
||||||
|
|
|
@ -21,6 +21,7 @@ const
|
||||||
linux, // all linux systems
|
linux, // all linux systems
|
||||||
OSX,
|
OSX,
|
||||||
FreeBSD,
|
FreeBSD,
|
||||||
|
Solaris,
|
||||||
}
|
}
|
||||||
|
|
||||||
version (Win32)
|
version (Win32)
|
||||||
|
@ -39,6 +40,10 @@ const
|
||||||
{
|
{
|
||||||
Family family = Family.FreeBSD;
|
Family family = Family.FreeBSD;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
Family family = Family.Solaris;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(0);
|
static assert(0);
|
||||||
|
@ -57,6 +62,7 @@ const
|
||||||
RedHatLinux,
|
RedHatLinux,
|
||||||
OSX,
|
OSX,
|
||||||
FreeBSD,
|
FreeBSD,
|
||||||
|
Solaris,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Byte order endianness
|
/// Byte order endianness
|
||||||
|
|
|
@ -535,6 +535,11 @@ version (FreeBSD)
|
||||||
private import std.c.freebsd.freebsd;
|
private import std.c.freebsd.freebsd;
|
||||||
private import std.c.freebsd.pthread;
|
private import std.c.freebsd.pthread;
|
||||||
}
|
}
|
||||||
|
else version (Solaris)
|
||||||
|
{
|
||||||
|
private import std.c.solaris.solaris;
|
||||||
|
private import std.c.solaris.pthread;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
private import std.c.linux.linux;
|
private import std.c.linux.linux;
|
||||||
|
|
16
win32.mak
16
win32.mak
|
@ -65,7 +65,7 @@ OBJS= deh.obj complex.obj gcstats.obj \
|
||||||
# ti_bit.obj ti_Abit.obj
|
# ti_bit.obj ti_Abit.obj
|
||||||
|
|
||||||
MAKEFILES= \
|
MAKEFILES= \
|
||||||
win32.mak linux.mak osx.mak freebsd.mak
|
win32.mak linux.mak osx.mak freebsd.mak solaris.mak
|
||||||
|
|
||||||
SRCS= std\math.d std\stdio.d std\dateparse.d std\date.d std\uni.d std\string.d \
|
SRCS= std\math.d std\stdio.d std\dateparse.d std\date.d std\uni.d std\string.d \
|
||||||
std\base64.d std\md5.d std\regexp.d \
|
std\base64.d std\md5.d std\regexp.d \
|
||||||
|
@ -253,6 +253,12 @@ SRC_STD_C_FREEBSD= std\c\freebsd\freebsd.d \
|
||||||
std\c\freebsd\socket.d std\c\freebsd\pthread.d \
|
std\c\freebsd\socket.d std\c\freebsd\pthread.d \
|
||||||
std\c\freebsd\math.d
|
std\c\freebsd\math.d
|
||||||
|
|
||||||
|
SRC_STD_C_SOLARIS= std/c/solaris/solaris.d \
|
||||||
|
std/c/solaris/socket.d std/c/solaris/pthread.d
|
||||||
|
|
||||||
|
SRC_STD_C_POSIX= std\c\posix\posix.d \
|
||||||
|
std\c\posix\socket.d std\c\posix\pthread.d
|
||||||
|
|
||||||
SRC_ETC= etc\gamma.d
|
SRC_ETC= etc\gamma.d
|
||||||
|
|
||||||
SRC_ETC_C= etc\c\zlib.d
|
SRC_ETC_C= etc\c\zlib.d
|
||||||
|
@ -289,7 +295,8 @@ SRC_ZLIB= etc\c\zlib\trees.h \
|
||||||
etc\c\zlib\win32.mak \
|
etc\c\zlib\win32.mak \
|
||||||
etc\c\zlib\linux.mak \
|
etc\c\zlib\linux.mak \
|
||||||
etc\c\zlib\osx.mak \
|
etc\c\zlib\osx.mak \
|
||||||
etc\c\zlib\freebsd.mak
|
etc\c\zlib\freebsd.mak \
|
||||||
|
etc\c\zlib\solaris.mak
|
||||||
|
|
||||||
SRC_GC= internal\gc\gc.d \
|
SRC_GC= internal\gc\gc.d \
|
||||||
internal\gc\gcold.d \
|
internal\gc\gcold.d \
|
||||||
|
@ -303,7 +310,8 @@ SRC_GC= internal\gc\gc.d \
|
||||||
internal\gc\win32.mak \
|
internal\gc\win32.mak \
|
||||||
internal\gc\linux.mak \
|
internal\gc\linux.mak \
|
||||||
internal\gc\osx.mak \
|
internal\gc\osx.mak \
|
||||||
internal\gc\freebsd.mak
|
internal\gc\freebsd.mak \
|
||||||
|
internal\gc\solaris.mak
|
||||||
|
|
||||||
phobos.lib : $(OBJS) $(SRCS) minit.obj internal\gc\dmgc.lib \
|
phobos.lib : $(OBJS) $(SRCS) minit.obj internal\gc\dmgc.lib \
|
||||||
etc\c\zlib\zlib.lib win32.mak
|
etc\c\zlib\zlib.lib win32.mak
|
||||||
|
@ -932,6 +940,8 @@ install:
|
||||||
$(CP) $(SRC_STD_C_LINUX) $(DIR)\src\phobos\std\c\linux
|
$(CP) $(SRC_STD_C_LINUX) $(DIR)\src\phobos\std\c\linux
|
||||||
$(CP) $(SRC_STD_C_OSX) $(DIR)\src\phobos\std\c\osx
|
$(CP) $(SRC_STD_C_OSX) $(DIR)\src\phobos\std\c\osx
|
||||||
$(CP) $(SRC_STD_C_FREEBSD) $(DIR)\src\phobos\std\c\freebsd
|
$(CP) $(SRC_STD_C_FREEBSD) $(DIR)\src\phobos\std\c\freebsd
|
||||||
|
$(CP) $(SRC_STD_C_SOLARIS) $(DIR)\src\phobos\std\c\solaris
|
||||||
|
$(CP) $(SRC_STD_C_POSIX) $(DIR)\src\phobos\std\c\posix
|
||||||
$(CP) $(SRC_ETC) $(DIR)\src\phobos\etc
|
$(CP) $(SRC_ETC) $(DIR)\src\phobos\etc
|
||||||
$(CP) $(SRC_ETC_C) $(DIR)\src\phobos\etc\c
|
$(CP) $(SRC_ETC_C) $(DIR)\src\phobos\etc\c
|
||||||
$(CP) $(SRC_ZLIB) $(DIR)\src\phobos\etc\c\zlib
|
$(CP) $(SRC_ZLIB) $(DIR)\src\phobos\etc\c\zlib
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue