Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

306 lines
9.7 KiB

  1. The POSIX subsystem is modeled closely on the OS2 subsystem - I've re-arranged
  2. and renamed the files so that it will be easier to compare functionality.
  3. There is a problem with POSIX running in a window when a process forks
  4. that is probably due to the fact that keeping track of mulitple sessions
  5. is not done properly. Look at session.c in os2 and compare that code wiht
  6. posix.
  7. The arguments to exec are not getting through properly.
  8. It would be a good idea to check build.log after a complete build for warnings.
  9. I haven't done that in a while.
  10. The posix header files are not complete. They should be fleshed out (look
  11. at the xenix headers on you mail machine) so that the NIST tests will compile
  12. and so th languages guys know where conflicts may arise when they do the
  13. merge of the posix headers and c runtimes into their main source tree.
  14. On exit, smcomplete session has been returning c0000008 for a long time
  15. and I haven't taken time to track that down.
  16. See note 6 below re Console IO. I have no test (we need a simple shell)
  17. that does stdin as yet so that is not tested.
  18. Good luck!!
  19. POSIX STATUS
  20. Nov 15, 1990 Feb 15, 1991
  21. Total functions: 97
  22. Done 44 60
  23. Optional (debatable) 12
  24. --
  25. Unimplemented 41 25
  26. Process Primitives
  27. fork /
  28. execl /
  29. execv /
  30. execle /
  31. execve /
  32. execlp convert file to path using PATH env variable
  33. execvp "
  34. wait /
  35. waitpid /
  36. _exit /
  37. kill /
  38. sigemptyset / NOTE 1
  39. sigfillset /
  40. sigdelset /
  41. sigismember /
  42. sigaction /
  43. sigprocmask /
  44. sigpending
  45. sigsuspend /
  46. alarm /
  47. pause /
  48. sleep /
  49. Process Environment
  50. getpid /
  51. getppid /
  52. getuid /
  53. geteuid /
  54. getgid /
  55. getegid /
  56. setuid
  57. setgid
  58. getgroups
  59. getlogin
  60. cuserid
  61. getpgrp /
  62. setsid /
  63. setpgid /
  64. uname /
  65. time /
  66. times /
  67. getenv
  68. ctermid
  69. ttyname
  70. isatty
  71. sysconf /
  72. Files and Directories
  73. opendir / NOTE 2 re file times updating
  74. readdir /
  75. rewinddir /
  76. closedir /
  77. chdir /
  78. getcwd /
  79. open /
  80. creat /
  81. umask /
  82. link NOTE 3
  83. mkdir / NOTE 4
  84. mkfifo / NOTE 4
  85. unlink NOTE 3
  86. rmdir /
  87. rename NOTE 3 - and how does this relate to C runtime version??
  88. stat / Always fail? - see comment fdapi.c, NT security chapter
  89. fstat / NOTES 2, 3, 4
  90. access / Needs RtlMakePosixAcl from JimK
  91. chmod / Needs RtlIntrepretPosix and NtSetSecurityObject (JimK)
  92. chown / Some open issues - su priv, security routines work?
  93. utime / Need NT to POSIX uid/gid translations
  94. pathconf / Done for now - need NtFsControlFile for configurable
  95. fpathconf /
  96. Input and Output Primitives
  97. pipe /
  98. dup /
  99. dup2 /
  100. close /
  101. read /
  102. write /
  103. fcntl
  104. lseek /
  105. Device and Class Specific Functions
  106. cfgetispeed ( All optional ???)
  107. cfgetospeed ( tonye may be source for tty support - he's doing)
  108. cfsetispeed ( serial drivers)
  109. cfsetospeed
  110. tcgetattr
  111. tcsetattr
  112. tcsendbreak
  113. tcdrain
  114. tcflush
  115. tcflow
  116. tcgetpgrp
  117. tcsetpgrp
  118. Language-Specific Services for the C Programming Language
  119. setlocale
  120. fileno /
  121. fdopen
  122. sigsetjmp
  123. siglongjmp
  124. tzset
  125. System Databases
  126. getgrgid
  127. getgrnam
  128. getpwuid
  129. getpwnam
  130. -----------------------------
  131. NOTE 1
  132. Re: signals
  133. In order to make NT exception handling available to PSX processes,
  134. check for exceptions in apiloop using exception port and convert
  135. to signals.
  136. NOTE 2
  137. Re: file times updating.
  138. Implementing this for all relevant file systems functions will
  139. need to be postponed until NTFS. GaryKi has been given a list
  140. of PSX requirements for times updating. For now POSIX uses the
  141. times from NtQueryInformationFile for all but local pipes. Local
  142. pipe times are updated in the subsystem.
  143. See filereqs.psx in POSIX directory.
  144. NOTE 3
  145. Re: link and unlink and rename -
  146. Implementing this will need to be postponed until NTFS. The Pinball
  147. FS does not implement links right now since OS2 doesn't use them.
  148. The POSIX file system will be NTFS. GaryKi and TomM have been
  149. contacted about this requirement. Check changes to 1.003a re
  150. symbolic links.
  151. NOTE 4
  152. Re: security
  153. When security code is complete - these functions need to check
  154. the ACL and/or UID GID SID info appropriately. See Security section
  155. of workbook - chapter 14. Mike Massa (mikemas) is working on
  156. security as he ports streams over to NT and POSIX. He was planning
  157. to write conversion functions (cracking ACLs to get POSIX rwx access)
  158. that should be used by the subsystem also.
  159. TODO
  160. 1. Details are missing in the pre-ellen functions (such as setting uid,
  161. file times etc in file functions). Go over all functions carefully to
  162. see that they are FULLY functional re: spec.
  163. 2. Operations on local pipes need to update the times in the ionode.
  164. Pipe() initializes these. Open, read and write (other??) need to
  165. update manually.
  166. 3. When security is in place re: ACLs on files - all functions manipulating
  167. and/or accessing file modes (access, open, fstat, chmod) must translate
  168. between POSIX file permissions and NT ACLs and update appropriately.
  169. 4. Many routines in fdapi have to open the file (NtOpen) to get a handle
  170. for other routines. Check NtOpens actions on the file times of the file
  171. vs what's supposed to happen to those times via the posix routine.
  172. 5. Check into all routines that say they must be fixed to work with
  173. view memory (grep for view).
  174. 6. (This may negate some comments above.) ALL I/O except OPEN, PIPES, and FILE
  175. LOCKING needs to be moved into the client and out of the server. read,
  176. write, stat, etc. NOTE: FileRead and FileWrite functions in psxfile.c use
  177. NtReadVirtualMemory and NtWriteVirtualMemory to transfer the data
  178. to be read from or written to the file between the user buffer and the
  179. server buffer. This is a STOPGAP ONLY measure required for POSIX
  180. to work now that NTWriteFile no longer accepts a parameter specifying that
  181. the write should be done to an alternate process' data. When this code is
  182. moved out into the client and done strictly in the client's space, this
  183. code is obviously unnecessary.
  184. Currently, Console IO is caught at the client level (see IS_CONSOLE_IO
  185. in dllio.c) and vectored off to the posix.exe to do the proper windows
  186. crt read and write.. This should be done as os2 does it (os2 has all io
  187. on the client side) using a vector of functions and not special-casing.
  188. (See IoVectorArray in os2\client\dllhandl.c).
  189. 7. There are lots of places in the client code where the user parameters
  190. (ptrs to) are taken at face value and not checked. These should be probed
  191. for read and write access before using. Esp uname times time wait waitpid etc
  192. in pdxproc.c).
  193. 8. The POSIX C Runtimes (crts) are incomplete and patched together and
  194. not merged into the regular source tree. Languages (jeffrob) are
  195. supposed to do this 'any time now'. Until this work is done (which
  196. includes supplying header files that do not conflict with posix header
  197. files), building apps and tests is iffy. NIST testing is virtually
  198. impossible. Currently I have a patched together studio.h in inc\posix
  199. so that printf will work.
  200. When this work is done, mainCRTstartup() may change names. It will have
  201. to be changed in rtl/startup.c to match what is in the runtime.
  202. CONTACTS: jeffrob, gregf (jeff's boss) Get LOUP to follow up.
  203. 9. MIPS builds with only one warning - due to that fact that the MIPS
  204. version of the CONTEXT_TO_PROGRAM_COUNTER macro in ntmips.h is
  205. wrong (should be cast to a PVOID). Update - I haven't built for MIPS
  206. since March 1991.
  207. TESTING issues
  208. STAT - test 'real' code when NtQuerySecurityObject is fixed.
  209. NIST tests - SteveSc has loaded them onto a system and will try to
  210. build with the posix runtimes that mukund did last summer. THis may
  211. be a frustrating experience until we have 'real'crts and headers from
  212. languages.
  213. *************************************************************************
  214. CRT INFO - this is mail from the student who fixed up a POSIX CRT for me.
  215. This work needs to be merged into the languages CRT tree and built
  216. regularly.
  217. Here's a list of the POSIX related stuff that has to be done to assimilate the stuff back into the tree:
  218. Heap, String, Convert, Misc: The code is the same as WIN32.
  219. Stdio : Changes littered along the souce code. Could probably be put in the source tree directly.
  220. Time : An issue that will be resolved. The POSIX version is based on the C7 code, and uses floating point.
  221. Startup: Code based on WIN32 version. Only stdenvp.c and crt0msg.c has any new code.
  222. Setjmp and Lngjmp: to be done.
  223. Include files: Most of them could be put in the tree directly. There are a few POSIX specific include files
  224. (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.
  225. The POSIX source files can be found on \\crt1\vangogh in a
  226. directory called posix. The posix-specific include files can
  227. be found in \posix\psxinc.
  228. 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.
  229. Mukund
  230. The server is:
  231. \\vangogh\rdcrt1 password: QIEPCKE
  232. The tree is: \posix.
  233. -Gregf
  234. *************************************************************************
  235. RtlUnixPathToNtPath()
  236. Consult with SteveWo to sort out what should be done here.
  237. We need to be able to designate the posix file system(s) (ntfs only due
  238. to links needing to be supported) and how to translate pathname
  239. (eg \posix) to filesystem (eg what used to be \\harddiskX\partitionY\posix)
  240. for NT.
  241. Call RtlPosixPathToNtPath in client wherever a path argument is passed in.
  242. There is currently a RtlDosPathToNtPath() function to use as a guide.