Porting PostgreSQL To The Win32 Platform - PostgreSQL wiki

cuttlefishblueData Management

Dec 16, 2012 (4 years and 10 months ago)

196 views

PortingPostgreSQLToTheWin32Platform
BRUCE
MOMJIAN,
SOFTWARE
RESEARCH
ASSOCIATES
August,2005
Abstract
ThispresentationoutlinesthechallengesofportingPostgreSQLfrom
UnixtotheWin32platform.
Pre-8.0
PortingPostgreSQLToTheWin32Platform1
ProblemsWithCygwin

Installationrequirements

Installationbloat,securityconcerns

Fifty-connectionlimit

Performance
PortingPostgreSQLToTheWin32Platform2
Constraints

DonotbreaktheUnixbuild

Donomakethecodehardertounderstand

Limitcodeduplicationforthenewport

Minimizetheamountofnewcodefortheport
SoutionTeamwork
PortingPostgreSQLToTheWin32Platform3
CommercialPorts

PeerDirect

SRA

Connix
PortingPostgreSQLToTheWin32Platform4
TargetOperatingSystem

WindowsNT,2000/2003,XP

NTFS
PortingPostgreSQLToTheWin32Platform5
Toolkit-MinGW

librariesmapUnixcallstoWin32calls(MinGW)

providesUnixbuildenvironment(Msys)
PortingPostgreSQLToTheWin32Platform6
MajorIssue-Forkvs.CreateProcess

passingvariablesinheritedviafork

attachingtosharedmemorythatisusuallyinherited
PortingPostgreSQLToTheWin32Platform7
TypicalNewUnixProcess
fork()exec()
datadata
stackstackstack
text
data
texttext
PortingPostgreSQLToTheWin32Platform8
NewPostgreSQLProcessonUnix
































































































































































































































































































































































































































































































fork()
























































































































text
data
stack
data
text
stack
PortingPostgreSQLToTheWin32Platform9
NewPostgreSQLProcessonWin32
exec()
















































































































































































































































Shared
Memory






































































































































































































































































































































































text
data
stack
data
stack
text
PortingPostgreSQLToTheWin32Platform10
FileSystem

'/'vs'\'

rootdirectory,/vs.C:\

carriagereturn/linefeed
COPY
open()
characterchecks

.EXEextension

symlinksvsjunctionpoints

lesystemsync()vsper-lecommit()
PortingPostgreSQLToTheWin32Platform11
FileSystemAtomicity,Concurrency

rename()andunlink()xedusingopen()ags
FILE_SHARE_READ
FILE_SHARE_WRITE
FILE_SHARE_DELETE
PortingPostgreSQLToTheWin32Platform12
CommandLine

system()

'&'vsSTART/B

cp/copy,rm/del

copydirasservice

singlevsdoublequotes
PortingPostgreSQLToTheWin32Platform13
EnvironmentVariables

$HOMEdirectory

$SHELLvs$COMSPEC

$EDITORdefaults
PortingPostgreSQLToTheWin32Platform14
ShellScriptsConverttoCPrograms

initdb

pg_ctl

create*,drop*,vacuumdb,pg_dumpall
PortingPostgreSQLToTheWin32Platform15
InterprocessCommunication

signals,threadlisteningonnamedpipe

cancelkeyhandling

popen()whenrunfromaservice
PortingPostgreSQLToTheWin32Platform16
/portCentralization
copydir.cgetrusage.cpgsleep.csrandom.c
crypt.cgettimeofday.cpgstrcasecmp.cstrdup.c
dirmod.cinet_aton.cpipe.cstrerror.c
exec.cisinf.cqsort.cstrtol.c
fseeko.ckill.crand.cstrtoul.c
getaddrinfo.cmemcmp.crandom.cthread.c
gethostname.cnoblock.crint.cunsetenv.c
getopt.copen.csnprintf.c
getopt_long.cpath.csprompt.c
PortingPostgreSQLToTheWin32Platform17
BuildEnvironment

adjustMakelesandbuild

errnovs.GetLastError()
PortingPostgreSQLToTheWin32Platform18
Kernel

IPC-memory,semaphores

sleepinterrupted

getrusage()

memoryallocationfromsharedlibraries
PortingPostgreSQLToTheWin32Platform19
Miscellaneous

usernamelookups,no/etc/passwd

localevscodepage

noaccessabletimezonedatabase

relocatableinstalls

Win32service

installerMSI
PortingPostgreSQLToTheWin32Platform20
Conclusion
PortingPostgreSQLToTheWin32Platform21