windows-nt/Source/XPSP1/NT/base/subsys/posix/status.psx
2020-09-26 16:20:57 +08:00

307 lines
9.7 KiB
Plaintext

The POSIX subsystem is modeled closely on the OS2 subsystem - I've re-arranged
and renamed the files so that it will be easier to compare functionality.
There is a problem with POSIX running in a window when a process forks
that is probably due to the fact that keeping track of mulitple sessions
is not done properly. Look at session.c in os2 and compare that code wiht
posix.
The arguments to exec are not getting through properly.
It would be a good idea to check build.log after a complete build for warnings.
I haven't done that in a while.
The posix header files are not complete. They should be fleshed out (look
at the xenix headers on you mail machine) so that the NIST tests will compile
and so th languages guys know where conflicts may arise when they do the
merge of the posix headers and c runtimes into their main source tree.
On exit, smcomplete session has been returning c0000008 for a long time
and I haven't taken time to track that down.
See note 6 below re Console IO. I have no test (we need a simple shell)
that does stdin as yet so that is not tested.
Good luck!!
POSIX STATUS
Nov 15, 1990 Feb 15, 1991
Total functions: 97
Done 44 60
Optional (debatable) 12
--
Unimplemented 41 25
Process Primitives
fork /
execl /
execv /
execle /
execve /
execlp convert file to path using PATH env variable
execvp "
wait /
waitpid /
_exit /
kill /
sigemptyset / NOTE 1
sigfillset /
sigdelset /
sigismember /
sigaction /
sigprocmask /
sigpending
sigsuspend /
alarm /
pause /
sleep /
Process Environment
getpid /
getppid /
getuid /
geteuid /
getgid /
getegid /
setuid
setgid
getgroups
getlogin
cuserid
getpgrp /
setsid /
setpgid /
uname /
time /
times /
getenv
ctermid
ttyname
isatty
sysconf /
Files and Directories
opendir / NOTE 2 re file times updating
readdir /
rewinddir /
closedir /
chdir /
getcwd /
open /
creat /
umask /
link NOTE 3
mkdir / NOTE 4
mkfifo / NOTE 4
unlink NOTE 3
rmdir /
rename NOTE 3 - and how does this relate to C runtime version??
stat / Always fail? - see comment fdapi.c, NT security chapter
fstat / NOTES 2, 3, 4
access / Needs RtlMakePosixAcl from JimK
chmod / Needs RtlIntrepretPosix and NtSetSecurityObject (JimK)
chown / Some open issues - su priv, security routines work?
utime / Need NT to POSIX uid/gid translations
pathconf / Done for now - need NtFsControlFile for configurable
fpathconf /
Input and Output Primitives
pipe /
dup /
dup2 /
close /
read /
write /
fcntl
lseek /
Device and Class Specific Functions
cfgetispeed ( All optional ???)
cfgetospeed ( tonye may be source for tty support - he's doing)
cfsetispeed ( serial drivers)
cfsetospeed
tcgetattr
tcsetattr
tcsendbreak
tcdrain
tcflush
tcflow
tcgetpgrp
tcsetpgrp
Language-Specific Services for the C Programming Language
setlocale
fileno /
fdopen
sigsetjmp
siglongjmp
tzset
System Databases
getgrgid
getgrnam
getpwuid
getpwnam
-----------------------------
NOTE 1
Re: signals
In order to make NT exception handling available to PSX processes,
check for exceptions in apiloop using exception port and convert
to signals.
NOTE 2
Re: file times updating.
Implementing this for all relevant file systems functions will
need to be postponed until NTFS. GaryKi has been given a list
of PSX requirements for times updating. For now POSIX uses the
times from NtQueryInformationFile for all but local pipes. Local
pipe times are updated in the subsystem.
See filereqs.psx in POSIX directory.
NOTE 3
Re: link and unlink and rename -
Implementing this will need to be postponed until NTFS. The Pinball
FS does not implement links right now since OS2 doesn't use them.
The POSIX file system will be NTFS. GaryKi and TomM have been
contacted about this requirement. Check changes to 1.003a re
symbolic links.
NOTE 4
Re: security
When security code is complete - these functions need to check
the ACL and/or UID GID SID info appropriately. See Security section
of workbook - chapter 14. Mike Massa (mikemas) is working on
security as he ports streams over to NT and POSIX. He was planning
to write conversion functions (cracking ACLs to get POSIX rwx access)
that should be used by the subsystem also.
TODO
1. Details are missing in the pre-ellen functions (such as setting uid,
file times etc in file functions). Go over all functions carefully to
see that they are FULLY functional re: spec.
2. Operations on local pipes need to update the times in the ionode.
Pipe() initializes these. Open, read and write (other??) need to
update manually.
3. When security is in place re: ACLs on files - all functions manipulating
and/or accessing file modes (access, open, fstat, chmod) must translate
between POSIX file permissions and NT ACLs and update appropriately.
4. Many routines in fdapi have to open the file (NtOpen) to get a handle
for other routines. Check NtOpens actions on the file times of the file
vs what's supposed to happen to those times via the posix routine.
5. Check into all routines that say they must be fixed to work with
view memory (grep for view).
6. (This may negate some comments above.) ALL I/O except OPEN, PIPES, and FILE
LOCKING needs to be moved into the client and out of the server. read,
write, stat, etc. NOTE: FileRead and FileWrite functions in psxfile.c use
NtReadVirtualMemory and NtWriteVirtualMemory to transfer the data
to be read from or written to the file between the user buffer and the
server buffer. This is a STOPGAP ONLY measure required for POSIX
to work now that NTWriteFile no longer accepts a parameter specifying that
the write should be done to an alternate process' data. When this code is
moved out into the client and done strictly in the client's space, this
code is obviously unnecessary.
Currently, Console IO is caught at the client level (see IS_CONSOLE_IO
in dllio.c) and vectored off to the posix.exe to do the proper windows
crt read and write.. This should be done as os2 does it (os2 has all io
on the client side) using a vector of functions and not special-casing.
(See IoVectorArray in os2\client\dllhandl.c).
7. There are lots of places in the client code where the user parameters
(ptrs to) are taken at face value and not checked. These should be probed
for read and write access before using. Esp uname times time wait waitpid etc
in pdxproc.c).
8. The POSIX C Runtimes (crts) are incomplete and patched together and
not merged into the regular source tree. Languages (jeffrob) are
supposed to do this 'any time now'. Until this work is done (which
includes supplying header files that do not conflict with posix header
files), building apps and tests is iffy. NIST testing is virtually
impossible. Currently I have a patched together studio.h in inc\posix
so that printf will work.
When this work is done, mainCRTstartup() may change names. It will have
to be changed in rtl/startup.c to match what is in the runtime.
CONTACTS: jeffrob, gregf (jeff's boss) Get LOUP to follow up.
9. MIPS builds with only one warning - due to that fact that the MIPS
version of the CONTEXT_TO_PROGRAM_COUNTER macro in ntmips.h is
wrong (should be cast to a PVOID). Update - I haven't built for MIPS
since March 1991.
TESTING issues
STAT - test 'real' code when NtQuerySecurityObject is fixed.
NIST tests - SteveSc has loaded them onto a system and will try to
build with the posix runtimes that mukund did last summer. THis may
be a frustrating experience until we have 'real'crts and headers from
languages.
*************************************************************************
CRT INFO - this is mail from the student who fixed up a POSIX CRT for me.
This work needs to be merged into the languages CRT tree and built
regularly.
Here's a list of the POSIX related stuff that has to be done to assimilate the stuff back into the tree:
Heap, String, Convert, Misc: The code is the same as WIN32.
Stdio : Changes littered along the souce code. Could probably be put in the source tree directly.
Time : An issue that will be resolved. The POSIX version is based on the C7 code, and uses floating point.
Startup: Code based on WIN32 version. Only stdenvp.c and crt0msg.c has any new code.
Setjmp and Lngjmp: to be done.
Include files: Most of them could be put in the tree directly. There are a few POSIX specific include files
(dirent.h, grp.h, pwd.h, sys\wait.h, sys\utsname.h, sys\termios.h, sys\times.h, unistd.h) that have to be added. Additional macros are defined in the POSIX version of stat.h and the POSIX version of types.h defines some additonal types.
The POSIX source files can be found on \\crt1\vangogh in a
directory called posix. The posix-specific include files can
be found in \posix\psxinc.
I had a really good time working here this summer and I want to thank all of you for making it such a good experience.
Mukund
The server is:
\\vangogh\rdcrt1 password: QIEPCKE
The tree is: \posix.
-Gregf
*************************************************************************
RtlUnixPathToNtPath()
Consult with SteveWo to sort out what should be done here.
We need to be able to designate the posix file system(s) (ntfs only due
to links needing to be supported) and how to translate pathname
(eg \posix) to filesystem (eg what used to be \\harddiskX\partitionY\posix)
for NT.
Call RtlPosixPathToNtPath in client wherever a path argument is passed in.
There is currently a RtlDosPathToNtPath() function to use as a guide.