- Timestamp:
- Jul 3, 2005, 5:40:02 AM (20 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/ChangeLog.LIBC
-
Property cvs2svn:cvs-rev
changed from
1.86
to1.87
r2172 r2173 13 13 o Fixed mixup in fts.c port. 14 14 o Replaced the EMX ftw with the BSD one so we implement the SuS specs. 15 o Clear FD_CLOEXEC on the handle returned by dup, dup2 and fcntl(F_DUPFD,,). 15 16 16 17 2005-07-01: knut st. osmundsen <bird-gccos2-spam@anduin.net> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/emx/io.h
-
Property cvs2svn:cvs-rev
changed from
1.17
to1.18
r2172 r2173 496 496 PLIBCFH __libc_FH(int fh); 497 497 int __libc_FHEx(int fh, __LIBC_PFH *ppFH); 498 int __libc_FHSetFlags(__LIBC_PFH pFH, int fh, unsigned fFlags); 498 499 499 500 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.128
to1.129
r2172 r2173 1891 1891 "__obstack_newchunk" @1891 1892 1892 "__std_nftw" @1892 1893 "___libc_FHSetFlags" @1893 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__dup.c
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r2172 r2173 9 9 #include <emx/io.h> 10 10 #include <emx/syscalls.h> 11 #include <sys/fcntl.h> 11 12 #include "syscalls.h" 12 13 #include "b_fs.h" … … 61 62 pFHNew->Dev = pFH->Dev; 62 63 pFHNew->pFsInfo = __libc_back_fsInfoObjAddRef(pFH->pFsInfo); 64 65 /* 66 * Clear the FD_CLOEXEC flag as per SuS. 67 */ 68 unsigned fFlags = pFH->fFlags; 69 if (fFlags & ((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT)) 70 { 71 fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT); 72 __libc_FHSetFlags(pFH, hNew,fFlags); 73 } 63 74 } 64 75 else -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__dup2.c
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r2172 r2173 8 8 #include <emx/syscalls.h> 9 9 #include <emx/io.h> 10 #include <sys/fcntl.h> 10 11 #include "syscalls.h" 11 12 #include "b_fs.h" … … 94 95 pFHNew->Dev = pFH->Dev; 95 96 pFHNew->pFsInfo = __libc_back_fsInfoObjAddRef(pFH->pFsInfo); 97 98 /* 99 * Clear the FD_CLOEXEC flag as per SuS. 100 */ 101 unsigned fFlags = pFH->fFlags; 102 if (fFlags & ((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT)) 103 { 104 fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT); 105 __libc_FHSetFlags(pFH, hNew,fFlags); 106 } 96 107 } 97 108 else -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__fcntl.c
-
Property cvs2svn:cvs-rev
changed from
1.12
to1.13
r2172 r2173 193 193 { 194 194 LIBCLOG_ENTER("pFH=%p hFile=%d arg=%#x\n", (void *)pFH, hFile, arg); 195 int rc; 196 ULONG fulState; 197 FS_VAR(); 198 199 FS_SAVE_LOAD(); 200 rc = DosQueryFHState(hFile, &fulState); 195 196 /* 197 * Calc new flags. 198 */ 199 unsigned fFlags = pFH->fFlags; 200 fFlags = (fFlags & ~__LIBC_FH_FDFLAGS_MASK) | (arg << __LIBC_FH_FDFLAGS_SHIFT); 201 if (arg & FD_CLOEXEC) 202 fFlags |= O_NOINHERIT; 203 else 204 fFlags &= ~O_NOINHERIT; 205 206 /* 207 * Update the flags. 208 */ 209 int rc = __libc_FHSetFlags(pFH, hFile, fFlags); 201 210 if (!rc) 202 {203 ULONG fulNewState;204 LIBC_ASSERTM( ( (fulState & OPEN_FLAGS_NOINHERIT) != 0 )205 == ( (pFH->fFlags & (O_NOINHERIT | (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT)))206 == (O_NOINHERIT | (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT)) ),207 "Inherit flags are out of sync for file hFile %d (%#x)! fulState=%08lx fFlags=%08x\n",208 hFile, hFile, fulState, pFH->fFlags);209 if (arg & FD_CLOEXEC)210 fulNewState = fulState | OPEN_FLAGS_NOINHERIT;211 else212 fulNewState = fulState & ~OPEN_FLAGS_NOINHERIT;213 if (fulNewState != fulState)214 {215 fulNewState &= 0x7f88; /* Mask the flags accepted the API. */216 rc = DosSetFHState(hFile, fulNewState);217 }218 }219 FS_RESTORE();220 221 if (!rc)222 {223 unsigned fFlags = pFH->fFlags;224 fFlags = (fFlags & ~__LIBC_FH_FDFLAGS_MASK) | (arg << __LIBC_FH_FDFLAGS_SHIFT);225 if (arg & FD_CLOEXEC)226 fFlags |= O_NOINHERIT;227 else228 fFlags &= ~O_NOINHERIT;229 __atomic_xchg(&pFH->fFlags, fFlags);230 211 LIBCLOG_RETURN_INT(0); 231 } 232 233 /* error! */ 234 _sys_set_errno(rc); 212 errno = -rc; 235 213 LIBCLOG_RETURN_INT(-1); 236 214 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/filehandles.c
-
Property cvs2svn:cvs-rev
changed from
1.20
to1.21
r2172 r2173 1143 1143 return rc; 1144 1144 } 1145 1146 1147 /** 1148 * Update the flags for the filehandle. 1149 * 1150 * This is a service routine for unifying the updating of the flags in 1151 * the __LIBC_FH structure. It will not call any FH operators, since 1152 * it assumes that the caller takes care of such things. 1153 * 1154 * @returns 0 on success. 1155 * @returns Negated errno on failure. 1156 * @param pFH The filehandle struct. 1157 * @param fh The filehandle. 1158 * @param fFlags The new flags. 1159 */ 1160 int __libc_FHSetFlags(__LIBC_PFH pFH, int fh, unsigned fFlags) 1161 { 1162 LIBCLOG_ENTER("pFH=%p fh=%d fFlags=%#x\n", (void *)pFH, fh, fFlags); 1163 int rc; 1164 ULONG fulState; 1165 FS_VAR(); 1166 LIBC_ASSERT(((fFlags & O_NOINHERIT) == 0) == ((fFlags & (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT)) != 0)); 1167 1168 FS_SAVE_LOAD(); 1169 rc = DosQueryFHState(fh, &fulState); 1170 if (!rc) 1171 { 1172 ULONG fulNewState; 1173 LIBC_ASSERTM( ( (fulState & OPEN_FLAGS_NOINHERIT) != 0 ) 1174 == ( (pFH->fFlags & (O_NOINHERIT | (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT))) 1175 == (O_NOINHERIT | (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT)) ), 1176 "Inherit flags are out of sync for file hFile %d (%#x)! fulState=%08lx fFlags=%08x\n", 1177 fh, fh, fulState, pFH->fFlags); 1178 if (fFlags & (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT)) 1179 fulNewState = fulState | OPEN_FLAGS_NOINHERIT; 1180 else 1181 fulNewState = fulState & ~OPEN_FLAGS_NOINHERIT; 1182 if (fulNewState != fulState) 1183 { 1184 fulNewState &= 0x7f88; /* Mask the flags accepted the API. */ 1185 rc = DosSetFHState(fh, fulNewState); 1186 } 1187 } 1188 FS_RESTORE(); 1189 1190 if (!rc) 1191 { 1192 __atomic_xchg(&pFH->fFlags, fFlags); 1193 LIBCLOG_RETURN_INT(0); 1194 } 1195 1196 rc = -__libc_native2errno(rc); 1197 LIBCLOG_RETURN_INT(rc); 1198 } 1199 1200 1145 1201 1146 1202 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.