Changeset 1519
- Timestamp:
- Sep 27, 2004, 4:15:07 AM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 29 added
- 8 deleted
- 112 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/CompileOne.sh
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 1 1 #!sh 2 2 ROOTDIR=`dirname $0` 3 OUTDIR=$ROOTDIR/../../o ut/OS2/DEBUG/emx3 OUTDIR=$ROOTDIR/../../obj/OS2/DEBUG 4 4 SRCDIR=`dirname $1` 5 5 cd $ROOTDIR -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/backend.h
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 30 30 #include <sys/cdefs.h> 31 31 #include <sys/types.h> 32 #include <emx/io.h> 32 33 33 34 __BEGIN_DECLS … … 38 39 #endif 39 40 struct statfs; 41 struct stat; 40 42 41 43 … … 82 84 83 85 84 /** @defgroup __libc_Back_fh LIBC Backend - File Handles. 85 * @{ */ 86 /** @defgroup __libc_Back_fs LIBC Backend - File System 87 * @{ */ 88 89 /** 90 * Get the statistics for the filesystem which pszPath is located on. 91 * 92 * @returns 0 on success. 93 * @returns Negative error code (errno.h) on failure. 94 * @param pszPath The path to somewhere in the filesystem. 95 * @param pStatFs Where to store the obtained information. 96 */ 97 int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs); 98 99 /** 100 * Get file system statistics 101 * 102 * @returns 0 on success. 103 * @returns Negative error code (errno.h) on failure. 104 * @param fh The filehandle of any file within the mounted file system. 105 * @param pStatFs Where to store the statistics. 106 */ 107 int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs); 108 109 /** 110 * Get the statistics for all the mounted filesystems. 111 * 112 * @returns Number of returned statfs structs on success. 113 * @returns Number of mounted filesystems on success if paStatFS is NULL 114 * @returns Negative error code (errno.h) on failure. 115 * @param paStatFs Where to to store the statistics. 116 * @param cStatFS Number of structures the array pointed to by paStatFs can hold. 117 * @param fFlags Flags, currently ignored. 118 */ 119 int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags); 120 121 /** 122 * Schedules all file system buffers for writing. 123 * 124 * See sync() for OS/2 limitations. 125 */ 126 void __libc_Back_fsSync(void); 127 128 /** 129 * Resolves the path into an canonicalized absolute path. 130 * 131 * @returns 0 on success. 132 * @returns Negative error code (errno.h) on failure. 133 * @param pszPath The path to resolve. 134 * @param pszBuf Where to store the resolved path. 135 * @param cchBuf Size of the buffer. 136 * @param fFlags At the moment 0. Which means the entire path must exist. 137 */ 138 int __libc_Back_fsPathResolve(const char *pszPath, char *pszBuf, size_t cchBuf, unsigned fFlags); 139 140 /** 141 * Changes the default drive of the process. 142 * 143 * @returns 0 on success. 144 * @returns Negative error code (errno.h) on failure. 145 * @param chDrive New default drive. 146 */ 147 int __libc_Back_fsDriveDefaultSet(char chDrive); 148 149 /** 150 * Gets the default drive of the process. 151 * 152 * @returns 0 on success. 153 * @returns Negative error code (errno.h) on failure. 154 * @param pchDrive Where to store the default drive. 155 */ 156 int __libc_Back_fsDriveDefaultGet(char *pchDrive); 157 158 /** 159 * Sets or change the unixroot of the current process. 160 * 161 * @returns 0 on success. 162 * @returns Negative error code (errno.h) on failure. 163 * @param pszNewRoot The new root. 164 */ 165 int __libc_Back_fsDirChangeRoot(const char *pszNewRoot); 166 167 /** 168 * Gets the current directory of the process on a 169 * specific drive or on the current one. 170 * 171 * @returns 0 on success. 172 * @returns Negative error code (errno.h) on failure. 173 * @param pszPath Where to store the path to the current directory. 174 * This will be prefixed with a drive letter if we're 175 * not in the unix tree. 176 * @param cchPath The size of the path buffer. 177 * @param chDrive The drive letter of the drive to get it for. 178 * If '\0' the current dir for the current drive is returned. 179 * @param fFlags Flags for skipping drive letter and slash. 180 */ 181 int __libc_Back_fsDirCurrentGet(char *pszPath, size_t cchPath, char chDrive, int fFlags); 182 183 /** Flags for __libc_Back_fsDirCurrentGet(). 184 * @{ */ 185 #define __LIBC_BACK_FSCWD_NO_DRIVE 1 186 #define __LIBC_BACK_FSCWD_NO_ROOT_SLASH 2 187 /** @} */ 188 189 /** 190 * Changes the current directory of the process. 191 * 192 * @returns 0 on success. 193 * @returns Negative error code (errno.h) on failure. 194 * @param pszPath Path to the new current directory of the process. 195 */ 196 int __libc_Back_fsDirCurrentSet(const char *pszPath); 197 198 /** 199 * Creates a new directory. 200 * 201 * @returns 0 on success. 202 * @returns Negative error code (errno.h) on failure. 203 * @param pszPath Path of the new directory. 204 * @param Mode Permissions on the created directory. 205 */ 206 int __libc_Back_fsDirCreate(const char *pszPath, mode_t Mode); 207 208 /** 209 * Removes a new directory. 210 * 211 * @returns 0 on success. 212 * @returns Negative error code (errno.h) on failure. 213 * @param pszPath Path to the directory which is to be removed. 214 */ 215 int __libc_Back_fsDirRemove(const char *pszPath); 216 217 /** 218 * Creates a symbolic link. 219 * 220 * @returns 0 on success. 221 * @returns Negative error code (errno.h) on failure. 222 * @param pszTarget The target of the symlink link. 223 * @param pszSymlink The path to the symbolic link to create. 224 */ 225 int __libc_Back_fsSymlinkCreate(const char *pszTarget, const char *pszSymlink); 226 227 /** 228 * Reads the content of a symbolic link. 229 * 230 * This is weird interface as it will return a truncated result if not 231 * enough buffer space. It is also weird in that there is no string 232 * terminator. 233 * 234 * @returns Number of bytes returned in pachBuf. 235 * @returns Negative error code (errno.h) on failure. 236 * @param pszPath The path to the symlink directory. 237 * @param pachBuf Where to store the symlink value. 238 * @param cchBuf Size of buffer. 239 */ 240 int __libc_Back_fsSymlinkRead(const char *pszPath, char *pachBuf, size_t cchBuf); 241 242 /** 243 * Stats a symbolic link. 244 * 245 * @returns 0 on success. 246 * @returns Negative error code (errno.h) on failure. 247 * @param pszPath Path to the file to stat. If this is a symbolic link 248 * the link it self will be stat'ed. 249 * @param pStat Where to store the file stats. 250 */ 251 int __libc_Back_fsSymlinkStat(const char *pszPath, struct stat *pStat); 252 253 /** 254 * Stats a file. 255 * 256 * @returns 0 on success. 257 * @returns Negative error code (errno.h) on failure. 258 * @param pszPath Path to the file to stat. 259 * @param pStat Where to store the file stats. 260 */ 261 int __libc_Back_fsFileStat(const char *pszPath, struct stat *pStat); 262 263 /** 264 * Gets the file stats for a file by filehandle. 265 * 266 * @returns 0 on success. 267 * @returns Negative error code (errno.h) on failure. The content 268 * of *pStat is undefined. 269 * @param fh Handle to file. 270 * @param pStat Where to store the stats. 271 */ 272 int __libc_Back_fsFileStatFH(int fh, struct stat *pStat); 273 274 275 /** @defgroup __libc_Back_io LIBC Backend - I/O and File Management. 276 * @{ */ 277 278 /** 279 * Opens a file. 280 * 281 * @returns Filehandle to the opened file on success. 282 * @returns Negative error code (errno.h) on failure. 283 * @param pszFile Path to the file. 284 * @param fFlags Open flags. 285 * @param cbInitial Initial filesize. 286 * @param Mode The specified permission mask. 287 * @param fLibc LIBC filehandle flags. 288 * @param ppFH Where to store the LIBC filehandle structure which was created 289 * for the opened file. 290 */ 291 int __libc_Back_ioFileOpen(const char *pszFile, int fFlags, off_t cbInitial, mode_t Mode, unsigned fLibc, PLIBCFH *ppFH); 292 293 /** 294 * Change the current position of a file stream and get the new position. 295 * 296 * @returns new file offset on success. 297 * @returns Negative error code (errno) on failure. 298 * @param hFile File handle to preform seek operation on. 299 * @param off Offset to seek to. 300 * @param iMethod The seek method. SEEK_CUR, SEEK_SET or SEEK_END. 301 */ 302 off_t __libc_Back_ioSeek(int hFile, off_t off, int iMethod); 303 304 /** 305 * Sets the size of an open file. 306 * 307 * When expanding a file the contents of the allocated 308 * space is undefined. 309 * 310 * @returns 0 on success. 311 * @returns Negative error code (errno.h) on failure. 312 * @param fh Handle to the file which size should be changed. 313 * @param cbFile The new filesize. 314 * @param fZero If set any new allocated file space will be 315 * initialized to zero. 316 */ 317 int __libc_Back_ioFileSizeSet(int fh, __off_t cbFile, int fZero); 86 318 87 319 /** … … 89 321 * 90 322 * @returns 0 on success. 91 * @returns -1 and errnoon failure.323 * @returns Negative error code (errno.h) on failure. 92 324 * @param fh The file handle. 93 325 * @param pszPath Where to store the path. 94 326 * @param cchPath The size of he buffer pointed to by pszPath. 95 327 */ 96 int __libc_Back_fhToPath(int fh, char *pszPath, size_t cchPath); 97 98 /** @} */ 99 100 101 /** @defgroup __libc_Back_fs LIBC Backend - File System 102 * @{ */ 103 104 /** 105 * Get the statistics for the filesystem which pszPath is located on. 106 * 107 * @returns 0 on success. 108 * @returns -1 and errno on failure. 109 * @param pszPath The path to somewhere in the filesystem. 110 * @param pStatFs Where to store the obtained information. 111 */ 112 int __libc_Back_fsStat(const char *pszPath, struct statfs *pStatFs); 113 114 /** 115 * Get file system statistics 116 * 117 * @returns 0 on success. 118 * @returns -1 and errno on failure. 119 * @param fh The filehandle of any file within the mounted file system. 120 * @param pStatFs Where to store the statistics. 121 */ 122 int __libc_Back_fsStatFH(int fh, struct statfs *pStatFs); 123 124 /** 125 * Get the statistics for all the mounted filesystems. 126 * 127 * @returns Number of returned statfs structs on success. 128 * @returns Number of mounted filesystems on success if paStatFS is NULL 129 * @returns -1 and errno on failure. 130 * @param paStatFs Where to to store the statistics. 131 * @param cStatFS Number of structures the array pointed to by paStatFs can hold. 132 * @param fFlags Flags, currently ignored. 133 */ 134 int __libc_Back_fsStats(struct statfs *paStatFs, unsigned cStatFs, unsigned fFlags); 135 136 /** 137 * Schedules all file system buffers for writing. 138 * 139 * See sync() for OS/2 limitations. 140 */ 141 void __libc_Back_fsSync(void); 142 143 /** 144 * Sets or change the unixroot of the current process. 145 * 146 * @returns 0 on success. 147 * @returns -1 and errno on failure. 148 * @param pszNewRoot The new root. 149 */ 150 int __libc_Back_fsChRoot(const char *pszNewRoot); 328 int __libc_Back_ioFHToPath(int fh, char *pszPath, size_t cchPath); 329 330 /** @} */ 151 331 152 332 /** @} */ … … 163 343 * 164 344 * @returns 0 on success. 165 * @returns -1 and errnoon failure.345 * @returns Negative error code (errno.h) on failure. 166 346 * @param pardAvgs Where to store the samples. 167 347 * @param cAvgs Number of samples to get. Max is 3. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/logstrict.h
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 182 182 #define __LIBC_LOG_GRP_ENV 15 183 183 184 /** Backend FS APIs. */ 185 #define __LIBC_LOG_GRP_BACK_FS 23 184 186 /** Shared Process Database and LIBC Shared Memory APIs. */ 185 187 #define __LIBC_LOG_GRP_SPM 24 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/sharedpm.h
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 178 178 typedef __LIBC_SPMINHFHBSOCK *__LIBC_PSPMINHFHBSOCK; 179 179 180 /** 181 * SPM fs inherit data. 182 */ 183 typedef struct __libc_SPMInhFS 184 { 185 /** In Unix Tree global. */ 186 int fInUnixTree; 187 /** Size of the unix root. Only set if there's an official root. */ 188 size_t cchUnixRoot; 189 /** The current unix root if cchUnixRoot is non-zero. */ 190 char szUnixRoot[1]; 191 } __LIBC_SPMINHFS; 192 /** Pointer to FS inherit data. */ 193 typedef __LIBC_SPMINHFS *__LIBC_PSPMINHFS; 194 195 180 196 181 197 /** … … 191 207 * This is a succession of bundles terminating with a _END one. */ 192 208 __LIBC_PSPMINHFHBHDR pFHBundles; 209 /** Pointer to the file system part. If NULL default values are assumed. */ 210 __LIBC_PSPMINHFS pFS; 193 211 194 212 /** @todo Add signals and the other properties which are inherited. */ … … 559 577 * 560 578 * @returns 0 on success. 561 * @returns -1 and errnoon failure.579 * @returns Negative error code (errno.h) on failure. 562 580 * @param pLoadAvg Where to store the load average samples. 563 581 * @param puTimestamp Where to store the current timestamp. … … 569 587 * 570 588 * @returns 0 on success. 571 * @returns -1 and errnoon failure.589 * @returns Negative error code (errno.h) on failure. 572 590 * @param pLoadAvg Where to store the load average samples. 573 591 */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/direct.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 59 59 char _getdrive(void); 60 60 61 /* Special LIBC addition. */ 62 #ifdef __BSD_VISIBLE 63 char *_getcwdux(char *, size_t); 64 #endif 65 61 66 __END_DECLS 62 67 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/emx/io.h
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 384 384 int __libc_FHClose(int fh); 385 385 PLIBCFH __libc_FH(int fh); 386 int __libc_FHEx(int fh, __LIBC_PFH *ppFH); 386 387 387 388 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/emx/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 120 120 121 121 122 int __accept (int handle, struct sockaddr *addr, int *paddrlen);122 //dead int __accept (int handle, struct sockaddr *addr, int *paddrlen); 123 123 unsigned __alarm (unsigned sec); 124 int __bind (int handle, __const__ struct sockaddr *addr, int addrlen);124 //dead int __bind (int handle, __const__ struct sockaddr *addr, int addrlen); 125 125 void *__brk (void *addr); 126 126 void __cgets (char *buffer); 127 int __chdir (__const__ char *name);127 //dead int __chdir (__const__ char *name); 128 128 int __chmod (__const__ char *name, int flag, int attr); 129 129 int __chdrive (char drive); 130 int __chsize (int handle, off_t length);130 //dead int __chsize (int handle, off_t length); 131 131 long long __clock (void); 132 132 int __close (int handle); 133 int __connect (int handle, __const__ struct sockaddr *addr, int addrlen);133 //dead int __connect (int handle, __const__ struct sockaddr *addr, int addrlen); 134 134 int __core (int handle); 135 135 int __dup (int handle); … … 142 142 int __findfirst (__const__ char *name, int attr, struct _find *fp); 143 143 int __findnext (struct _find *fp); 144 int __fork (void);145 int __fstat (int handle, struct stat *buffer);144 //dead int __fork (void); 145 //dead int __fstat (int handle, struct stat *buffer); 146 146 int __fsync (int handle); 147 147 void __ftime (struct timeb *ptr); 148 int __ftruncate (int handle, off_t length);149 int __getcwd (char *buffer, char drive);148 //dead int __ftruncate (int handle, off_t length); 149 //dead int __getcwd (char *buffer, char drive); 150 150 char __getdrive (void); 151 int __gethostbyaddr (__const__ char *addr, int len, int type,152 struct hostent **dst);153 int __gethostbyname (__const__ char *name, struct hostent **dst);154 int __gethostid (int *dst);155 int __gethostname (char *name, int len);156 int __getnetbyname (__const__ char *name, struct netent **dst);157 int __getnetbyaddr (long net, struct netent **dst);158 int __getpeername (int handle, struct sockaddr *name, int *pnamelen);151 //dead int __gethostbyaddr (__const__ char *addr, int len, int type, 152 //dead struct hostent **dst); 153 //dead int __gethostbyname (__const__ char *name, struct hostent **dst); 154 //dead int __gethostid (int *dst); 155 //dead int __gethostname (char *name, int len); 156 //dead int __getnetbyname (__const__ char *name, struct netent **dst); 157 //dead int __getnetbyaddr (long net, struct netent **dst); 158 //dead int __getpeername (int handle, struct sockaddr *name, int *pnamelen); 159 159 int __getpid (void); 160 160 int __getppid (void); 161 int __getprotobyname (__const__ char *name, struct protoent **dst);162 int __getprotobynumber (int prot, struct protoent **dst);163 int __getservbyname (__const__ char *name, __const__ char *proto,164 struct servent **dst);165 int __getservbyport (int port, __const__ char *proto, struct servent **dst);166 int __getsockhandle (int handle);167 int __getsockname (int handle, struct sockaddr *name, int *pnamelen);168 int __getsockopt (int handle, int level, int optname, void *optval,169 int *poptlen);170 int __imphandle (int handle);171 int __impsockhandle (int handle, int flags);161 //dead int __getprotobyname (__const__ char *name, struct protoent **dst); 162 //dead int __getprotobynumber (int prot, struct protoent **dst); 163 //dead int __getservbyname (__const__ char *name, __const__ char *proto, 164 //dead struct servent **dst); 165 //dead int __getservbyport (int port, __const__ char *proto, struct servent **dst); 166 //dead int __getsockhandle (int handle); 167 //dead int __getsockname (int handle, struct sockaddr *name, int *pnamelen); 168 //dead int __getsockopt (int handle, int level, int optname, void *optval, 169 //dead int *poptlen); 170 //dead int __imphandle (int handle); 171 //dead int __impsockhandle (int handle, int flags); 172 172 int __ioctl1 (int handle, int code); 173 173 int __ioctl2 (int handle, unsigned long request, int arg); 174 174 int __kill (int pid, int sig); 175 175 int __listen (int handle, int backlog); 176 off_t __lseek (int handle, off_t offset, int origin);176 //dead off_t __lseek (int handle, off_t offset, int origin); 177 177 int __memavail (void); 178 int __mkdir (__const__ char *name);178 //dead int __mkdir (__const__ char *name); 179 179 int __newthread (int tid); 180 180 struct __libc_FileHandle; 181 int __open (__const__ char *name, int flags, off_t size, unsigned fLibc, struct __libc_FileHandle **pFH);181 //dead int __open (__const__ char *name, int flags, off_t size, mode_t cmode, unsigned fLibc, struct __libc_FileHandle **pFH); 182 182 int __pause (void); 183 183 int __pipe(int *two_handles, int pipe_size, struct __libc_FileHandle **ppFHRead, struct __libc_FileHandle **ppFHWrite); … … 191 191 int __remove (__const__ char *name); 192 192 int __rename (__const__ char *old_name, __const__ char *new_name); 193 int __rmdir (__const__ char *name);193 //dead int __rmdir (__const__ char *name); 194 194 void *__sbrk (int incr); 195 195 void __scrsize (int *dst); 196 int __select(int nfds, struct fd_set *readfds, struct fd_set *writefds,197 struct fd_set *exceptfds, struct timeval *tv);198 int __send (int handle, __const__ void *buf, int len, unsigned flags);199 int __sendto (__const__ struct _sendto *args);200 int __setsockopt (int handle, int level, int optname, __const__ void *optval,201 int optlen);196 //dead int __select(int nfds, struct fd_set *readfds, struct fd_set *writefds, 197 //dead struct fd_set *exceptfds, struct timeval *tv); 198 //dead int __send (int handle, __const__ void *buf, int len, unsigned flags); 199 //dead int __sendto (__const__ struct _sendto *args); 200 //dead int __setsockopt (int handle, int level, int optname, __const__ void *optval, 201 //dead int optlen); 202 202 int __settime (const struct timeval *tp); 203 int __shutdown (int handle, int how);203 //dead int __shutdown (int handle, int how); 204 204 int __sigaction (int _sig, __const__ struct sigaction *_iact, 205 205 struct sigaction *_oact); … … 210 210 unsigned __sleep (unsigned sec); 211 211 unsigned __sleep2 (unsigned millisec); 212 int __socket (int domain, int type, int protocol);212 //dead int __socket (int domain, int type, int protocol); 213 213 int __spawnve (struct _new_proc *np); 214 int __stat (__const__ char *name, struct stat *buffer);214 //dead int __stat (__const__ char *name, struct stat *buffer); 215 215 int __swchar (int flag, int new_char); 216 216 int __uflags (int mask, int new_flags); 217 217 long __ulimit (int cmd, long new_limit); 218 int __umask (int pmode);218 //dead int __umask (int pmode); 219 219 void __unwind2 (void *xcpt_reg_ptr); 220 220 int __utimes (__const__ char *name, __const__ struct timeval *tvp); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/io.h
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 85 85 int truncate(const char *, off_t); 86 86 #endif 87 int umask (int);87 mode_t umask(mode_t); 88 88 int unlink (__const__ char *); 89 89 int write (int, __const__ void *, size_t); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/stdlib.h
-
Property cvs2svn:cvs-rev
changed from
1.24
to1.25
r1518 r1519 287 287 #endif /* __BSD_VISIBLE */ 288 288 289 290 291 /* bird: LIBC stuff - start */ 292 #ifdef __BSD_VISIBLE 293 char *_getcwdux(char *, size_t); 294 #endif 295 #ifdef __USE_GNU 296 char *canonicalize_file_name(const char *); 297 #endif 298 /* bird: LIBC stuff - end */ 289 299 290 300 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/unistd.h
-
Property cvs2svn:cvs-rev
changed from
1.19
to1.20
r1518 r1519 408 408 409 409 410 #if !defined(_POSIX_SOURCE) 411 412 413 #endif 414 415 410 /* 411 * LIBC additions. 412 */ 413 #ifdef __BSD_VISIBLE 414 char *_getcwdux(char *, size_t); 415 #endif 416 417 418 /* 419 * EMX stuff. 420 */ 416 421 #if !defined(_POSIX_SOURCE) || defined(_WITH_UNDERSCORE) 417 422 /** @todo update this section to match the one without underscores as far as needed! */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/_vsopen.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 10 10 #include <emx/io.h> 11 11 #include <emx/syscalls.h> 12 #include <InnoTekLIBC/backend.h> 12 13 13 14 /* Bugs: O_TRUNC|O_RDONLY not implemented */ … … 44 45 int fCtrlZKludge = 0; 45 46 off_t cbInitial; 47 mode_t cmode = 0; 46 48 PLIBCFH pFH; 47 49 … … 75 77 fFlags = (fOpen & O_ACCMODE) | (fShare & SH_MASK); 76 78 77 /* pmode(=attr) - attr is 2nd byte of flags. */79 /* cmode(=attr) - attr is 2nd byte of flags. */ 78 80 if (fOpen & O_CREAT) 79 81 { 80 int attr , pmode;82 int attr; 81 83 82 84 attr = 0; 83 pmode = va_arg(va, int);84 if (!( pmode & S_IWRITE))85 cmode = va_arg(va, mode_t); 86 if (!(cmode & S_IWRITE)) 85 87 attr |= _A_RDONLY; 86 88 fFlags |= (attr << 8) | _SO_CREAT; … … 110 112 */ 111 113 saved_errno = errno; 112 hFile = __ open(pszName, fFlags, cbInitial, fLibc, &pFH);114 hFile = __libc_Back_ioFileOpen(pszName, fFlags, cbInitial, cmode, fLibc, &pFH); 113 115 if (hFile < 0 && fCtrlZKludge && errno == EACCES) 114 116 { 115 117 /* Perhaps read access is denied. Try again. */ 116 errno = saved_errno;117 118 fCtrlZKludge = 0; 118 119 fFlags = (fFlags & ~O_ACCMODE) | (fOpen & O_ACCMODE); 119 hFile = __ open(pszName, fFlags, cbInitial, fLibc, &pFH);120 hFile = __libc_Back_ioFileOpen(pszName, fFlags, cbInitial, cmode, fLibc, &pFH); 120 121 } 121 122 if (hFile < 0) 123 { 124 errno = -hFile; 122 125 return -1; 126 } 123 127 fLibc = pFH->fFlags; /* get the updated flags. */ 124 128 … … 142 146 should be harmless. */ 143 147 144 cbSize = __l seek(hFile, -1, SEEK_END);148 cbSize = __libc_Back_ioSeek(hFile, -1, SEEK_END); 145 149 if (cbSize >= 0) 146 150 { 147 151 if (__read(hFile, &chDummy, 1) == 1 && chDummy == 0x1a) 148 __ ftruncate(hFile, cbSize); /* Remove Ctrl-Z */149 __l seek(hFile, 0L, SEEK_SET);152 __libc_Back_ioFileSizeSet(hFile, cbSize, 0); /* Remove Ctrl-Z */ 153 __libc_Back_ioSeek(hFile, 0, SEEK_SET); 150 154 } 151 155 } … … 159 163 fFlags = (fFlags & ~O_ACCMODE) | (fOpen & O_ACCMODE); 160 164 fFlags &= ~_SO_EXCL; /* Ignore O_EXCL */ 161 hFile = __ open(pszName, fFlags, cbInitial, fLibc & ~__LIBC_FH_TYPEMASK, &pFH);165 hFile = __libc_Back_ioFileOpen(pszName, fFlags, cbInitial, cmode, fLibc & ~__LIBC_FH_TYPEMASK, &pFH); 162 166 if (hFile < 0) 167 { 168 errno = -hFile; 163 169 return -1; 170 } 164 171 } 165 172 … … 170 177 if ( (fLibc & __LIBC_FH_TYPEMASK) == F_FILE 171 178 && (fLibc & O_APPEND)) 172 __l seek(hFile, 0L, SEEK_END);179 __libc_Back_ioSeek(hFile, 0, SEEK_END); 173 180 errno = saved_errno; 174 181 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/chsize.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 1 /* chsize.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * chsize. 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 3 30 #include "libc-alias.h" 4 31 #include <string.h> 5 32 #include <io.h> 6 33 #include <errno.h> 7 #include <emx/io.h> 8 #include <emx/syscalls.h> 34 #include <InnoTekLIBC/backend.h> 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO 36 #include <InnoTekLIBC/logstrict.h> 9 37 10 int _STD(chsize) (int handle, off_t length) 38 39 /** 40 * Change file size. 41 * 42 * @returns 0 on success. 43 * @returns -1 and errno on failure. 44 * @param fh Handle to the file. 45 * @param length New file size. 46 */ 47 int _STD(chsize)(int fh, off_t length) 11 48 { 12 PLIBCFH pFH; 13 off_t n; 14 15 pFH = __libc_FH(handle); 16 if ( !pFH 17 || (pFH->fFlags & F_DEV) 18 || pFH->pOps) 19 { 20 errno = EBADF; 21 return -1; 22 } 23 n = __lseek (handle, 0, SEEK_END); 24 if (n == -1) 25 return -1; 26 if (__chsize (handle, length) != 0) 27 return -1; 28 if (n < length) 29 { 30 off_t i; 31 int j; 32 char zeros[4096]; 33 bzero (zeros, sizeof (zeros)); 34 if (__lseek (handle, n, SEEK_SET) == -1) 35 return -1; 36 while (n < length) 37 { 38 i = length - n; 39 if (i > sizeof (zeros)) 40 i = sizeof (zeros); 41 j = __write (handle, zeros, i); 42 if (j == -1) 43 return -1; 44 if (j == 0) 45 { 46 errno = ENOSPC; 47 return -1; 48 } 49 n += j; 50 } 51 } 52 return 0; 49 LIBCLOG_ENTER("fh=%d length=%lld\n", fh, length); 50 int rc = __libc_Back_ioFileSizeSet(fh, length, 1); 51 if (!rc) 52 LIBCLOG_RETURN_INT(0); 53 errno = -rc; 54 LIBCLOG_RETURN_INT(-1); 53 55 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/eaccess.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/fchown.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/fileleng.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 3 3 #include "libc-alias.h" 4 4 #include <io.h> 5 #include <emx/syscalls.h> 5 #include <errno.h> 6 #include <InnoTekLIBC/backend.h> 6 7 7 off_t _STD(filelength) 8 off_t _STD(filelength)(int handle) 8 9 { 9 off_t offcur, offend; 10 11 offcur = __lseek (handle, 0L, SEEK_CUR); 12 if (offcur == -1) 10 off_t offcur = __libc_Back_ioSeek(handle, 0L, SEEK_CUR); 11 if (offcur >= 0) 12 { 13 off_t offend = __libc_Back_ioSeek(handle, 0L, SEEK_END); 14 __libc_Back_ioSeek(handle, offcur, SEEK_SET); 15 if (offend >= 0) 16 return offend; 17 } 18 errno = -offcur; 13 19 return -1; 14 offend = __lseek (handle, 0L, SEEK_END);15 __lseek (handle, offcur, SEEK_SET);16 return offend;17 20 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/fstat.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 4 4 #include <time.h> 5 5 #include <io.h> 6 #include <errno.h> 6 7 #include <sys/types.h> 7 8 #include <sys/stat.h> 8 9 #include <emx/time.h> 9 10 #include <emx/syscalls.h> 11 #include <InnoTekLIBC/backend.h> 10 12 11 13 int _STD(fstat) (int handle, struct stat *buffer) 12 14 { 13 int rc; 14 15 rc = __fstat (handle, buffer); 15 int rc = __libc_Back_fsFileStatFH (handle, buffer); 16 16 if (rc == 0) 17 17 { 18 if (!_tzset_flag) tzset (); 18 if (!_tzset_flag) 19 tzset (); 19 20 _loc2gmt (&buffer->st_atime, -1); 20 21 _loc2gmt (&buffer->st_mtime, -1); 21 22 _loc2gmt (&buffer->st_ctime, -1); 22 23 } 24 else 25 { 26 errno = -rc; 27 rc = -1; 28 } 23 29 return rc; 24 30 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/ftruncat.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 1 /* ftruncat.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes 2 -- Copyright (c) 2003 by Knut St. Osmunden */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * ftruncate(). 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 3 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 4 30 #include "libc-alias.h" 5 #include <io.h>6 31 #include <errno.h> 7 #include <emx/io.h> 8 #include <emx/syscalls.h> 32 #include <unistd.h> 33 #include <InnoTekLIBC/backend.h> 34 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO 35 #include <InnoTekLIBC/logstrict.h> 9 36 10 int _STD(ftruncate) (int handle, off_t length)37 int _STD(ftruncate)(int fh, off_t length) 11 38 { 12 PLIBCFH pFH; 39 LIBCLOG_ENTER("fh=%d length=%lld\n", fh, length); 40 int rc = __libc_Back_ioFileSizeSet(fh, length, 1); 41 if (!rc) 42 LIBCLOG_RETURN_INT(0); 43 errno = -rc; 44 LIBCLOG_RETURN_INT(-1); 45 } 13 46 14 /*15 * Get filehandle.16 */17 pFH = __libc_FH(handle);18 if (!pFH)19 {20 errno = EBADF;21 return -1;22 }23 /** @todo check this api with latest specs - there is a zero fill extension now IIRC. */24 if ((pFH->fFlags & __LIBC_FH_TYPEMASK) != F_FILE)25 {26 errno = EBADF;27 return -1;28 }29 return __ftruncate (handle, length);30 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/lchown.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/link.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/lseek.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 5 5 #include <errno.h> 6 6 #include <emx/io.h> 7 #include < emx/syscalls.h>7 #include <InnoTekLIBC/backend.h> 8 8 9 9 off_t _STD(lseek) (int handle, off_t offset, int origin) … … 17 17 pFH = __libc_FH(handle); 18 18 if (!pFH) 19 { 20 errno = EBADF; 21 return -1; 22 } 19 return -1; 23 20 24 21 if ( origin == SEEK_CUR … … 26 23 || (pFH->fFlags & F_EOF)) ) 27 24 --offset; 28 #if 0 /* not needed on OS/2 I think... */ 29 if (offset < 0) 30 { 31 off_t cur; 32 /* DOS doesn't return an error for seek before beginning of file */ 33 if (origin == SEEK_SET) 34 { 35 errno = EINVAL; 36 return -1; 37 } 38 cur = __lseek(handle, 0, SEEK_CUR); 39 if (cur == -1L) 40 return -1; 41 n = __lseek(handle, 0, origin); 42 if (n + offset < 0) 43 { 44 __lseek(handle, cur, SEEK_SET); 45 errno = EINVAL; 46 return -1; 47 } 48 offset += n; 49 origin = SEEK_SET; 50 } 51 #endif 52 n = __lseek(handle, offset, origin); 53 if (n == -1) 54 return -1; 55 else 25 n = __libc_Back_ioSeek(handle, offset, origin); 26 if (n >= 0) 56 27 { 57 28 pFH->fFlags &= ~F_EOF; /* Clear Ctrl-Z flag */ … … 59 30 return n; 60 31 } 32 errno = -n; 33 return -1; 61 34 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/stat.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 12 12 #include <emx/time.h> 13 13 #include <emx/syscalls.h> 14 #include <InnoTekLIBC/backend.h> 14 15 15 16 int _STD(stat) (const char *name, struct stat *buffer) 16 17 { 17 int rc, slash; 18 size_t len; 19 char *tmp; 20 21 /* If there is a trailing slash or backslash, remove it and set 22 `slash' to true. Make a local copy of the string to remove the 23 slash or backslash. */ 24 25 len = strlen (name); 26 slash = _trslash (name, len, 1); 27 if (slash) 28 { 29 tmp = alloca (len); 30 memcpy (tmp, name, len - 1); 31 tmp[len-1] = 0; 32 name = tmp; 33 } 34 rc = __stat (name, buffer); 18 int rc = __libc_Back_fsFileStat (name, buffer); 35 19 if (rc == 0) 36 20 { 37 if (slash && ((buffer->st_mode & S_IFMT) != S_IFDIR)) 38 { 39 errno = ENOTDIR; 40 return -1; 41 } 42 if (!_tzset_flag) tzset (); 21 if (!_tzset_flag) 22 tzset (); 43 23 _loc2gmt (&buffer->st_atime, -1); 44 24 _loc2gmt (&buffer->st_mtime, -1); 45 25 _loc2gmt (&buffer->st_ctime, -1); 46 if ((buffer->st_mode & S_IFMT) == S_IFREG)26 if ((buffer->st_mode & (S_IFMT | ((S_IEXEC >> 6) * 0111))) == S_IFREG) 47 27 { 48 tmp = _getext (name);28 const char *tmp = _getext (name); 49 29 if (tmp != NULL && 50 30 (stricmp (tmp, ".exe") == 0 || … … 55 35 } 56 36 } 37 else 38 { 39 errno = -rc; 40 rc = -1; 41 } 57 42 return rc; 58 43 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/sync.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/tell.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 5 5 #include <errno.h> 6 6 #include <emx/io.h> 7 #include < emx/syscalls.h>7 #include <InnoTekLIBC/backend.h> 8 8 9 9 off_t _STD(tell)(int handle) … … 14 14 pFH = __libc_FH(handle); 15 15 if (!pFH) 16 return -1; 17 n = __libc_Back_ioSeek(handle, 0L, SEEK_CUR); 18 if (n >= 0) 16 19 { 17 errno = EBADF; 18 return -1; 20 if (pFH->iLookAhead >= 0 || (pFH->fFlags & F_EOF)) 21 --n; 22 return n; 19 23 } 20 n = __lseek(handle, 0L, SEEK_CUR); 21 if (n == -1) 22 return n; 23 if (pFH->iLookAhead >= 0 || (pFH->fFlags & F_EOF)) 24 --n; 25 return n; 24 errno = -n; 25 return -1; 26 26 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/write.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 9 9 #include <emx/io.h> 10 10 #include <emx/syscalls.h> 11 #include <InnoTekLIBC/backend.h> 11 12 12 13 #define CTRL_Z 0x1a … … 122 123 else 123 124 { 124 off_t pos; 125 int saved_errno; 126 127 saved_errno = errno; 128 pos = __lseek (handle, -1, SEEK_CUR); 129 if (pos != -1) 130 __ftruncate (handle, pos); 131 errno = saved_errno; 125 off_t pos = __libc_Back_ioSeek (handle, -1, SEEK_CUR); 126 if (pos >= 0) 127 __libc_Back_ioFileSizeSet (handle, pos, 0); 132 128 } 133 129 } … … 149 145 pFH = __libc_FH(handle); 150 146 if (!pFH) 151 {152 errno = EBADF;153 147 return -1; 154 }155 148 156 149 if ((pFH->fFlags & (__LIBC_FH_TYPEMASK | O_APPEND)) == (O_APPEND | F_FILE)) 157 __l seek (handle, 0, SEEK_END);150 __libc_Back_ioSeek (handle, 0, SEEK_END); 158 151 if (nbyte == 0) /* Avoid truncation of file */ 159 152 return 0; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.64
to1.65
r1518 r1519 204 204 "___buf_init" @226 205 205 "___call_hash" @227 206 "___ chdir" @228206 "___libc_Back_fsDirCurrentSet" @228 207 207 "___chmod" @229 208 "___ chsize" @230208 "___libc_Back_ioFileSizeSet" @230 209 209 "___close" @231 210 210 "___collate_range_cmp" @232 … … 232 232 "___fpclassifyl" @254 233 233 "___free_ovflpage" @255 234 "___ fstat" @256234 "___libc_FHEx" @256 235 235 "___ftime" @257 236 "___ ftruncate" @258236 "___libc_Back_fsSymlinkStat" @258 237 237 "___get_buf" @259 238 238 "___get_page" @260 239 "___ getcwd" @261239 "___libc_Back_fsDirCurrentGet" @261 240 240 "__std_chroot" @262 241 241 "___hash_open" @263 … … 304 304 "___libc_TranslateCodepage" @326 305 305 "___log2" @327 306 "___l seek" @328306 "___libc_Back_ioSeek" @328 307 307 "___mempcpy" @329 308 "___ mkdir" @330309 "___ open" @331308 "___libc_Back_fsDirCreate" @330 309 "___libc_Back_ioFileOpen" @331 310 310 "___ovfl_delete" @332 311 311 "___ovfl_get" @333 … … 334 334 "___reclaim_buf" @356 335 335 "___remove_zeros" @357 336 "___ rmdir" @358336 "___libc_Back_fsDirRemove" @358 337 337 "___select" @359 338 338 "___settime" @360 … … 346 346 "___spawnve" @368 347 347 "___split_page" @369 348 "___ stat" @370348 "___libc_Back_fsFileStat" @370 349 349 "___strndup" @371 350 350 "___strnlen" @372 … … 593 593 "__std_cfsetspeed" @615 594 594 "__std_chdir" @616 595 "__ std_chdrive" @617595 "__chdrive" @617 596 596 "__std_chmod" @618 597 597 "__std_chsize" @619 … … 1120 1120 "___libc_SpmCheck" @1140 1121 1121 "___libc_Back_miscLoadAvg" @1141 1122 "___libc_Back_f hToPath" @11421122 "___libc_Back_fsFileStatFH" @1142 1123 1123 "___libc_Back_fsStat" @1143 1124 1124 "___libc_Back_fsStatFH" @1144 … … 1177 1177 "___libc_OS2ErrorSet" @1197 1178 1178 "__getdcwd" @1198 1179 "___libc_Back_fsChRoot" @1202 1179 "___libc_Back_fsDirChangeRoot" @1199 1180 "___libc_Back_fsSymlinkCreate" @1200 1181 "___libc_Back_fsSymlinkRead" @1201 1182 "___libc_Back_ioFHToPath" @1202 1180 1183 "__std_getdtablesize" @1203 1181 1184 "_strmode" @1204 1182 1185 "___strverscmp" @1205 1183 "___libc_timebomb" @1206 1186 "__getcwdux" @1206 1187 "___libc_Back_fsPathResolve" @1207 1188 "__std_canonicalize_file_name" @1208 1189 "___libc_Back_fsChRoot" @1209 1190 "___libc_Back_fsDriveDefaultGet" @1210 1191 "___libc_Back_fsDriveDefaultSet" @1211 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/__convcp.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/__do_uni.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/__from_ucs.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/__to_ucs.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/isxxx.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 15 15 * 16 16 * InnoTek LIBC is free software; you can redistribute it and/or modify 17 * it under the terms of the GNU General Public License as published by18 * the Free Software Foundation; either version 2 of the License, or17 * it under the terms of the GNU Lesser General Public License as published 18 * by the Free Software Foundation; either version 2 of the License, or 19 19 * (at your option) any later version. 20 20 * … … 22 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * GNU General Public License for more details.24 * GNU Lesser General Public License for more details. 25 25 * 26 * You should have received a copy of the GNU General Public License26 * You should have received a copy of the GNU Lesser General Public License 27 27 * along with InnoTek LIBC; if not, write to the Free Software 28 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_collate.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_ctype.c
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r1518 r1519 11 11 * 12 12 * InnoTek LIBC is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or13 * it under the terms of the GNU Lesser General Public License as published 14 * by the Free Software Foundation; either version 2 of the License, or 15 15 * (at your option) any later version. 16 16 * … … 18 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details.21 * 22 * You should have received a copy of the GNU General Public License20 * GNU Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public License 23 23 * along with InnoTek LIBC; if not, write to the Free Software 24 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_ctype_default.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_lconv.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_time.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/localeconv.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/setlocale.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 14 14 * 15 15 * InnoTek LIBC is free software; you can redistribute it and/or modify 16 * it under the terms of the GNU General Public License as published by17 * the Free Software Foundation; either version 2 of the License, or16 * it under the terms of the GNU Lesser General Public License as published 17 * by the Free Software Foundation; either version 2 of the License, or 18 18 * (at your option) any later version. 19 19 * … … 21 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details.24 * 25 * You should have received a copy of the GNU General Public License23 * GNU Lesser General Public License for more details. 24 * 25 * You should have received a copy of the GNU Lesser General Public License 26 26 * along with InnoTek LIBC; if not, write to the Free Software 27 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/_heapvoting.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1518 r1519 4 4 * Voting on default heap in High or Low memory. 5 5 * 6 *7 6 * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net> 8 7 * 9 8 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 13 14 * (at your option) any later version. 14 15 * 15 * This programis distributed in the hope that it will be useful,16 * InnoTek LIBC is distributed in the hope that it will be useful, 16 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 19 20 * 20 * You should have received a copy of the GNU General Public License21 * along with This program; if not, write to the Free Software21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 22 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 24 * -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/_hinitheap.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1518 r1519 7 7 * 8 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 12 14 * (at your option) any later version. 13 15 * 14 * This programis distributed in the hope that it will be useful,16 * InnoTek LIBC is distributed in the hope that it will be useful, 15 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 18 20 * 19 * You should have received a copy of the GNU General Public License20 * along with This program; if not, write to the Free Software21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 21 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 24 * 23 24 25 */ 25 26 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/_linitheap.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 7 7 * 8 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 12 14 * (at your option) any later version. 13 15 * 14 * This programis distributed in the hope that it will be useful,16 * InnoTek LIBC is distributed in the hope that it will be useful, 15 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 18 20 * 19 * You should have received a copy of the GNU General Public License20 * along with This program; if not, write to the Free Software21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 21 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 24 * 23 24 25 */ 25 26 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/posix_memalign.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1518 r1519 7 7 * 8 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 12 14 * (at your option) any later version. 13 15 * 14 * This programis distributed in the hope that it will be useful,16 * InnoTek LIBC is distributed in the hope that it will be useful, 15 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 18 20 * 19 * You should have received a copy of the GNU General Public License20 * along with This program; if not, write to the Free Software21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 21 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 24 * -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/_getdcwd.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 35 35 #include <sys/param.h> 36 36 #include <emx/syscalls.h> 37 #include <InnoTekLIBC/ libc.h>37 #include <InnoTekLIBC/backend.h> 38 38 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 39 39 #include <InnoTekLIBC/logstrict.h> 40 40 41 41 42 char * _getdcwd(int chDrive, char *pszBuffer, int cchBuffer) 42 /** 43 * Gets the full path of the current directory of a specific drive. 44 * 45 * @returns pszBuffer or pointer to an malloc'ed buffer containing the requested path. 46 * @returns NULL and errno on failure. 47 * @param iDrive Which drive to get the current directory of. This is 1-based, 48 * meaning that A is 1, B is 2, and so on. 0 will return the 49 * current directory of the current drive (which can be the unix root!). 50 * @param pszBuffer Where to store the current directory of the drive. 51 * If NULL a buffer will be malloc'ed. The size of the malloc'ed 52 * buffer will be cchBuffer and if cchBuffer is 0 it will be 53 * as big as necessary. 54 * @param cchBuffer Size of the buffer. 55 */ 56 char *_getdcwd(int iDrive, char *pszBuffer, int cchBuffer) 43 57 { 44 LIBCLOG_ENTER("chDrive=%d pszBuffer=%p cchBuffer=%d\n", chDrive, (void *)pszBuffer, cchBuffer); 45 char szTmp[MAXPATHLEN+1]; 46 int len; 58 LIBCLOG_ENTER("iDrive=%d pszBuffer=%p cchBuffer=%d\n", iDrive, (void *)pszBuffer, cchBuffer); 59 char chDrive = iDrive ? iDrive + 'A' - 1 : 0; 47 60 48 if (pszBuffer != NULL && cchBuffer <= 0) 61 int rc; 62 if (!pszBuffer) 49 63 { 50 errno = EINVAL; 51 LIBCLOG_RETURN_P(NULL); 52 } 53 if (__getcwd(szTmp, chDrive + 'A' - 1) < 0) 54 return NULL; 55 len = strlen(szTmp) + 4; 56 if (pszBuffer != NULL) 57 { 58 if (len > cchBuffer) 64 LIBCLOG_MSG("Allocating buffer, %d bytes.\n", cchBuffer ? cchBuffer : PATH_MAX); 65 size_t cch = cchBuffer ? cchBuffer : PATH_MAX; 66 pszBuffer = malloc(cch); 67 if (pszBuffer) 59 68 { 60 errno = ERANGE; 61 LIBCLOG_RETURN_P(NULL); 69 rc = __libc_Back_fsDirCurrentGet(pszBuffer, cchBuffer, chDrive, 0); 70 if (!rc) 71 { 72 /* 73 * Reallocate a PATH_MAX buffer before we return. 74 */ 75 if (!cchBuffer) 76 { 77 char *pvOld = pszBuffer; 78 cch = strlen(pszBuffer) + 1; 79 pszBuffer = realloc(pszBuffer, cch > cchBuffer ? cch : cchBuffer); 80 if (!pszBuffer) 81 pszBuffer = pvOld; 82 } 83 LIBCLOG_RETURN_MSG(pszBuffer, "ret %p:{%s}\n", (void *)pszBuffer, pszBuffer); 84 } 85 free(pszBuffer); 62 86 } 87 else 88 rc = -ENOMEM; 63 89 } 64 90 else 65 91 { 66 if (len > cchBuffer) 67 cchBuffer = len; 68 pszBuffer = malloc(cchBuffer); 69 if (pszBuffer == NULL) 70 { 71 errno = ENOMEM; 72 LIBCLOG_RETURN_P(NULL); 73 } 92 rc = __libc_Back_fsDirCurrentGet(pszBuffer, cchBuffer, chDrive, 0); 93 if (!rc) 94 LIBCLOG_RETURN_MSG(pszBuffer, "ret %p:{%s}\n", (void *)pszBuffer, pszBuffer); 74 95 } 75 if (!__libc_gfNoUnix) 76 { 77 _fnslashify(szTmp); 78 pszBuffer[0] = chDrive ? chDrive + 'A' - 1: _getdrive(); 79 pszBuffer[1] = ':'; 80 pszBuffer[2] = '/'; 81 memcpy(pszBuffer+3, szTmp, len - 3); 82 } 83 else 84 { 85 pszBuffer[0] = chDrive ? chDrive + 'A' - 1: _getdrive(); 86 pszBuffer[1] = ':'; 87 pszBuffer[2] = '\\'; 88 memcpy(pszBuffer+3, szTmp, len - 3); 89 } 90 LIBCLOG_RETURN_MSG(pszBuffer, "ret %p:{%s}\n", (void *)pszBuffer, pszBuffer); 96 97 errno = -rc; 98 LIBCLOG_RETURN_P(NULL); 91 99 } 92 100 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/abspath.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 10 10 #include <InnoTekLIBC/libc.h> 11 11 #include <InnoTekLIBC/locale.h> 12 #include <InnoTekLIBC/backend.h> 12 13 13 14 #define FALSE 0 … … 40 41 } 41 42 } 42 else if (__ getcwd (dir, drive) == 0)43 else if (__libc_Back_fsDirCurrentGet (dir, sizeof(dir), src_drive, __LIBC_BACK_FSCWD_NO_DRIVE | __LIBC_BACK_FSCWD_NO_ROOT_SLASH) == 0) 43 44 { 44 45 if (!__libc_gfNoUnix) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/chdir.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 1 /* chdir.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * chdir. 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 3 30 #include "libc-alias.h" 4 #include < stdlib.h>5 #include < string.h>6 # include <emx/io.h>7 #include < emx/syscalls.h>31 #include <errno.h> 32 #include <InnoTekLIBC/backend.h> 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 34 #include <InnoTekLIBC/logstrict.h> 8 35 9 int _STD(chdir) (const char *name) 36 /** 37 * Changes the current directory. 38 * 39 * @returns 0 on success. 40 * @returns -1 and errno on failure. 41 * @param path Path to the new current directory. 42 */ 43 int _STD(chdir)(const char *path) 10 44 { 11 size_t len; 12 char *tmp; 13 14 len = strlen (name); 15 if (_trslash (name, len, 1)) 16 { 17 tmp = alloca (len); 18 memcpy (tmp, name, len - 1); 19 tmp[len-1] = 0; 20 name = tmp; 21 } 22 return __chdir (name); 45 LIBCLOG_ENTER("path=%p:{%s}\n", (void *)path, path); 46 int rc = __libc_Back_fsDirCurrentSet(path); 47 if (!rc) 48 LIBCLOG_RETURN_INT(0); 49 errno = -rc; 50 LIBCLOG_RETURN_INT(-1); 23 51 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/chdir2.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1518 r1519 6 6 #include <emx/io.h> 7 7 #include <emx/syscalls.h> 8 #include <InnoTekLIBC/backend.h> 8 9 9 10 int _chdir2 (const char *name) 10 11 { 11 char old_drive, new_drive, *tmp; 12 size_t len; 13 int saved_errno; 12 char old_drive, new_drive; 14 13 15 len = strlen (name);16 if (_trslash (name, len, 1))17 {18 tmp = alloca (len);19 memcpy (tmp, name, len - 1);20 tmp[len-1] = 0;21 name = tmp;22 }23 14 old_drive = _getdrive (); 24 15 new_drive = _fngetdrive (name); … … 30 21 return 0; 31 22 } 32 if (__chdir (name) == 0) 23 int rc = __libc_Back_fsDirCurrentSet (name); 24 if (rc == 0) 33 25 return 0; 34 26 else 35 27 { 36 saved_errno = errno;37 28 _chdrive (old_drive); 38 errno = saved_errno;29 errno = -rc; 39 30 return -1; 40 31 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/chroot.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 31 31 #include "libc-alias.h" 32 32 #include <unistd.h> 33 #include <errno.h> 33 34 #include <InnoTekLIBC/backend.h> 34 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC … … 58 59 { 59 60 LIBCLOG_ENTER("pszNewRoot=%p:{%s}\n", (void *)pszNewRoot, pszNewRoot); 60 int rc = __libc_Back_fsChRoot(pszNewRoot); 61 LIBCLOG_RETURN_INT(rc); 61 int rc = __libc_Back_fsDirChangeRoot(pszNewRoot); 62 if (!rc) 63 LIBCLOG_RETURN_INT(0); 64 errno = -rc; 65 LIBCLOG_RETURN_INT(-1); 62 66 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/fstatfs.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 #include <errno.h> 32 33 #include <sys/types.h> 33 34 #include <sys/mount.h> … … 51 52 LIBCLOG_ENTER("fh=%d buf=%p\n", fh, (void *)buf); 52 53 int rc = __libc_Back_fsStatFH(fh, buf); 53 LIBCLOG_RETURN_INT(rc); 54 if (!rc) 55 LIBCLOG_RETURN_INT(0); 56 errno = -rc; 57 LIBCLOG_RETURN_INT(-1); 54 58 } 55 59 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/fullpath.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 2 2 3 3 #include "libc-alias.h" 4 #include <direct.h> 4 5 #include <stdio.h> 5 6 #include <stdlib.h> … … 14 15 { 15 16 char drive, cwd1[MAXPATHLEN+1], cwd2[MAXPATHLEN+1]; 16 char *temp , c;17 int i,j, k, add_file;17 char *temp = NULL, c, *r; 18 int j, k, add_file; 18 19 20 /* drive stuff. */ 19 21 drive = _fngetdrive (src); 20 22 if (drive == 0) … … 22 24 else 23 25 src += 2; 24 i = strlen (src); 25 temp = (char *)alloca (i+2+1); 26 temp[0] = drive; temp[1] = ':'; 27 strcpy (temp+2, src); 28 cwd1[0] = cwd2[0] = drive; 29 cwd1[1] = cwd2[1] = ':'; 30 cwd1[2] = cwd2[2] = !__libc_gfNoUnix ? '/' : '\\'; 31 if (__getcwd (cwd1+3, drive) != 0) 32 goto failure; 26 27 /* save the cwd of the drive */ 28 if (!_getdcwd(drive - 'A' + 1, cwd1, sizeof(cwd1))) 29 goto failure2; 30 31 /* try change to the specified path. */ 33 32 add_file = 0; k = 0; 34 if ( _chdir (temp) != 0)33 if (chdir (src) != 0) 35 34 { 35 int i = strlen (src); 36 temp = (char *)alloca (i+2+1); 37 temp[0] = drive; temp[1] = ':'; 38 strcpy (temp+2, src); 39 36 40 k = _getname (temp) - temp; 37 41 if (k == 3) 38 42 { 39 c = temp[k]; temp[k] = 0; 40 if (_chdir (temp) != 0) 43 c = temp[k]; 44 temp[k] = '\0'; 45 if (chdir (temp) != 0) 41 46 goto failure; 42 47 temp[k] = c; … … 44 49 else if (k > 3) 45 50 { 46 temp[k-1] = 0;47 if ( _chdir (temp) != 0)51 temp[k-1] = '\0'; 52 if (chdir (temp) != 0) 48 53 goto failure; 49 54 } 50 55 add_file = 1; 51 56 } 52 j = __getcwd (cwd2+3, drive); 53 if (_chdir (cwd1) != 0 || j != 0) 57 58 /* get the changed path. */ 59 r = _getdcwd(drive - 'A' + 1, cwd2, sizeof(cwd2)); 60 if (_chdir (cwd1) != 0 || r == NULL) 54 61 goto failure; 62 55 63 if (strlen (cwd2)+1 > size) 56 57 errno = ERANGE;64 { 65 errno = -ERANGE; 58 66 goto failure; 59 67 } 60 68 strcpy (dst, cwd2); 61 69 if (add_file && temp[k] != 0) … … 63 71 j = strlen (dst); 64 72 if (j+1+strlen (temp+k)+1 > size) 65 66 errno = ERANGE;73 { 74 errno = -ERANGE; 67 75 goto failure; 68 76 } 69 77 if (!_trslash (dst, j, 0)) 70 78 dst[j++] = !__libc_gfNoUnix ? '/' : '\\'; 71 79 strcpy (dst+j, temp+k); 72 80 } 81 73 82 if (!__libc_gfNoUnix) 74 83 _fnslashify (dst); … … 76 85 77 86 failure: 78 dst[0] = 0; 87 chdir(cwd1); 88 failure2: 89 dst[0] = '\0'; 79 90 return -1; 80 91 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getcwd.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 1 /* getcwd.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * getcwd(). 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 3 30 #include "libc-alias.h" 31 #include <unistd.h> 4 32 #include <stdlib.h> 33 #include <errno.h> 5 34 #include <string.h> 6 #include <errno.h> 7 #include <sys/param.h> 8 #include <emx/syscalls.h> 9 #include <InnoTekLIBC/libc.h> 35 #include <InnoTekLIBC/backend.h> 10 36 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 11 37 #include <InnoTekLIBC/logstrict.h> 12 38 13 char *_STD(getcwd)(char *buffer, size_t size) 39 40 /** 41 * Gets the current directory of the process. 42 * 43 * What getcwd() returns depends on the mode of the process. It will always be an 44 * absolute path as the specs says. Which means that it (now) includes a drive letter 45 * unless we're inside the unix compartment. Slashes are leaning the DOS way if the 46 * application was linked with the -Zno-unix option, else UNIX slashes are used. 47 * 48 * @returns buf on success. 49 * @returns NULL and errno on failure. 50 * @param buf Where to store the current directory. 51 * If NULL a buffer is malloc'ed. The size of a malloc'ed buffer is 52 * bufsize unless that is 0 when it'll be allocated as big as necessary. 53 * @param bufsize Size of the buffer. 54 * @remark The EMX implementation of this interface did not return a driveletter. 55 */ 56 char *_STD(getcwd)(char *buf, size_t bufsize) 14 57 { 15 LIBCLOG_ENTER("buffer=%p size=%d\n", buffer, size); 16 if (!__libc_gfNoUnix) 58 LIBCLOG_ENTER("buf=%p bufsize=%d\n", (void *)buf, bufsize); 59 60 /* 61 * For compatability with the GNU C library we must 62 * handle buf == NULL. 63 */ 64 int rc; 65 if (!buf) 17 66 { 18 char tmp[MAXPATHLEN+1];19 size_t len;20 21 if (buf fer != NULL && size == 0)67 LIBCLOG_MSG("Allocating buffer, %d bytes.\n", bufsize ? bufsize : PATH_MAX); 68 size_t cch = bufsize ? bufsize : PATH_MAX; 69 buf = malloc(cch); 70 if (buf) 22 71 { 23 errno = EINVAL; 24 LIBCLOG_RETURN_P(NULL); 25 } 26 if (__getcwd(tmp, 0) < 0) 27 return NULL; 28 len = strlen(tmp) + 2; 29 if (buffer != NULL) 30 { 31 if (len > size) 72 rc = __libc_Back_fsDirCurrentGet(buf, cch, 0, 0); 73 if (!rc) 32 74 { 33 errno = ERANGE; 34 LIBCLOG_RETURN_P(NULL); 75 /* 76 * Reallocate a PATH_MAX buffer before we return. 77 */ 78 if (!bufsize) 79 { 80 char *pvOld = buf; 81 cch = strlen(buf) + 1; 82 buf = realloc(buf, cch > bufsize ? cch : bufsize); 83 if (!buf) 84 buf = pvOld; 85 } 86 LIBCLOG_RETURN_MSG(buf, "ret %p:{%s}\n", (void *)buf, buf); 35 87 } 88 free(buf); 36 89 } 37 90 else 38 { 39 if (len > size) 40 size = len; 41 buffer = malloc(size); 42 if (buffer == NULL) 43 { 44 errno = ENOMEM; 45 LIBCLOG_RETURN_P(NULL); 46 } 47 } 48 _fnslashify(tmp); 49 buffer[0] = '/'; 50 memcpy(buffer + 1, tmp, len - 1); 51 LIBCLOG_RETURN_MSG(buffer, "ret %p:{%s}\n", (void *)buffer, buffer); 91 rc = -ENOMEM; 52 92 } 53 93 else 54 94 { 55 char *pszRet = _getcwd2(buffer, size); 56 LIBCLOG_RETURN_P(pszRet); 95 rc = __libc_Back_fsDirCurrentGet(buf, bufsize, 0, 0); 96 if (!rc) 97 LIBCLOG_RETURN_MSG(buf, "ret %p:{%s}\n", (void *)buf, buf); 57 98 } 99 100 errno = -rc; 101 LIBCLOG_RETURN_INT(NULL); 58 102 } 103 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getcwd1.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 3 3 #include "libc-alias.h" 4 4 #include <stdlib.h> 5 #include <string.h> 5 6 #include <emx/syscalls.h> 6 #include <InnoTekLIBC/ libc.h>7 #include <InnoTekLIBC/backend.h> 7 8 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 8 9 #include <InnoTekLIBC/logstrict.h> 9 10 10 int _getcwd1 11 int _getcwd1(char *buffer, char drive) 11 12 { 12 13 LIBCLOG_ENTER("buffer=%p drive=%c\n", (void *)buffer, drive); 13 if (__getcwd (buffer+1, drive) < 0) 14 LIBCLOG_RETURN_INT(-1); 15 if (!__libc_gfNoUnix) 16 { 17 _fnslashify(buffer+1); 18 buffer[0] = '/'; 19 } 20 else 21 buffer[1] = '\\'; 22 LIBCLOG_RETURN_MSG(0, "ret 0 buffer=:{%s}\n", buffer); 14 15 int rc = __libc_Back_fsDirCurrentGet(buffer, PATH_MAX, drive, __LIBC_BACK_FSCWD_NO_DRIVE); 16 if (!rc) 17 LIBCLOG_RETURN_MSG(0, "ret 0 buffer=:{%s}\n", buffer); 18 19 errno = -rc; 20 LIBCLOG_RETURN_INT(-1); 23 21 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getcwd2.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 2 2 3 3 #include "libc-alias.h" 4 #include <unistd.h> 4 5 #include <stdlib.h> 5 #include <string.h>6 #include <errno.h>7 #include <sys/param.h>8 #include <emx/syscalls.h>9 #include <InnoTekLIBC/libc.h>10 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC11 #include <InnoTekLIBC/logstrict.h>12 6 7 /** 8 * Obsolete. 9 */ 13 10 char *_getcwd2 (char *buffer, int size) 14 11 { 15 LIBCLOG_ENTER("buffer=%p size=%d\n", (void *)buffer, size); 16 char tmp[MAXPATHLEN+1]; 17 int len; 18 19 if (buffer != NULL && size <= 0) 20 { 21 errno = EINVAL; 22 LIBCLOG_RETURN_P(NULL); 23 } 24 if (__getcwd (tmp, 0) < 0) 25 return NULL; 26 len = strlen (tmp) + 4; 27 if (buffer != NULL) 28 { 29 if (len > size) 30 { 31 errno = ERANGE; 32 LIBCLOG_RETURN_P(NULL); 33 } 34 } 35 else 36 { 37 if (len > size) 38 size = len; 39 buffer = malloc(size); 40 if (buffer == NULL) 41 { 42 errno = ENOMEM; 43 LIBCLOG_RETURN_P(NULL); 44 } 45 } 46 if (!__libc_gfNoUnix) 47 { 48 _fnslashify(tmp); 49 buffer[0] = _getdrive(); 50 buffer[1] = ':'; 51 buffer[2] = '/'; 52 memcpy(buffer+3, tmp, len - 3); 53 } 54 else 55 { 56 buffer[0] = _getdrive(); 57 buffer[1] = ':'; 58 buffer[2] = '\\'; 59 memcpy(buffer+3, tmp, len - 3); 60 } 61 LIBCLOG_RETURN_MSG(buffer, "ret %p:{%s}\n", (void *)buffer, buffer); 12 return getcwd(buffer, size); 62 13 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getdtablesize.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getfsstat.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 29 29 *******************************************************************************/ 30 30 #include "libc-alias.h" 31 #include <errno.h> 31 32 #include <sys/types.h> 32 33 #include <sys/mount.h> … … 52 53 { 53 54 LIBCLOG_ENTER("buf=%p bufsize=%ld flags=%#x\n", (void *)buf, bufsize, flags); 54 55 55 int rc = __libc_Back_fsStats(buf, bufsize / sizeof(struct statfs), flags); 56 57 LIBCLOG_RETURN_INT(rc); 56 if (!rc) 57 LIBCLOG_RETURN_INT(0); 58 errno = -rc; 59 LIBCLOG_RETURN_INT(-1); 58 60 } 59 61 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getloadavg.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 62 62 LIBCLOG_ENTER("loadavg=%p nelem=%d\n", (void *)loadavg, nelem); 63 63 int rc = __libc_Back_miscLoadAvg(loadavg, nelem); 64 LIBCLOG_RETURN_INT(rc); 64 if (!rc) 65 LIBCLOG_RETURN_INT(0); 66 errno = -rc; 67 LIBCLOG_RETURN_INT(-1); 65 68 } 66 69 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getwd.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 7 7 #include <sys/param.h> 8 8 #include <emx/syscalls.h> 9 #include <InnoTekLIBC/ libc.h>9 #include <InnoTekLIBC/backend.h> 10 10 11 11 char *_STD(getwd) (char *buffer) 12 12 { 13 if ( buffer == NULL)13 if (!buffer) 14 14 { 15 15 errno = EINVAL; 16 16 return NULL; 17 17 } 18 if (__getcwd (buffer+1, 0) < 0) 18 int rc = __libc_Back_fsDirCurrentGet(buffer, MAXPATHLEN, 0, 0); 19 if (rc) 19 20 { 20 _strncpy (buffer, strerror (errno), MAXPATHLEN); 21 _strncpy (buffer, strerror (-rc), MAXPATHLEN); 22 errno = -rc; 21 23 return NULL; 22 24 } 23 if (!__libc_gfNoUnix)24 {25 _fnslashify (buffer+1);26 buffer[0] = '/';27 }28 else29 buffer[0] = '\\';30 31 25 return buffer; 32 26 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/mkdir.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 1 /* mkdir.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */2 1 2 /******************************************************************************* 3 * Header Files * 4 *******************************************************************************/ 3 5 #include "libc-alias.h" 4 6 #include <stdlib.h> 5 7 #include <errno.h> 6 8 #include <emx/syscalls.h> 9 #include <InnoTekLIBC/backend.h> 10 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 11 #include <InnoTekLIBC/logstrict.h> 7 12 8 int _STD(mkdir) (const char *name, mode_t mode) 13 14 /** 15 * Creates a directory. 16 * 17 * @returns 0 on success. 18 * @returns -1 and errno on failure. 19 * @param path Path to the new directory. 20 * @param mode Permissions. 21 */ 22 int _STD(mkdir)(const char *path, mode_t mode) 9 23 { 10 mode = 0; /* Keep the compiler happy */ 11 if (__mkdir (name) == 0) 12 return 0; 13 else 14 { 15 if (errno == EACCES) 16 errno = EEXIST; 17 return -1; 18 } 24 LIBCLOG_ENTER("path=%p:{%s} mode=o%o\n", (void *)path, path, mode); 25 int rc = __libc_Back_fsDirCreate(path, mode); 26 if (!rc) 27 LIBCLOG_RETURN_INT(0); 28 errno = -rc; 29 LIBCLOG_RETURN_INT(-1); 19 30 } 31 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/realpath.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 31 31 #include "libc-alias.h" 32 32 #include <stdlib.h> 33 #include <string.h> 34 #include <errno.h> 33 35 #include <sys/syslimits.h> 36 #include <InnoTekLIBC/backend.h> 37 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 38 #include <InnoTekLIBC/logstrict.h> 34 39 40 41 /** 42 * Gets the absolute path. 43 * The returned path contains no symlinks, '.', '..' or extra slashes. 44 * 45 * @returns Pointer to the resolved path. 46 * @returns NULL and errno on failure. 47 * @param path The path to resolve 48 * @param resolved_path Where to put the resolved path. 49 * If NULL a fitting buffer is malloc'ed. 50 */ 35 51 char *_STD(realpath)(const char *path, char resolved_path[]) 36 52 { 37 /* _abspath should do a good enough job I hope... */ 38 if (_abspath(resolved_path, path, PATH_MAX)) 39 return NULL; 40 return resolved_path; 53 LIBCLOG_ENTER("path=%p:{%s} resolved_path=%p\n", (void *)path, path, resolved_path); 54 55 int rc; 56 if (!resolved_path) 57 { 58 char *psz = malloc(PATH_MAX); 59 if (psz) 60 { 61 rc = __libc_Back_fsPathResolve(path, psz, PATH_MAX, 0); 62 if (!rc) 63 { 64 int cch = strlen(psz) + 1; 65 char *pszOld = psz; 66 psz = realloc(psz, cch); 67 if (!psz) 68 psz = pszOld; 69 LIBCLOG_RETURN_MSG(psz, "ret %p:{%s}\n", psz, psz); 70 } 71 } 72 else 73 rc = -ENOMEM; 74 free(psz); 75 } 76 else 77 { 78 rc = __libc_Back_fsPathResolve(path, resolved_path, PATH_MAX, 0); 79 if (!rc) 80 LIBCLOG_RETURN_MSG(resolved_path, "ret %p:{%s}\n", resolved_path, resolved_path); 81 } 82 83 errno = -rc; 84 LIBCLOG_RETURN_P(NULL); 41 85 } 42 86 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/rmdir.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 1 /* rmdir.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * rmdir. 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 3 30 #include "libc-alias.h" 4 #include <stdlib.h>5 31 #include <errno.h> 6 #include <emx/syscalls.h> 32 #include <InnoTekLIBC/backend.h> 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 34 #include <InnoTekLIBC/logstrict.h> 7 35 8 int _STD(rmdir) (const char *name) 36 37 int _STD(rmdir)(const char *path) 9 38 { 10 if (__rmdir (name) == 0) 11 return 0; 12 if (errno == EACCES) 13 errno = ENOTEMPTY; 14 return -1; 39 LIBCLOG_ENTER("path=%p:{%s}\n", (void *)path, path); 40 int rc = __libc_Back_fsDirRemove(path); 41 if (!rc) 42 LIBCLOG_RETURN_INT(0); 43 errno = -rc; 44 LIBCLOG_RETURN_INT(-1); 15 45 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/statfs.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 #include <errno.h> 32 33 #include <sys/types.h> 33 34 #include <sys/mount.h> … … 50 51 LIBCLOG_ENTER("path=%p:{%s} buf=%p\n", (void *)path, path, (void *)buf); 51 52 int rc = __libc_Back_fsStat(path, buf); 52 LIBCLOG_RETURN_INT(rc); 53 if (!rc) 54 LIBCLOG_RETURN_INT(0); 55 errno = -rc; 56 LIBCLOG_RETURN_INT(-1); 53 57 } 54 58 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/_atfork_callback.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 2 2 /** @file 3 3 * 4 * 4 * _atfork_callback(). 5 5 * 6 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net> … … 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/thread_internals.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/process/tls.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 270 270 * 271 271 * This is registered by the first call to __libc_TLSDestructor() and will 272 * be called back on normal thread terminations. It's function is to iterate 273 * the registered TLS destructors and calling back the registered TLS 272 * be called back on normal thread terminations. It's function is to iterate 273 * the registered TLS destructors and calling back the registered TLS 274 274 * destructors so they can perform proper per thread cleanups. 275 275 */ … … 299 299 { 300 300 /* iterate byte entry by entry. */ 301 int k = i * sizeof(unsigned) * 8 + j * 8; 302 int kEnd = k + 8; 301 int k = i * sizeof(unsigned) * 8 + j * 8; 302 int kEnd = k + 8; 303 303 while (k < kEnd) 304 304 { 305 305 void (*pfnDestructor)(void *, int, unsigned); 306 306 void *pvValue; 307 if ( __atomic_test_bit(&gauBitmap[0], k) 307 if ( __atomic_test_bit(&gauBitmap[0], k) 308 308 && k < __LIBC_TLS_MAX 309 309 && (pvValue = pThrd->apvTLS[k]) != NULL -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/386/__fork.s
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 11 11 * 12 12 * InnoTek LIBC is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or13 * it under the terms of the GNU Lesser General Public License as published 14 * by the Free Software Foundation; either version 2 of the License, or 15 15 * (at your option) any later version. 16 16 * … … 18 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details.20 * GNU Lesser General Public License for more details. 21 21 * 22 * You should have received a copy of the GNU General Public License22 * You should have received a copy of the GNU Lesser General Public License 23 23 * along with InnoTek LIBC; if not, write to the Free Software 24 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosAllocMemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 11 11 * 12 12 * InnoTek LIBC is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or13 * it under the terms of the GNU Lesser General Public License as published 14 * by the Free Software Foundation; either version 2 of the License, or 15 15 * (at your option) any later version. 16 16 * … … 18 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details.21 * 22 * You should have received a copy of the GNU General Public License20 * GNU Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public License 23 23 * along with InnoTek LIBC; if not, write to the Free Software 24 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosAllocSharedMemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosCloseEventSemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosCloseMutexSemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosCreateEventSemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosCreateMutexSemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosEx.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosEx.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosFreeMemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosGetNamedSharedMemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosGetSharedMemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosOpenEventSemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosOpenMutexSemEx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__chdir.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 1 /* sys/chdir.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 -- Copyright (c) 2003-2004 by knut st. osmundsen */ 3 4 #include "libc-alias.h" 5 #define INCL_FSMACROS 6 #include <os2emx.h> 7 #include <stdlib.h> 8 #include <errno.h> 9 #include <emx/syscalls.h> 10 #include "syscalls.h" 11 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 12 #include <InnoTekLIBC/logstrict.h> 13 #include <InnoTekLIBC/pathrewrite.h> 14 15 16 int __chdir (const char *pszPath) 17 { 18 LIBCLOG_ENTER("pszPath=%s\n", pszPath); 19 ULONG rc; 20 int cch; 21 FS_VAR(); 22 23 /* 24 * Rewrite the specified file path. 25 */ 26 cch = __libc_PathRewrite(pszPath, NULL, 0); 27 if (cch > 0) 28 { 29 char *pszRewritten = alloca(cch); 30 if (!pszRewritten) 31 { 32 errno = ENOMEM; 33 LIBCLOG_RETURN_INT(-1); 34 } 35 cch = __libc_PathRewrite(pszPath, pszRewritten, cch); 36 if (cch > 0) 37 pszPath = pszRewritten; 38 /* else happens when someone changes the rules between the two calls. */ 39 else if (cch < 0) 40 { 41 errno = EAGAIN; /* non-standard, I'm sure. */ 42 LIBCLOG_RETURN_INT(-1); 43 } 44 } 45 46 /* 47 * Change the current directory. 48 */ 49 FS_SAVE_LOAD(); 50 rc = DosSetCurrentDir((PCSZ)pszPath); 51 FS_RESTORE(); 52 if (rc != 0) 53 { 54 _sys_set_errno(rc); 55 LIBCLOG_RETURN_INT(-1); 56 57 } 58 LIBCLOG_RETURN_INT(0); 59 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__chsize.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 1 /* sys/chsize.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 Copyright (c) 2003 Dimitry Froloff 3 Copyright (c) 2003 knut st. osmundsen 4 */ 5 6 #include "libc-alias.h" 7 #define INCL_FSMACROS 8 #define INCL_ERRORS 9 #include <os2emx.h> 10 #include <emx/syscalls.h> 11 #include <emx/io.h> 12 #include <limits.h> 13 #include <errno.h> 14 #include "syscalls.h" 15 16 17 int __chsize(int fh, __off_t cbFile) 18 { 19 PLIBCFH pFH; 20 ULONG rc; 21 22 /* 23 * Get filehandle. 24 */ 25 pFH = __libc_FH(fh); 26 if (!pFH) 27 { 28 errno = EBADF; 29 return -1; 30 } 31 32 /* 33 * Do the stuff. 34 */ 35 if (!pFH->pOps) 36 { 37 FS_VAR(); 38 FS_SAVE_LOAD(); 39 #if OFF_MAX > LONG_MAX 40 if (__pfnDosSetFileSizeL) 41 rc = __pfnDosSetFileSizeL(fh, cbFile); 42 else 43 { 44 if (cbFile > LONG_MAX) 45 { 46 FS_RESTORE(); 47 errno = EOVERFLOW; 48 return -1; 49 } 50 rc = DosSetFileSize(fh, cbFile); 51 } 52 #else 53 rc = DosSetFileSize(fh, cbFile); 54 #endif 55 FS_RESTORE(); 56 } 57 else 58 { 59 /** not supported for non native filehandles. */ 60 rc = ERROR_INVALID_FUNCTION; 61 } 62 63 /* 64 * Done. 65 */ 66 if (rc) 67 { 68 _sys_set_errno(rc); 69 return -1; 70 } 71 return 0; 72 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__fcntl.c
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 11 11 #define INCL_FSMACROS 12 12 #include <os2emx.h> 13 #include "fs.h" 13 14 #include <386/builtin.h> 14 15 #include <emx/io.h> … … 267 268 FS_SAVE_LOAD(); 268 269 #if OFF_MAX > LONG_MAX 269 if (__ pfnDosOpenL)270 if (__libc_gpfnDosOpenL) 270 271 { 271 272 rc = DosQueryFileInfo(hFile, FIL_STANDARDL, &info, sizeof(info.fsts3L)); … … 339 340 #if OFF_MAX > LONG_MAX 340 341 rc = ERROR_INVALID_PARAMETER; 341 if (__ pfnDosSetFileLocksL)342 if (__libc_gpfnDosSetFileLocksL) 342 343 { 343 344 FILELOCKL aflock[2]; … … 346 347 aflock[fLock].lRange = cbRange; 347 348 FS_SAVE_LOAD(); 348 rc = __ pfnDosSetFileLocksL(hFile, &aflock[0], &aflock[1], ulTimeout, fAccess);349 rc = __libc_gpfnDosSetFileLocksL(hFile, &aflock[0], &aflock[1], ulTimeout, fAccess); 349 350 FS_RESTORE(); 350 351 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__fstat.c
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 1 /* sys/fstat.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 * sys/__fstat.c (libc) -- Copyright (c) 2003-2004 by knut st. osmundsen 3 */ 4 5 /******************************************************************************* 6 * Header Files * 7 *******************************************************************************/ 8 #include "libc-alias.h" 9 #define INCL_FSMACROS 10 #include <os2emx.h> 11 #include <string.h> 12 #include <errno.h> 13 #include <sys/types.h> 14 #include <sys/stat.h> 15 #include <emx/io.h> 16 #include <emx/syscalls.h> 17 #include <limits.h> 18 #include "syscalls.h" 19 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 20 #include <InnoTekLIBC/logstrict.h> 21 22 int __fstat(int hFile, struct stat *pStat) 23 { 24 LIBCLOG_ENTER("hFile=%d pStat=%p\n", hFile, (void *)pStat); 25 ULONG rc; 26 ULONG ulType; 27 ULONG flFlags; 28 PLIBCFH pFH; 29 FS_VAR(); 30 31 /* 32 * Get filehandle. 33 */ 34 pFH = __libc_FH(hFile); 35 if (!pFH) 36 { 37 errno = EBADF; 38 LIBCLOG_RETURN_INT(-1); 39 } 40 41 if (!pFH->pOps) 42 { 43 /* 44 * Use query handle type to figure out the file type. 45 */ 46 bzero(pStat, sizeof(*pStat)); 47 rc = DosQueryHType(hFile, &ulType, &flFlags); 48 if (rc) 49 { 50 FS_RESTORE(); 51 _sys_set_errno(rc); 52 LIBCLOG_RETURN_INT(-1); 53 } 54 switch (pFH->fFlags & __LIBC_FH_TYPEMASK) 55 { 56 case F_DEV: pStat->st_mode = S_IFCHR; break; 57 case F_SOCKET: pStat->st_mode = S_IFSOCK; break; 58 case F_PIPE: pStat->st_mode = S_IFSOCK/*??*/; break; 59 default: 60 case F_FILE: pStat->st_mode = S_IFREG; break; 61 } 62 63 FS_SAVE_LOAD(); 64 if (pStat->st_mode == S_IFREG) 65 { 66 union 67 { 68 FILESTATUS3 fsts3; 69 FILESTATUS3L fsts3L; 70 } info; 71 #if OFF_MAX > LONG_MAX 72 int fLarge = 0; 73 #endif 74 75 /* 76 * Get file info. 77 */ 78 #if OFF_MAX > LONG_MAX 79 if (__pfnDosOpenL) 80 { 81 rc = DosQueryFileInfo(hFile, FIL_STANDARDL, &info, sizeof(info.fsts3L)); 82 fLarge = 1; 83 } 84 else 85 #endif 86 rc = DosQueryFileInfo(hFile, FIL_STANDARD, &info, sizeof(info.fsts3)); 87 if (rc) 88 { 89 FS_RESTORE(); 90 _sys_set_errno (rc); 91 LIBCLOG_RETURN_INT(-1); 92 } 93 94 /* 95 * Format stats struct. 96 * We know the info struct layouts! 97 * Only cbFile, cbFileAlloc and attrFile need be accessed 98 * using the specific structure. 99 */ 100 /* Times: FAT might not return create and access time. */ 101 pStat->st_mtime = _sys_p2t(info.fsts3.ftimeLastWrite, info.fsts3.fdateLastWrite); 102 if ( FTIMEZEROP(info.fsts3.ftimeCreation) 103 && FDATEZEROP(info.fsts3.fdateCreation)) 104 pStat->st_ctime = pStat->st_mtime; 105 else 106 pStat->st_ctime = _sys_p2t(info.fsts3.ftimeCreation, info.fsts3.fdateCreation); 107 if ( FTIMEZEROP(info.fsts3.ftimeLastAccess) 108 && FDATEZEROP(info.fsts3.fdateLastAccess)) 109 pStat->st_atime = pStat->st_mtime; 110 else 111 pStat->st_atime = _sys_p2t(info.fsts3.ftimeLastAccess, info.fsts3.fdateLastAccess); 112 113 #if OFF_MAX > LONG_MAX 114 if (fLarge) 115 { 116 pStat->st_size = info.fsts3L.cbFile; 117 pStat->st_blocks = info.fsts3L.cbFileAlloc / S_BLKSIZE; 118 rc = info.fsts3L.attrFile; 119 } 120 else 121 #endif 122 { 123 pStat->st_size = info.fsts3.cbFile; 124 pStat->st_blocks = info.fsts3.cbFileAlloc / S_BLKSIZE; 125 rc = info.fsts3.attrFile; 126 } 127 pStat->st_attr = rc; 128 if (rc & FILE_READONLY) 129 pStat->st_mode |= (S_IREAD >> 6) * 0111; 130 else 131 pStat->st_mode |= ((S_IREAD|S_IWRITE) >> 6) * 0111; 132 } 133 else 134 { 135 pStat->st_size = 0; 136 rc = DosQueryFHState(hFile, &flFlags); 137 if (rc) 138 { 139 FS_RESTORE(); 140 _sys_set_errno (rc); 141 LIBCLOG_RETURN_INT(-1); 142 } 143 if ((flFlags & 7) == OPEN_ACCESS_READONLY) 144 pStat->st_mode |= (S_IREAD >> 6) * 0111; 145 else 146 pStat->st_mode |= ((S_IREAD|S_IWRITE) >> 6) * 0111; 147 } 148 149 /* default fake stuff */ 150 pStat->st_uid = 0; 151 pStat->st_gid = 0; 152 pStat->st_ino = _sys_ino++; 153 if (_sys_ino == 0) 154 _sys_ino = 1; 155 pStat->st_dev = 0; 156 pStat->st_rdev = 0; 157 pStat->st_nlink = 1; 158 pStat->st_blksize = 4096*48; 159 FS_RESTORE(); 160 } 161 else 162 { 163 /* 164 * Non-standard handle - fail. 165 */ 166 errno = EPERM; 167 LIBCLOG_RETURN_INT(-1); 168 } 169 170 LIBCLOG_MSG("st_dev: %#x\n", pStat->st_dev); 171 LIBCLOG_MSG("st_ino: %#x\n", pStat->st_ino); 172 LIBCLOG_MSG("st_mode: %#x\n", pStat->st_mode); 173 LIBCLOG_MSG("st_nlink: %u\n", pStat->st_nlink); 174 LIBCLOG_MSG("st_uid: %u\n", pStat->st_uid); 175 LIBCLOG_MSG("st_gid: %u\n", pStat->st_gid); 176 LIBCLOG_MSG("st_rdev: %#x\n", pStat->st_rdev); 177 LIBCLOG_MSG("st_atime: %d\n", pStat->st_atime); 178 LIBCLOG_MSG("st_mtime: %d\n", pStat->st_mtime); 179 LIBCLOG_MSG("st_ctime: %d\n", pStat->st_ctime); 180 LIBCLOG_MSG("st_size: %lld\n", pStat->st_size); 181 LIBCLOG_MSG("st_blocks: %lld\n", pStat->st_blocks); 182 LIBCLOG_MSG("st_blksize: %u\n", pStat->st_blksize); 183 LIBCLOG_MSG("st_attr: %ld\n", pStat->st_attr); 184 LIBCLOG_RETURN_INT(0); 185 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__ftruncate.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 1 /* sys/ftruncat.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 Copyright (c) 2003 Dimitry Froloff 3 Copyright (c) 2003 knut st. osmundsen 4 */ 5 6 #include "libc-alias.h" 7 #define INCL_FSMACROS 8 #include <os2emx.h> 9 #include <limits.h> 10 #include <errno.h> 11 #include <emx/io.h> 12 #include <emx/syscalls.h> 13 #include "syscalls.h" 14 15 int __ftruncate(int hFile, off_t cbFile) 16 { 17 ULONG rc; 18 PLIBCFH pFH; 19 20 /* 21 * Get filehandle. 22 */ 23 pFH = __libc_FH(hFile); 24 if (!pFH) 25 { 26 errno = EBADF; 27 return -1; 28 } 29 30 if (!pFH->pOps) 31 { 32 /* 33 * Standard OS/2 file handle. 34 */ 35 off_t cbCur; 36 union 37 { 38 FILESTATUS3 fsts3; 39 FILESTATUS3L fsts3L; 40 } info; 41 FS_VAR(); 42 43 /* 44 * First step, figure out the current size. 45 */ 46 FS_SAVE_LOAD(); 47 #if OFF_MAX > LONG_MAX 48 if (__pfnDosOpenL) 49 { 50 rc = DosQueryFileInfo(hFile, FIL_STANDARDL, &info, sizeof(info.fsts3L)); 51 cbCur = info.fsts3L.cbFile; 52 } 53 else 54 #endif 55 { 56 rc = DosQueryFileInfo(hFile, FIL_STANDARD, &info, sizeof(info.fsts3)); 57 cbCur = info.fsts3.cbFile; 58 } 59 FS_RESTORE(); 60 if (rc) 61 { 62 _sys_set_errno(rc); 63 return -1; 64 } 65 66 67 /* 68 * Is the file larger than the truncation size? 69 * Then set the desired file size. 70 */ 71 if (cbCur > cbFile) 72 { 73 FS_SAVE_LOAD(); 74 #if OFF_MAX > LONG_MAX 75 if (__pfnDosSetFileSizeL) 76 rc = __pfnDosSetFileSizeL(hFile, cbFile); 77 else 78 { 79 if (cbFile > __LONG_MAX) 80 { 81 FS_RESTORE(); 82 errno = EOVERFLOW; 83 return -1; 84 } 85 rc = DosSetFileSize(hFile, cbFile); 86 } 87 #else 88 rc = DosSetFileSize(hFile, cbFile); 89 #endif 90 FS_RESTORE(); 91 if (rc != 0) 92 { 93 _sys_set_errno(rc); 94 return -1; 95 } 96 } 97 } 98 else 99 { 100 /* 101 * Non-standard file handle - fail. 102 */ 103 errno = EPERM; 104 return -1; 105 } 106 return 0; 107 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__getcwd.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 1 /* sys/getcwd.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */ 2 3 #include "libc-alias.h" 4 #define INCL_FSMACROS 5 #include <os2emx.h> 6 #include <emx/syscalls.h> 7 #include "syscalls.h" 8 9 int __getcwd (char *buffer, char drive) 10 { 11 ULONG rc; 12 ULONG size; 13 FS_VAR(); 14 15 if (drive != 0) 16 drive -= 'A' - 1; 17 size = CCHMAXPATH; 18 FS_SAVE_LOAD(); 19 rc = DosQueryCurrentDir (drive, buffer, &size); 20 FS_RESTORE(); 21 if (rc != 0) 22 { 23 _sys_set_errno (rc); 24 return -1; 25 } 26 return 0; 27 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__initdll.c
-
Property cvs2svn:cvs-rev
changed from
1.14
to1.15
r1518 r1519 34 34 #include <InnoTekLIBC/fork.h> 35 35 #include "syscalls.h" 36 #include "fs.h" 36 37 #include <InnoTekLIBC/thread.h> 37 38 #include <InnoTekLIBC/libc.h> … … 181 182 182 183 /* 183 * Init long file I/O functions. 184 * This is weak, so that it's only linked in when we're building with 185 * large file support enabled. 186 */ 187 if (_sys_init_largefileio) 188 _sys_init_largefileio(); 184 * Init the file system departement. 185 */ 186 if (__libc_back_fsInit()) 187 { 188 LIBC_ASSERTM_FAILED("__libc_back_fsInit() failed\n"); 189 return -1; 190 } 189 191 190 192 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__lseek.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1518 r1519 1 /* sys/lseek.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 Copyright (c) 2003 Dimitry Froloff 3 Copyright (c) 2003 knut st. osmundsen 4 */ 5 6 #include "libc-alias.h" 7 #define INCL_FSMACROS 8 #include <os2emx.h> 9 #include <limits.h> 10 #include <errno.h> 11 #include <emx/io.h> 12 #include <emx/syscalls.h> 13 #include "syscalls.h" 14 15 off_t __lseek(int hFile, off_t off, int origin) 16 { 17 ULONG rc; 18 PLIBCFH pFH; 19 off_t cbNew; 20 FS_VAR(); 21 22 /* 23 * Get filehandle / validate input. 24 */ 25 pFH = __libc_FH(hFile); 26 if (!pFH) 27 { 28 errno = EBADF; 29 return -1; 30 } 31 if (origin == FILE_SECTOR) 32 { 33 errno = EINVAL; 34 return -1; 35 } 36 37 if (!pFH->pOps) 38 { 39 /* 40 * Standard OS/2 filehandle. 41 */ 42 FS_SAVE_LOAD(); 43 #if OFF_MAX > LONG_MAX 44 if (__pfnDosSetFilePtrL) 45 { 46 LONGLONG cbNewTmp; 47 rc = __pfnDosSetFilePtrL(hFile, off, origin, &cbNewTmp); 48 cbNew = cbNewTmp; 49 } 50 else 51 { 52 ULONG cbNewTmp; 53 if (off > LONG_MAX || off < LONG_MIN) 54 { 55 FS_RESTORE(); 56 errno = EOVERFLOW; 57 return -1; 58 } 59 rc = DosSetFilePtr(hFile, off, origin, &cbNewTmp); 60 cbNew = cbNewTmp; 61 } 62 #else 63 { 64 ULONG cbNewTmp; 65 rc = DosSetFilePtr(hFile, off, origin, &cbNewTmp); 66 cbNew = cbNewTmp; 67 } 68 #endif 69 FS_RESTORE(); 70 71 if (rc) 72 { 73 _sys_set_errno (rc); 74 return -1; 75 } 76 } 77 else 78 { 79 /* 80 * Non-standard filehandle - fail. 81 */ 82 errno = EOPNOTSUPP; 83 return -1; 84 } 85 86 return cbNew; 87 } 88 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__mkdir.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 1 /* sys/mkdir.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 -- Copyright (c) 2003-2004 by knut st. osmundsen */ 3 4 #include "libc-alias.h" 5 #define INCL_FSMACROS 6 #include <os2emx.h> 7 #include <stdlib.h> 8 #include <string.h> 9 #include <errno.h> 10 #include <emx/syscalls.h> 11 #include "syscalls.h" 12 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 13 #include <InnoTekLIBC/logstrict.h> 14 #include <InnoTekLIBC/pathrewrite.h> 15 16 17 int __mkdir(const char *pszPath) 18 { 19 LIBCLOG_ENTER("pszPath=%s\n", pszPath); 20 ULONG rc; 21 int cch; 22 char ch; 23 FS_VAR(); 24 25 /* 26 * Rewrite the specified file path. 27 */ 28 cch = __libc_PathRewrite(pszPath, NULL, 0); 29 if (cch > 0) 30 { 31 char *pszRewritten = alloca(cch); 32 if (!pszRewritten) 33 { 34 errno = ENOMEM; 35 LIBCLOG_RETURN_INT(-1); 36 } 37 cch = __libc_PathRewrite(pszPath, pszRewritten, cch); 38 if (cch > 0) 39 pszPath = pszRewritten; 40 /* else happens when someone changes the rules between the two calls. */ 41 else if (cch < 0) 42 { 43 errno = EAGAIN; /* non-standard, I'm sure. */ 44 LIBCLOG_RETURN_INT(-1); 45 } 46 } 47 48 /* 49 * Strip off any trailing slashes. 50 * (Linux and FreeBSD accept this.) 51 */ 52 if (cch <= 0) 53 { 54 cch = strlen(pszPath); 55 if ( cch > 2 56 && ((ch = pszPath[cch - 1]) == '/' || ch == '\\') 57 && pszPath[cch - 2] != ':') 58 { 59 char *psz = alloca(cch); 60 if (!psz) 61 { 62 errno = ENOMEM; 63 LIBCLOG_RETURN_INT(-1); 64 } 65 pszPath = (const char *)memcpy(psz, pszPath, cch); 66 psz[cch - 1] = '\0'; 67 } 68 } 69 else if ( cch > 3 /* includes terminator */ 70 && ((ch = pszPath[cch - 2]) == '/' || ch == '\\') 71 && pszPath[cch - 3] != ':') 72 ((char *)pszPath)[cch - 2] = '\0'; /* rewrite temp buffer. */ 73 74 75 76 /* 77 * Do It. 78 */ 79 FS_SAVE_LOAD(); 80 rc = DosCreateDir((PCSZ)pszPath, NULL); 81 FS_RESTORE(); 82 if (rc != 0) 83 { 84 _sys_set_errno(rc); 85 LIBCLOG_RETURN_INT(-1); 86 } 87 LIBCLOG_RETURN_INT(0); 88 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__open.c
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 1 /* sys/open.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 Copyright (c) 2003 Dimitry Froloff 3 Copyright (c) 2003-2004 knut st. osmundsen 4 */ 5 6 /******************************************************************************* 7 * Header Files * 8 *******************************************************************************/ 9 #include "libc-alias.h" 10 #define INCL_DOSERRORS 11 #define INCL_FSMACROS 12 #include <os2emx.h> 13 #include <string.h> 14 #include <errno.h> 15 #include <limits.h> 16 #include <emx/syscalls.h> 17 #include <emx/io.h> 18 #include <alloca.h> 19 #include "syscalls.h" 20 #include <InnoTekLIBC/pathrewrite.h> 21 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 22 #include <InnoTekLIBC/logstrict.h> 23 24 25 int __open(const char *pszFile, int flags, off_t cbInitial, unsigned fLibc, PLIBCFH *ppFH) 26 { 27 LIBCLOG_ENTER("pszFile=%s flags=%#x cbInitial=%lld fLibc=%#x ppFH=%p\n", 28 pszFile, flags, cbInitial, fLibc, (void*)ppFH); 29 ULONG rc; 30 ULONG flOpenMode; 31 ULONG flOpenFlags; 32 ULONG flAttr; 33 ULONG ulAction; 34 HFILE hFile; 35 int cch; 36 int cExpandRetries; 37 int failed_open_errno; 38 FS_VAR(); 39 40 41 /* 42 * Rewrite the specified file path. 43 */ 44 cch = __libc_PathRewrite(pszFile, NULL, 0); 45 if (cch > 0) 46 { 47 char *pszRewritten = alloca(cch); 48 if (!pszRewritten) 49 { 50 errno = ENOMEM; 51 LIBCLOG_RETURN_INT(-1); 52 } 53 cch = __libc_PathRewrite(pszFile, pszRewritten, cch); 54 if (cch > 0) 55 pszFile = pszRewritten; 56 /* else happens when someone changes the rules between the two calls. */ 57 else if (cch < 0) 58 { 59 errno = EAGAIN; /* non-standard, I'm sure. */ 60 LIBCLOG_RETURN_INT(-1); 61 } 62 } 63 64 /* 65 * Extract the access mode and sharing mode bits. 66 */ 67 flOpenMode = flags & 0x77; 68 69 /* 70 * File O_NOINHERIT and O_SYNC. 71 */ 72 if (flags & _SO_NOINHERIT) 73 flOpenMode |= OPEN_FLAGS_NOINHERIT; 74 if (flags & _SO_SYNC) 75 flOpenMode |= OPEN_FLAGS_WRITE_THROUGH; 76 77 /* 78 * Extract the file flAttribute bits. 79 */ 80 flAttr = (flags >> 8) & 0xff; 81 if (_sys_umask & 0200) 82 flAttr |= FILE_READONLY; 83 84 /* 85 * Translate ERROR_OPEN_FAILED to ENOENT unless O_EXCL is set (see below). 86 */ 87 failed_open_errno = ENOENT; 88 89 /* 90 * Compute `flOpenFlags' depending on `flags'. Note that _SO_CREAT is 91 * set for O_CREAT. 92 */ 93 if (flags & _SO_CREAT) 94 { 95 if (flags & _SO_EXCL) 96 { 97 flOpenFlags = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; 98 failed_open_errno = EEXIST; 99 } 100 else if (flags & _SO_TRUNC) 101 flOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; 102 else 103 flOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW; 104 } 105 else if (flags & _SO_TRUNC) 106 flOpenFlags = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW; 107 else 108 flOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW; 109 110 if (!(flags & _SO_SIZE)) 111 cbInitial = 0; 112 113 /* 114 * Try to open the file. 115 */ 116 FS_SAVE_LOAD(); 117 for (cExpandRetries = 0;;) 118 { 119 #if OFF_MAX > LONG_MAX 120 if (__pfnDosOpenL) 121 { 122 LONGLONG cbInitialTmp = cbInitial; 123 int cch = strlen(pszFile); 124 char * pszFile_safe = alloca(cch + 1); 125 if (pszFile_safe) 126 { 127 strcpy(pszFile_safe, pszFile); 128 rc = __pfnDosOpenL((PCSZ)pszFile_safe, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 129 } 130 else 131 rc = ERROR_NOT_ENOUGH_MEMORY; 132 } 133 else 134 { 135 ULONG cbInitialTmp = (ULONG)cbInitial; 136 if (cbInitial > LONG_MAX) 137 { 138 FS_RESTORE(); 139 errno = EOVERFLOW; 140 LIBCLOG_RETURN_INT(-1); 141 } 142 rc = DosOpen((PCSZ)pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 143 } 144 #else 145 { 146 ULONG cbInitialTmp = cbInitial; 147 rc = DosOpen((PCSZ)pszFile, &hFile, &ulAction, cbInitialTmp, flAttr, flOpenFlags, flOpenMode, NULL); 148 } 149 #endif 150 /* Check if we're out of handles. */ 151 if (rc != ERROR_TOO_MANY_OPEN_FILES) 152 break; 153 if (cExpandRetries++ >= 3) 154 break; 155 __libc_FHMoreHandles(); 156 } /* ... retry 3 times ... */ 157 158 if (!rc) 159 { 160 ULONG fulType; 161 ULONG fulDevFlags; 162 163 /* 164 * Figure the handle type. 165 */ 166 rc = DosQueryHType(hFile, &fulType, &fulDevFlags); 167 if (!rc) 168 { 169 switch (fulType & 0xff) 170 { 171 default: /* paranoia */ 172 case HANDTYPE_FILE: 173 fLibc |= F_FILE; 174 break; 175 case HANDTYPE_DEVICE: 176 fLibc |= F_DEV; 177 break; 178 case HANDTYPE_PIPE: 179 fLibc |= F_PIPE; 180 break; 181 } 182 183 /* 184 * Register the handle. 185 */ 186 rc = __libc_FHAllocate(hFile, fLibc, sizeof(LIBCFH), NULL, ppFH, NULL); 187 LIBCLOG_MSG("hFile=%#lx fLibc=%#x fulType=%#lx ulAction=%lu\n", 188 hFile, fLibc, fulType, ulAction); 189 } 190 191 if (rc) 192 DosClose(hFile); 193 } 194 FS_RESTORE(); 195 196 /* 197 * Handle any errors. 198 */ 199 if (rc) 200 { 201 if (rc == ERROR_OPEN_FAILED) 202 errno = failed_open_errno; 203 else 204 _sys_set_errno(rc); 205 LIBCLOG_RETURN_INT(-1); 206 } 207 return hFile; 208 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__rmdir.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1518 r1519 1 /* sys/rmdir.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */ 2 3 #include "libc-alias.h" 4 #define INCL_FSMACROS 5 #include <os2emx.h> 6 #include <stdlib.h> 7 #include <string.h> 8 #include <errno.h> 9 #include <emx/syscalls.h> 10 #include "syscalls.h" 11 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 12 #include <InnoTekLIBC/logstrict.h> 13 #include <InnoTekLIBC/pathrewrite.h> 14 15 int __rmdir(const char *pszPath) 16 { 17 LIBCLOG_ENTER("pszPath=%s\n", pszPath); 18 ULONG rc; 19 int cch; 20 char ch; 21 FS_VAR(); 22 23 /* 24 * Rewrite the specified file path. 25 */ 26 cch = __libc_PathRewrite(pszPath, NULL, 0); 27 if (cch > 0) 28 { 29 char *pszRewritten = alloca(cch); 30 if (!pszRewritten) 31 { 32 errno = ENOMEM; 33 LIBCLOG_RETURN_INT(-1); 34 } 35 cch = __libc_PathRewrite(pszPath, pszRewritten, cch); 36 if (cch > 0) 37 pszPath = pszRewritten; 38 /* else happens when someone changes the rules between the two calls. */ 39 else if (cch < 0) 40 { 41 errno = EAGAIN; /* non-standard, I'm sure. */ 42 LIBCLOG_RETURN_INT(-1); 43 } 44 } 45 46 /* 47 * Strip off any trailing slashes. 48 * (Linux and FreeBSD accept this.) 49 */ 50 if (cch <= 0) 51 { 52 cch = strlen(pszPath); 53 if ( cch > 2 54 && ((ch = pszPath[cch - 1]) == '/' || ch == '\\') 55 && pszPath[cch - 2] != ':') 56 { 57 char *psz = alloca(cch); 58 if (!psz) 59 { 60 errno = ENOMEM; 61 LIBCLOG_RETURN_INT(-1); 62 } 63 pszPath = (const char *)memcpy(psz, pszPath, cch); 64 psz[cch - 1] = '\0'; 65 } 66 } 67 else if ( cch > 3 /* includes terminator */ 68 && ((ch = pszPath[cch - 2]) == '/' || ch == '\\') 69 && pszPath[cch - 3] != ':') 70 ((char *)pszPath)[cch - 2] = '\0'; /* rewrite temp buffer. */ 71 72 /* 73 * Do It. 74 */ 75 FS_SAVE_LOAD(); 76 rc = DosDeleteDir((PCSZ)pszPath); 77 FS_RESTORE(); 78 if (rc) 79 { 80 _sys_set_errno(rc); 81 LIBCLOG_RETURN_INT(-1); 82 } 83 LIBCLOG_RETURN_INT(0); 84 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__spawnve.c
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 12 12 #define INCL_FSMACROS 13 13 #include <os2emx.h> 14 #include "fs.h" 14 15 #include <emx/syscalls.h> 15 16 #include <InnoTekLIBC/sharedpm.h> … … 27 28 { 28 29 LIBCLOG_ENTER("\n"); 30 __LIBC_PSPMINHERIT pRet = NULL; 31 32 /* 33 * Get FH stuff. 34 */ 29 35 size_t cbFH; 30 36 __LIBC_PSPMINHFHBHDR pFH; 31 __LIBC_PSPMINHERIT pRet = NULL;32 33 /*34 * Get FH stuff.35 */36 37 pFH = __libc_fhInheritPack(&cbFH); 37 38 if (pFH) 38 39 { 39 40 /* 40 * Allocate shared memory.41 * Get FS stuff. 41 42 */ 42 size_t cb = sizeof(__LIBC_SPMINHERIT) + ((cbFH + 3) & ~3); 43 pRet = __libc_spmAlloc(cb); 44 if (pRet) 45 { 46 pRet->cb = sizeof(*pRet); 47 pRet->pFHBundles = (__LIBC_PSPMINHFHBHDR)(pRet + 1); 48 memcpy(pRet->pFHBundles, pFH, cbFH); 49 free(pFH); 50 LIBCLOG_RETURN_P(pRet); 51 } 43 size_t cbFS; 44 __LIBC_PSPMINHFS pFS; 45 if (!__libc_back_fsInheritPack(&pFS, &cbFS)) 46 { 47 /* 48 * Allocate shared memory. 49 */ 50 size_t cb = sizeof(__LIBC_SPMINHERIT) + ((cbFH + 3) & ~3) + ((cbFS + 3) & ~3); 51 pRet = __libc_spmAlloc(cb); 52 if (pRet) 53 { 54 pRet->cb = sizeof(*pRet); 55 pRet->pFHBundles = (__LIBC_PSPMINHFHBHDR)(pRet + 1); 56 memcpy(pRet->pFHBundles, pFH, cbFH); 57 if (pFS) 58 { 59 pRet->pFS = (__LIBC_PSPMINHFS)((char *)pRet->pFHBundles + ((cbFH + 3) & ~3)); 60 memcpy(pRet->pFS, pFS, cbFS); 61 free(pFS); 62 } 63 else 64 pRet->pFS = NULL; 65 free(pFH); 66 LIBCLOG_RETURN_P(pRet); 67 } 68 free(pFS); 69 } 70 52 71 /* cleanup on failure */ 53 72 __libc_fhInheritDone(); … … 125 144 if (stricmp (base, "cmd.exe") == 0 || stricmp (base, "4os2.exe") == 0) 126 145 method = 1; 146 char szNativePath[PATH_MAX]; 147 int rc = __libc_back_fsResolve(pgm_name, BACKFS_FLAGS_RESOLVE_FULL, &szNativePath[0], NULL); 148 if (rc) 149 { 150 LIBC_ASSERTM_FAILED("Failed to resolve program name: '%s' rc=%d.\n", pgm_name, rc); 151 errno = -rc; 152 LIBCLOG_RETURN_INT(-1); 153 } 154 pgm_name = &szNativePath[0]; 127 155 128 156 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__stat.c
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1518 r1519 1 /* sys/stat.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes 2 * sys/__stat.c (libc) -- Copyright (c) 2003-2004 by knut st. osmundsen 3 */ 4 5 /******************************************************************************* 6 * Header Files * 7 *******************************************************************************/ 8 #include "libc-alias.h" 9 #define INCL_FSMACROS 10 #include <os2emx.h> 11 #include <string.h> 12 #include <errno.h> 13 #include <stdlib.h> 14 #include <sys/types.h> 15 #include <sys/stat.h> 16 #include <emx/syscalls.h> 17 #include <limits.h> 18 #include "syscalls.h" 19 #include <InnoTekLIBC/pathrewrite.h> 20 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 21 #include <InnoTekLIBC/logstrict.h> 22 23 int __stat(const char *pszPath, struct stat *pStat) 24 { 25 LIBCLOG_ENTER("pszPath=%s pStat=%p\n", pszPath, (void *)pStat); 26 ULONG rc; 27 int cch; 28 union 29 { 30 FILESTATUS3 fsts3; 31 FILESTATUS3L fsts3L; 32 } info; 33 #if OFF_MAX > LONG_MAX 34 int fLarge = 0; 35 #endif 36 FS_VAR(); 37 38 bzero(pStat, sizeof(*pStat)); 39 40 /* 41 * Rewrite the specified file path. 42 */ 43 cch = __libc_PathRewrite(pszPath, NULL, 0); 44 if (cch > 0) 45 { 46 char *pszRewritten = alloca(cch); 47 if (!pszRewritten) 48 { 49 errno = ENOMEM; 50 LIBCLOG_RETURN_INT(-1); 51 } 52 cch = __libc_PathRewrite(pszPath, pszRewritten, cch); 53 if (cch > 0) 54 pszPath = pszRewritten; 55 /* else happens when someone changes the rules between the two calls. */ 56 else if (cch < 0) 57 { 58 errno = EAGAIN; /* non-standard, I'm sure. */ 59 LIBCLOG_RETURN_INT(-1); 60 } 61 } 62 63 /* 64 * Validate input, refusing named pipes. 65 */ 66 if ( (pszPath[0] == '/' || pszPath[0] == '\\') 67 && (pszPath[1] == 'p' || pszPath[1] == 'P') 68 && (pszPath[2] == 'i' || pszPath[2] == 'I') 69 && (pszPath[3] == 'p' || pszPath[3] == 'P') 70 && (pszPath[4] == 'e' || pszPath[4] == 'E') 71 && (pszPath[5] == '/' || pszPath[5] == '\\')) 72 { 73 errno = ENOENT; 74 LIBCLOG_RETURN_INT(-1); 75 } 76 77 /* 78 * Get path info. 79 */ 80 FS_SAVE_LOAD(); 81 #if OFF_MAX > LONG_MAX 82 if (__pfnDosOpenL) 83 { 84 rc = DosQueryPathInfo((PCSZ)pszPath, FIL_STANDARDL, &info, sizeof(info.fsts3L)); 85 fLarge = 1; 86 } 87 else 88 #endif 89 rc = DosQueryPathInfo((PCSZ)pszPath, FIL_STANDARD, &info, sizeof(info.fsts3)); 90 FS_RESTORE(); 91 if (rc) 92 { 93 _sys_set_errno(rc); 94 LIBCLOG_RETURN_INT(-1); 95 } 96 97 /* 98 * Format stats struct. 99 * We know the info struct layouts! 100 * Only cbFile, cbFileAlloc and attrFile need be accessed 101 * using the specific structure. 102 */ 103 /* Times: FAT might not return create and access time. */ 104 pStat->st_mtime = _sys_p2t(info.fsts3.ftimeLastWrite, info.fsts3.fdateLastWrite); 105 if ( FTIMEZEROP(info.fsts3.ftimeCreation) 106 && FDATEZEROP(info.fsts3.fdateCreation)) 107 pStat->st_ctime = pStat->st_mtime; 108 else 109 pStat->st_ctime = _sys_p2t(info.fsts3.ftimeCreation, info.fsts3.fdateCreation); 110 if ( FTIMEZEROP(info.fsts3.ftimeLastAccess) 111 && FDATEZEROP(info.fsts3.fdateLastAccess)) 112 pStat->st_atime = pStat->st_mtime; 113 else 114 pStat->st_atime = _sys_p2t(info.fsts3.ftimeLastAccess, info.fsts3.fdateLastAccess); 115 116 #if OFF_MAX > LONG_MAX 117 rc = fLarge ? info.fsts3L.attrFile : info.fsts3.attrFile; 118 #else 119 rc = info.fsts3.attrFile; 120 #endif 121 pStat->st_attr = rc; 122 if (rc & FILE_DIRECTORY) 123 { 124 /* directory */ 125 pStat->st_mode = S_IFDIR; 126 pStat->st_mode |= ((S_IREAD|S_IWRITE|S_IEXEC) >> 6) * 0111; 127 pStat->st_size = 0; 128 } 129 else 130 { 131 #if OFF_MAX > LONG_MAX 132 if (fLarge) 133 { 134 pStat->st_size = info.fsts3L.cbFile; 135 pStat->st_blocks = info.fsts3L.cbFileAlloc / S_BLKSIZE; 136 } 137 else 138 #endif 139 { 140 pStat->st_size = info.fsts3.cbFile; 141 pStat->st_blocks = info.fsts3.cbFileAlloc / S_BLKSIZE; 142 } 143 pStat->st_mode = S_IFREG; 144 if (rc & FILE_READONLY) 145 pStat->st_mode |= (S_IREAD >> 6) * 0111; 146 else 147 pStat->st_mode |= ((S_IREAD|S_IWRITE) >> 6) * 0111; 148 } 149 /* default fake stuff */ 150 pStat->st_uid = 0; 151 pStat->st_gid = 0; 152 pStat->st_ino = _sys_ino++; 153 if (_sys_ino == 0) 154 _sys_ino = 1; 155 pStat->st_dev = 0; 156 pStat->st_rdev = 0; 157 pStat->st_nlink = 1; 158 pStat->st_blksize = 4096*48; 159 160 LIBCLOG_MSG("st_dev: %#x\n", pStat->st_dev); 161 LIBCLOG_MSG("st_ino: %#x\n", pStat->st_ino); 162 LIBCLOG_MSG("st_mode: %#x\n", pStat->st_mode); 163 LIBCLOG_MSG("st_nlink: %u\n", pStat->st_nlink); 164 LIBCLOG_MSG("st_uid: %u\n", pStat->st_uid); 165 LIBCLOG_MSG("st_gid: %u\n", pStat->st_gid); 166 LIBCLOG_MSG("st_rdev: %#x\n", pStat->st_rdev); 167 LIBCLOG_MSG("st_atime: %d\n", pStat->st_atime); 168 LIBCLOG_MSG("st_mtime: %d\n", pStat->st_mtime); 169 LIBCLOG_MSG("st_ctime: %d\n", pStat->st_ctime); 170 LIBCLOG_MSG("st_size: %lld\n", pStat->st_size); 171 LIBCLOG_MSG("st_blocks: %lld\n", pStat->st_blocks); 172 LIBCLOG_MSG("st_blksize: %u\n", pStat->st_blksize); 173 LIBCLOG_MSG("st_attr: %ld\n", pStat->st_attr); 174 LIBCLOG_RETURN_INT(0); 175 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_fsStat.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 #include "fs.h" 32 33 #include <stdlib.h> 33 34 #include <string.h> … … 37 38 #include <sys/syslimits.h> 38 39 #include <InnoTekLIBC/backend.h> 39 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK END40 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 40 41 #include <InnoTekLIBC/logstrict.h> 41 42 … … 55 56 * 56 57 * @returns 0 on success. 57 * @returns -1 and errnoon failure.58 * @returns Negative error code (errno.h) on failure. 58 59 * @param pszPath The path to somewhere in the filesystem. 59 60 * @param pStatFs Where to store the obtained information. … … 67 68 */ 68 69 if (!pStatFs) 69 { 70 errno = EFAULT; 71 LIBCLOG_RETURN_INT(-1); 72 } 70 LIBCLOG_RETURN_INT(-EFAULT); 73 71 74 72 /* 75 73 * Make absolute path (but no symlink resolving I think). 76 74 */ 77 char szPath[PATH_MAX]; 78 if (_abspath(szPath, pszPath, sizeof(szPath))) 79 LIBCLOG_RETURN_INT(-1); 75 /** @todo Check if fsstat() can work on a non-existing path spec. */ 76 char szNativePath[PATH_MAX]; 77 int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL, &szNativePath[0], NULL); 78 if (rc) 79 LIBCLOG_RETURN_INT(rc); 80 80 81 81 /* 82 82 * Do the query. 83 83 */ 84 sz Path[2] = '\0';85 int rc = fsStatInternal(szPath, pStatFs);84 szNativePath[2] = '\0'; 85 rc = fsStatInternal(&szNativePath[0], pStatFs); 86 86 87 87 LIBCLOG_RETURN_INT(rc); … … 94 94 * 95 95 * @returns 0 on success. 96 * @returns -1 and errnoon failure.96 * @returns Negative error code (errno.h) on failure. 97 97 * @param fh The filehandle of any file within the mounted file system. 98 98 * @param pStatFs Where to store the statistics. … … 106 106 */ 107 107 if (!pStatFs) 108 { 109 errno = EFAULT; 110 LIBCLOG_RETURN_INT(-1); 111 } 108 LIBCLOG_RETURN_INT(-EFAULT); 112 109 113 110 /* … … 116 113 */ 117 114 char szFilename[PATH_MAX]; 118 int rc = __libc_Back_ fhToPath(fh, szFilename, sizeof(szFilename));115 int rc = __libc_Back_ioFHToPath(fh, szFilename, sizeof(szFilename)); 119 116 if (!rc) 120 117 { … … 133 130 * @returns Number of returned statfs structs on success. 134 131 * @returns Number of mounted filesystems on success if paStatFS is NULL 135 * @returns -1 and errnoon failure.132 * @returns Negative error code (errno.h) on failure. 136 133 * @param paStatFs Where to to store the statistics. 137 134 * @parma cStatFS Number of structures the array pointed to by paStatFs can hold. … … 178 175 * 179 176 * @returns 0 on success. 180 * @returns -1 and errnoon failure.177 * @returns Negative error code (errno.h) on failure. 181 178 * @param pszMountPoint Path to the filesystem mount point. 182 179 * @param pStatFs Where to store the statistics. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_fsSync.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 31 31 #include "libc-alias.h" 32 32 #include <InnoTekLIBC/backend.h> 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK END33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 34 34 #include <InnoTekLIBC/logstrict.h> 35 35 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_miscLoadAvg.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 177 177 { 178 178 LIBC_ASSERTM_FAILED("Invalid address!\n"); 179 errno = EFAULT; 180 LIBCLOG_RETURN_INT(-1); 179 LIBCLOG_RETURN_INT(-EFAULT); 181 180 } 182 181 … … 186 185 rc = __libc_spmGetLoadAvg(&LoadAvg, &uTimestamp); 187 186 if (rc) 188 LIBCLOG_RETURN_INT( -1);187 LIBCLOG_RETURN_INT(rc); 189 188 if (uTimestamp - LoadAvg.uTimestamp > 5000 /* 5sec */) 190 189 { 191 190 rc = miscUpdateLoadAvg(&LoadAvg, uTimestamp); 192 191 if (rc) 193 LIBCLOG_RETURN_INT( -1);192 LIBCLOG_RETURN_INT(rc); 194 193 } 195 194 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadCleanup.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadEnd.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadInit.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_threadStartup.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/filefind.c
-
Property cvs2svn:cvs-rev
changed from
1.9
to1.10
r1518 r1519 7 7 *******************************************************************************/ 8 8 #include "libc-alias.h" 9 #define INCL_BASE 10 #define INCL_FSMACROS 11 #include <os2emx.h> 12 #include "fs.h" 9 13 #include <stdlib.h> 10 14 #include <string.h> 11 15 #include <errno.h> 12 16 #include <limits.h> 13 #define INCL_BASE14 #define INCL_FSMACROS15 #include <os2emx.h>16 17 #include <emx/syscalls.h> 17 18 #include "syscalls.h" … … 170 171 pFD->cFiles = sizeof(pFD->achBuffer) / 40; 171 172 #if OFF_MAX > LONG_MAX 172 pFD->fType = __ pfnDosOpenL ? FIL_STANDARDL : FIL_STANDARD;173 pFD->fType = __libc_gpfnDosOpenL ? FIL_STANDARDL : FIL_STANDARD; 173 174 if (pFD->fType == FIL_STANDARDL) /* the L version is buggy!! Make sure there is enough space. */ 174 175 pFD->cFiles = sizeof(pFD->achBuffer) / sizeof(FILEFINDBUF3L); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/filehandles.c
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r1518 r1519 7 7 * 8 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 12 14 * (at your option) any later version. 13 15 * 14 * This programis distributed in the hope that it will be useful,16 * InnoTek LIBC is distributed in the hope that it will be useful, 15 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details.18 * 19 * You should have received a copy of the GNU General Public License20 * along with This program; if not, write to the Free Software19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 21 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 24 * … … 1050 1052 * @returns NULL on failure. 1051 1053 * @param fh Handle to lookup. 1054 * @deprecated 1052 1055 */ 1053 1056 __LIBC_PFH __libc_FH(int fh) … … 1065 1068 } 1066 1069 1070 1071 /** 1072 * Get the LIBC handle structure corresponding to a filehandle. 1073 * 1074 * @returns Pointer to handle structure on success. 1075 * @returns Negative error code (errno.h) on failure. 1076 * @param fh Handle to lookup. 1077 * @param ppFH Where to store the filehandle pointer 1078 */ 1079 int __libc_FHEx(int fh, __LIBC_PFH *ppFH) 1080 { 1081 __LIBC_PFH pFH; 1082 1083 /** @todo shared access */ 1084 int rc = _fmutex_request(&gmtx, 0); 1085 if (rc) 1086 return -__libc_native2errno(rc); 1087 1088 /** @todo rewrite fhGet() to avoid this errno saving and restoring. */ 1089 int errno_saved = errno; 1090 pFH = fhGet(fh); 1091 rc = -errno; 1092 errno = errno_saved; 1093 1094 _fmutex_release(&gmtx); 1095 if (pFH) 1096 { 1097 *ppFH = pFH; 1098 return 0; 1099 } 1100 return rc; 1101 } 1067 1102 1068 1103 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/fs.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 30 30 *******************************************************************************/ 31 31 #include "libc-alias.h" 32 #include "fs.h"33 32 #define INCL_FSMACROS 34 33 #define INCL_BASE 35 34 #define INCL_ERRORS 36 35 #include <os2emx.h> 36 #include "fs.h" 37 37 #define __USE_GNU 38 #include <stddef.h> 38 39 #include <string.h> 39 40 #include <errno.h> … … 45 46 #include <InnoTekLIBC/pathrewrite.h> 46 47 #include <InnoTekLIBC/libc.h> 47 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_ IO48 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 48 49 #include <InnoTekLIBC/logstrict.h> 50 51 52 /******************************************************************************* 53 * Defined Constants And Macros * 54 *******************************************************************************/ 55 #define ORD_DOS32OPENL 981 56 #define ORD_DOS32SETFILEPTRL 988 57 #define ORD_DOS32SETFILESIZEL 989 58 #define ORD_DOS32SETFILELOCKSL 986 59 60 #define SIZEOF_ACHBUFFER (sizeof(FILEFINDBUF4) + 32) 49 61 50 62 … … 52 64 * Global Variables * 53 65 *******************************************************************************/ 54 /** Mutex protecting all the FS globals. */ 66 /** Mutex protecting all the FS globals. 67 * __libc_gfsUMask and the API pointers are not protected by this semaphore. */ 55 68 static _fmutex __libc_gmtxFS; 56 69 57 70 /** Indicator whether or not we're in the unix tree. */ 58 int __libc_gfInUnixTree = 0;71 int __libc_gfInUnixTree = 0; 59 72 /** Length of the unix root if the unix root is official. */ 60 int __libc_gcchUnixRoot = 0;73 int __libc_gcchUnixRoot = 0; 61 74 /** The current unix root. */ 62 char __libc_gszUnixRoot[PATH_MAX]; 63 64 75 char __libc_gszUnixRoot[PATH_MAX]; 76 /** The umask of the process. */ 77 mode_t __libc_gfsUMask = 022; 78 79 80 ULONG (* _System __libc_gpfnDosOpenL)(PCSZ pszFileName, PHFILE phFile, PULONG pulAction, LONGLONG llFileSize, ULONG ulAttribute, ULONG ulOpenFlags, ULONG ulOpenMode, PEAOP2 pEABuf) = NULL; 81 ULONG (* _System __libc_gpfnDosSetFilePtrL)(HFILE hFile, LONGLONG llOffset, ULONG ulOrigin, PLONGLONG pllPos) = NULL; 82 ULONG (* _System __libc_gpfnDosSetFileSizeL)(HFILE hFile, LONGLONG cbSize) = NULL; 83 ULONG (* _System __libc_gpfnDosSetFileLocksL)(HFILE hFile, __const__ FILELOCKL *pflUnlock, __const__ FILELOCKL *pflLock, ULONG ulTimeout, ULONG flFlags) = NULL; 84 85 /** Symlink EA name. */ 65 86 #define EA_SYMLINK "LIBC.SYMLINK" 87 66 88 /** Symlink ea name. */ 67 89 const char __libc_gszSymlinkEA[] = EA_SYMLINK; … … 91 113 92 114 93 94 115 /******************************************************************************* 95 116 * Internal Functions * 96 117 *******************************************************************************/ 97 static int fsInit(void); 98 static int fsResolveUnix(const char *pszUserPath, int fVerifyLast, char *pszNativePath, size_t cchNativePath, int *pfInUnixTree); 99 100 101 102 _CRT_INIT1(fsInit) 118 static int fsResolveUnix(const char *pszUserPath, unsigned fFlags, char *pszNativePath, int *pfInUnixTree); 119 120 103 121 104 122 /** … … 108 126 * @returns -1 on failure. 109 127 */ 110 static intfsInit(void)128 int __libc_back_fsInit(void) 111 129 { 112 130 LIBCLOG_ENTER("\n"); … … 115 133 * Only once. 116 134 */ 117 static void *pvCalled = (void *)fsInit;118 if ( !pvCalled)135 static int fInited; 136 if (fInited) 119 137 LIBCLOG_RETURN_INT(0); 120 pvCalled = NULL; 121 138 fInited = 1; 122 139 123 140 /* … … 126 143 int rc = _fmutex_create(&__libc_gmtxFS, 0); 127 144 if (rc) 128 abort();129 130 /* 131 * Inherit stuff.145 LIBCLOG_RETURN_INT(-1); 146 147 /* 148 * Inherit File System Data from parent. 132 149 */ 133 150 __LIBC_PSPMINHERIT pInherit = __libc_spmInheritRequest(); 134 151 __LIBC_PSPMINHFS pFS; 135 if (pInherit && (pFS = pInherit->pFS) != NULL && pFS->cchUnixRoot) 136 { 137 LIBCLOG_MSG("Inherited unixroot=%s\n", pFS->szUnixRoot); 138 __libc_gfInUnixTree = pFS->fInUnix; 152 if ( pInherit 153 && pInherit->cb > offsetof(__LIBC_SPMINHERIT, pFS) 154 && (pFS = pInherit->pFS) != NULL 155 && pFS->cchUnixRoot) 156 { 157 LIBCLOG_MSG("Inherited unixroot=%s fInUnixTree=%d cchUnixRoot=%d\n", pFS->szUnixRoot, pFS->fInUnixTree, pFS->cchUnixRoot); 158 __libc_gfNoUnix = 0; 159 __libc_gfInUnixTree = pFS->fInUnixTree; 139 160 __libc_gcchUnixRoot = pFS->cchUnixRoot; 140 161 memcpy(&__libc_gszUnixRoot[0], &pFS->szUnixRoot[0], pFS->cchUnixRoot + 1); … … 146 167 gaRewriteRule.cchTo = 1; 147 168 if (__libc_PathRewriteAdd(&gaRewriteRule, 1)) 148 {149 abort();150 169 LIBCLOG_RETURN_INT(-1); 151 }152 170 } 153 171 else … … 171 189 { 172 190 LIBC_ASSERTM_FAILED("The UNIXROOT environment variable is too long! cch=%d maxlength=%d\n", cch, PATH_MAX - 32); 173 abort();174 191 LIBCLOG_RETURN_INT(-1); 175 192 } … … 179 196 gaRewriteRule.cchTo = cch; 180 197 if (__libc_PathRewriteAdd(&gaRewriteRule, 1)) 181 {182 abort();183 198 LIBCLOG_RETURN_INT(-1); 184 } 185 } 186 } 187 } 199 } 200 } 201 } 202 203 204 /* 205 * Try resolve large file APIs. 206 * 207 * First, get a handle to DOSCALLS/DOSCALL1 which is suitable 208 * for DosQueryProcAddr. 209 * Second, query the procedure addresses. 210 * Third, free DOSCALLS since there's no point messing up any 211 * reference counters for that module. 212 */ 213 HMODULE hmod = NULLHANDLE; 214 if (DosLoadModule(NULL, 0, (PCSZ)"DOSCALLS", &hmod)) 215 { 216 LIBC_ASSERTM_FAILED("DosLoadModule failed on doscalls!\n"); 217 abort(); 218 LIBCLOG_RETURN_INT(-1); 219 } 220 if ( DosQueryProcAddr(hmod, ORD_DOS32OPENL, NULL, (PFN*)(void *)&__libc_gpfnDosOpenL) 221 || DosQueryProcAddr(hmod, ORD_DOS32SETFILEPTRL, NULL, (PFN*)(void *)&__libc_gpfnDosSetFilePtrL) 222 || DosQueryProcAddr(hmod, ORD_DOS32SETFILESIZEL, NULL, (PFN*)(void *)&__libc_gpfnDosSetFileSizeL) 223 || DosQueryProcAddr(hmod, ORD_DOS32SETFILELOCKSL, NULL, (PFN*)(void *)&__libc_gpfnDosSetFileLocksL) 224 ) 225 { 226 __libc_gpfnDosOpenL = NULL; 227 __libc_gpfnDosSetFilePtrL = NULL; 228 __libc_gpfnDosSetFileSizeL = NULL; 229 __libc_gpfnDosSetFileLocksL = NULL; 230 } 231 DosFreeModule(hmod); 188 232 189 233 LIBCLOG_RETURN_INT(0); 234 } 235 236 /** 237 * Pack inherit data. 238 * @returns 0 on success. 239 * @returns -1 on failure. 240 * @param ppFS Where to store the pointer to the inherit data. 241 * @param pcbFS Where to store the size of the inherit data. 242 */ 243 int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS) 244 { 245 LIBCLOG_ENTER("ppFS=%p pcbFS=%p\n", (void *)ppFS, (void *)pcbFS); 246 247 *ppFS = NULL; 248 *pcbFS = 0; 249 250 if (__libc_back_fsMutexRequest()) 251 return -1; 252 253 int rc = 0; 254 if (__libc_gcchUnixRoot) 255 { 256 size_t cb = sizeof(__LIBC_SPMINHFS) + __libc_gcchUnixRoot; 257 __LIBC_PSPMINHFS pFS = (__LIBC_PSPMINHFS)malloc(cb); 258 if (pFS) 259 { 260 pFS->fInUnixTree = __libc_gfInUnixTree; 261 pFS->cchUnixRoot = __libc_gcchUnixRoot; 262 memcpy(pFS->szUnixRoot, __libc_gszUnixRoot, pFS->cchUnixRoot + 1); 263 LIBCLOG_MSG("unixroot=%s fInUnixTree=%d cchUnixRoot=%d\n", pFS->szUnixRoot, pFS->fInUnixTree, pFS->cchUnixRoot); 264 265 *pcbFS = cb; 266 *ppFS = pFS; 267 } 268 else 269 rc = -1; 270 } 271 272 __libc_back_fsMutexRelease(); 273 LIBCLOG_RETURN_INT(rc); 190 274 } 191 275 … … 196 280 if (!rc) 197 281 return 0; 198 _sys_set_errno(rc); 199 return -1; 282 return -__libc_native2errno(rc); 200 283 } 201 284 … … 211 294 212 295 /** 213 * Reads a symbolic link. 214 * 215 * @returns 0 on success. 296 * Reads the content of a symbolic link. 297 * 298 * This is weird interface as it will return a truncated result if not 299 * enough buffer space. It is also weird in that there is no string 300 * terminator. 301 * 302 * @returns Number of bytes returned in pachBuf. 216 303 * @returns -1 and errno on failure. 217 * @param psz Path The symlink to read.218 * @param p szBuf Where to read to.219 * @param cchBuf Size of thebuffer.304 * @param pszNativePath The path to the symlink to read. 305 * @param pachBuf Where to store the symlink value. 306 * @param cchBuf Size of buffer. 220 307 */ 221 int __libc_ Back_fsSymlinkRead(const char *pszPath, char *pszBuf, size_t cchBuf)222 { 223 LIBCLOG_ENTER("psz Path=%p:{%s} pszBuf=%p cchBuf=%d\n", (void *)pszPath, pszPath, (void *)pszBuf, cchBuf);308 int __libc_back_fsNativeSymlinkRead(const char *pszNativePath, char *pachBuf, size_t cchBuf) 309 { 310 LIBCLOG_ENTER("pszNativePath=%p:{%s} pachBuf=%p cchBuf=%d\n", (void *)pszNativePath, pszNativePath, (void *)pachBuf, cchBuf); 224 311 225 312 /* 226 313 * Query the symlink EA value. 227 314 */ 228 char achBuffer[PATH_MAX + 97]; 315 char _achBuffer[SIZEOF_ACHBUFFER + 4]; 316 char *pachBuffer = (char *)((uintptr_t)&_achBuffer[3] & ~3); 229 317 EAOP2 EaOp; 230 318 EaOp.fpGEA2List = (PGEA2LIST)&gSymlinkGEA2List; 231 EaOp.fpFEA2List = (PFEA2LIST) achBuffer;319 EaOp.fpFEA2List = (PFEA2LIST)pachBuffer; 232 320 EaOp.oError = 0; 233 EaOp.fpFEA2List->cbList = sizeof(achBuffer) - 1; 234 LIBC_ASSERT(!((uintptr_t)&achBuffer[0] & 4)); 235 int rc = DosQueryPathInfo((PCSZ)pszPath, FIL_QUERYEASFROMLIST, &EaOp, sizeof(EaOp)); 321 EaOp.fpFEA2List->cbList = SIZEOF_ACHBUFFER; 322 int rc = DosQueryPathInfo((PCSZ)pszNativePath, FIL_QUERYEASFROMLIST, &EaOp, sizeof(EaOp)); 236 323 if (!rc) 237 324 { 238 /* 239 * Validate the EA. 240 */ 241 PUSHORT pusType = (PUSHORT)((char *)&EaOp.fpFEA2List->list[1] + EaOp.fpFEA2List->list[0].cbName); 242 char *pszSymlink = (char *)&pusType[2]; 243 if ( pusType[0] == EAT_ASCII 244 && pusType[1] < EaOp.fpFEA2List->list[0].cbValue 245 && pusType[1] 246 && *pszSymlink) 325 if ( EaOp.fpFEA2List->cbList > sizeof(EaOp.fpFEA2List->list[0]) 326 && EaOp.fpFEA2List->list[0].cbValue) 247 327 { 248 328 /* 249 * Check the length, copy it to the buffer and return.329 * Validate the EA. 250 330 */ 251 int cchSymlink = strnlen(pszSymlink, pusType[1]); 252 pszSymlink[cchSymlink] = '\0'; 253 if (cchSymlink < cchBuf) 254 { 255 memcpy(pszBuf, pszSymlink, cchSymlink + 1); 256 LIBCLOG_RETURN_INT(0); 331 PUSHORT pusType = (PUSHORT)((char *)&EaOp.fpFEA2List->list[1] + EaOp.fpFEA2List->list[0].cbName); 332 int cchSymlink = pusType[1]; 333 char *pszSymlink = (char *)&pusType[2]; 334 if ( pusType[0] == EAT_ASCII 335 && cchSymlink < EaOp.fpFEA2List->list[0].cbValue 336 && cchSymlink > 0 337 && *pszSymlink) 338 { 339 /* 340 * Copy it to the buffer and return. 341 */ 342 if (cchSymlink > cchBuf) 343 { 344 LIBC_ASSERTM_FAILED("Buffer to small. %d bytes required, %d bytes available. pszSymlink='%.*s' pszNativePath='%s'\n", 345 cchSymlink, cchBuf, cchSymlink, pszSymlink, pszNativePath); 346 cchSymlink = cchBuf; 347 } 348 memcpy(pachBuf, pszSymlink, cchSymlink); 349 LIBCLOG_RETURN_INT(cchSymlink); 257 350 } 258 351 else 259 352 { 260 LIBC_ASSERTM_FAILED("Buffer to small. %d bytes required, %d bytes available. pszSymlink='%s' pszPath='%s'\n", 261 cchSymlink + 1, cchBuf, pszSymlink, pszPath); 262 errno = ENAMETOOLONG; 263 LIBCLOG_RETURN_INT(-1); 353 LIBC_ASSERTM_FAILED("Invalid symlink EA! type=%x len=%d cbValue=%d *pszSymlink=%c pszNativePath='%s'\n", 354 pusType[0], pusType[1], EaOp.fpFEA2List->list[0].cbValue, *pszSymlink, pszNativePath); 355 LIBCLOG_RETURN_INT(-EFTYPE); 264 356 } 265 357 } 266 358 else 267 359 { 268 LIBC_ASSERTM_FAILED(" Invalid symlink EA! type=%x len=%d cbValue=%d *pszSymlink=%c pszPath='%s'\n",269 pusType[0], pusType[1], EaOp.fpFEA2List->list[0].cbValue, *pszSymlink, pszPath);270 errno = EFTYPE;271 LIBCLOG_RETURN_INT(-1);272 }273 }360 LIBC_ASSERTM_FAILED("%s is not a symlink!\n", pszNativePath); 361 LIBCLOG_RETURN_INT(-EINVAL); 362 } 363 } 364 else 365 LIBC_ASSERTM_FAILED("DosQueryPathInfo(%s) -> %d!\n", pszNativePath, rc); 274 366 275 367 /* failure */ 276 _sys_set_errno(rc);277 LIBCLOG_RETURN_INT( -1);368 rc = -__libc_native2errno(rc); 369 LIBCLOG_RETURN_INT(rc); 278 370 } 279 371 … … 310 402 if (!EaOp.fpFEA2List) 311 403 { 312 errno = ENOMEM;313 404 LIBC_ASSERTM_FAILED("Out of stack! alloca(%d) failed\n", cb); 314 LIBCLOG_RETURN_INT(- 1);405 LIBCLOG_RETURN_INT(-ENOMEM); 315 406 } 316 407 … … 333 424 LIBCLOG_RETURN_INT(0); 334 425 335 _sys_set_errno(rc);336 LIBCLOG_RETURN_INT( -1);426 rc = -__libc_native2errno(rc); 427 LIBCLOG_RETURN_INT(rc); 337 428 } 338 429 #endif … … 343 434 * 344 435 * @returns 0 on success. 345 * @returns -1 and errnoon failure.436 * @returns Negative error code (errno.h) on failure. 346 437 * @param pszTarget The symlink target. 347 438 * @param pszSymlink The symlink, the one to be updated. 348 439 */ 349 int __libc_ Back_fsSymlinkCreate(const char *pszTarget, const char *pszSymlink)350 { 351 LIBCLOG_ENTER("pszTarget=%s psz Symlink=%s\n", pszTarget, pszSymlink);440 int __libc_back_fsNativeSymlinkCreate(const char *pszTarget, const char *pszNativePath) 441 { 442 LIBCLOG_ENTER("pszTarget=%s pszNativePath=%s\n", pszTarget, pszNativePath); 352 443 353 444 /* … … 357 448 if (cchTarget >= PATH_MAX) 358 449 { 359 errno = ENAMETOOLONG;360 450 LIBC_ASSERTM_FAILED("Target is too long, %d bytes. (%s)\n", cchTarget, pszTarget); 361 LIBCLOG_RETURN_INT(- 1);451 LIBCLOG_RETURN_INT(-ENAMETOOLONG); 362 452 } 363 453 … … 370 460 if (!EaOp.fpFEA2List) 371 461 { 372 errno = ENOMEM;373 462 LIBC_ASSERTM_FAILED("Out of stack! alloca(%d) failed\n", cb); 374 LIBCLOG_RETURN_INT(- 1);463 LIBCLOG_RETURN_INT(-ENOMEM); 375 464 } 376 465 … … 391 480 HFILE hf = -1; 392 481 ULONG ul = 0; 393 int rc = DosOpen((PCSZ)psz Symlink, &hf, &ul, cchTarget + 1, FILE_NORMAL,482 int rc = DosOpen((PCSZ)pszNativePath, &hf, &ul, cchTarget + 1, FILE_NORMAL, 394 483 OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS, 395 484 OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE, … … 397 486 if (!rc) 398 487 { 399 DosWrite(hf, EA_SYMLINK "=", sizeof(EA_SYMLINK "=") - 1, &ul); 400 DosWrite(hf, pszTarget, cchTarget + 1, &ul); 488 char *psz = (char *)&pus[2] - (sizeof(EA_SYMLINK "=") - 1); 489 memcpy(psz, EA_SYMLINK "=", sizeof(EA_SYMLINK "=") - 1); 490 DosWrite(hf, psz, cchTarget + sizeof(EA_SYMLINK "=") - 1, &ul); 401 491 DosClose(hf); 402 492 LIBCLOG_RETURN_INT(0); 403 493 } 404 494 405 _sys_set_errno(rc);406 LIBCLOG_RETURN_INT( -1);495 rc = -__libc_native2errno(rc); 496 LIBCLOG_RETURN_INT(rc); 407 497 } 408 498 … … 489 579 * @returns -1 and errno on failure. 490 580 * @param pszUserPath The user path. 491 * @param pszNativePath Where to store the native path. 492 * @param cchNativePath Size of the buffer for the native path. 493 * @param fVerifyLast Whether or not to verify the last component of the path. 494 * @param pfInUnixTree Whether or not the path is in the unix tree. Optional. 495 * 496 * @remark For correct operation the caller must lock the FS stuff. 581 * @parm fFlags Flags controlling the operation of the function. 582 * See the BACKFS_FLAGS_* defines. 583 * @param pszNativePath Where to store the native path. This buffer is at 584 * least PATH_MAX bytes big. 585 * @param pfInUnixTree Where to store the result-in-unix-tree indicator. Optional. 497 586 */ 498 int __libc_back_fsResolve(const char *pszUserPath, int fVerifyLast, char *pszNativePath, size_t cchNativePath, int *pfInUnixTree)587 int __libc_back_fsResolve(const char *pszUserPath, unsigned fFlags, char *pszNativePath, int *pfInUnixTree) 499 588 { 500 589 if (!__libc_gfNoUnix) 501 return fsResolveUnix(pszUserPath, f VerifyLast, pszNativePath, cchNativePath, pfInUnixTree);590 return fsResolveUnix(pszUserPath, fFlags, pszNativePath, pfInUnixTree); 502 591 503 592 /* __libc_back_fsResolveOS2(): */ 504 593 505 LIBCLOG_ENTER("pszUserPath=%p:{%s} f VerifyLast=%d pszNativePath=%p cchNativePath=%dpfInUnixTree=%p\n",506 (void *)pszUserPath, pszUserPath, f VerifyLast, (void *)pszNativePath, cchNativePath, (void *)pfInUnixTree);594 LIBCLOG_ENTER("pszUserPath=%p:{%s} fFlags=%x pszNativePath=%p pfInUnixTree=%p\n", 595 (void *)pszUserPath, pszUserPath, fFlags, (void *)pszNativePath, (void *)pfInUnixTree); 507 596 508 597 /* … … 511 600 int cch = __libc_PathRewrite(pszUserPath, pszNativePath, sizeof(pszNativePath)); 512 601 if (cch < 0) 513 { 514 errno = EINVAL; 515 LIBCLOG_RETURN_INT(-1); 516 } 602 LIBCLOG_RETURN_INT(-EINVAL); 517 603 if (cch == 0) 518 604 { 519 605 cch = strlen(pszUserPath); 520 if (cch >= cchNativePath) 521 { 522 errno = EINVAL; 523 LIBCLOG_RETURN_INT(-1); 524 } 606 if (cch >= PATH_MAX) 607 LIBCLOG_RETURN_INT(-ENAMETOOLONG); 525 608 memcpy(pszNativePath, pszUserPath, cch + 1); 526 609 } … … 551 634 * @returns -1 and errno on failure. 552 635 * @param pszUserPath The user path. 553 * @param pszNativePath Where to store the native path. 554 * @param cchNativePath Size of the buffer for the native path. 555 * @param fVerifyLast Whether or not to verify the last component of the path. 556 * @param pfInUnixTree Whether or not the path is in the unix tree. Optional. 557 * 558 * @remark For correct operation the caller must lock the FS stuff. 636 * @parm fFlags Flags controlling the operation of the function. 637 * See the BACKFS_FLAGS_* defines. 638 * @param pszNativePath Where to store the native path. This buffer is at 639 * least PATH_MAX bytes big. 640 * @param pfInUnixTree Where to store the result-in-unix-tree indicator. Optional. 559 641 */ 560 static int fsResolveUnix(const char *pszUserPath, int fVerifyLast, char *pszNativePath, size_t cchNativePath, int *pfInUnixTree)561 { 562 LIBCLOG_ENTER("pszUserPath=%p:{%s} fVerifyLast=%d pszNativePath=%p cchNativePath=%d*pfInUnixTree=%p\n",563 (void *)pszUserPath, pszUserPath, fVerifyLast, (void *)pszNativePath, cchNativePath, (void *)pfInUnixTree);642 int fsResolveUnix(const char *pszUserPath, unsigned fFlags, char *pszNativePath, int *pfInUnixTree) 643 { 644 LIBCLOG_ENTER("pszUserPath=%p:{%s} pszNativePath=%p *pfInUnixTree=%p\n", 645 (void *)pszUserPath, pszUserPath, (void *)pszNativePath, (void *)pfInUnixTree); 564 646 const char *pszUserPathIn = pszUserPath; 565 647 char szTmp[PATH_MAX]; 566 char achBuffer[PATH_MAX + 96]; /* Assumes 4 bytes aligned on stack! */ 648 char _achBuffer[SIZEOF_ACHBUFFER + 4]; 649 char *pachBuffer = (char *)((uintptr_t)&_achBuffer[3] & ~3); 567 650 unsigned cLoopsLeft = 8; 568 651 int fInUnixTree = __libc_gfInUnixTree; 569 int rcRet = ENAMETOOLONG; 652 int rcRet = -ENAMETOOLONG; 653 HDIR hDir = HDIR_CREATE; 570 654 FS_VAR() 571 655 FS_SAVE_LOAD(); … … 624 708 if (rc) 625 709 { 626 rcRet = __libc_native2errno(rc);710 rcRet = -__libc_native2errno(rc); 627 711 break; 628 712 } … … 639 723 break; 640 724 memcpy(&szTmp[cch], pszUserPath, cchUserPath); 641 pszUserPath = memcpy( achBuffer, szTmp, cch + cchUserPath);725 pszUserPath = memcpy(pachBuffer, szTmp, cch + cchUserPath); 642 726 } 643 727 … … 645 729 * Verify any drive specifier. 646 730 */ 647 if ( pszUserPath[1] == ':' 648 && !( (*pszUserPath >= 'A' && *pszUserPath <= 'Z') 649 ||(*pszUserPath >= 'a' && *pszUserPath <= 'z')) ) 650 { 651 rcRet = ENOENT; 652 break; 731 if (pszUserPath[1] == ':') 732 { 733 if (*pszUserPath >= 'a' && *pszUserPath <= 'z') 734 { 735 if ((uintptr_t)(pszUserPath - pachBuffer) > SIZEOF_ACHBUFFER) 736 pszUserPath = strcpy(pachBuffer, pszUserPath); 737 *(char *)(void *)pszUserPath += 'A' - 'a'; 738 } 739 else if (!(*pszUserPath >= 'A' && *pszUserPath <= 'Z')) 740 { 741 rcRet = -ENOENT; 742 break; 743 } 653 744 } 654 745 … … 675 766 else 676 767 { 677 rcRet = EINVAL;768 rcRet = -EINVAL; 678 769 break; 679 770 } … … 729 820 if (cchTmp + iRoot >= PATH_MAX) 730 821 break; 731 memcpy( achBuffer, szTmp, cchTmp + 1);822 memcpy(pachBuffer, szTmp, cchTmp + 1); 732 823 memcpy(szTmp, __libc_gszUnixRoot, iRoot); 733 memcpy(&szTmp[iRoot], szTmp, cchTmp + 1); 824 if (cchTmp != 1 || iRoot <= 2) 825 memcpy(&szTmp[iRoot], pachBuffer, cchTmp + 1); 826 else 827 szTmp[iRoot] = '\0'; 828 cchTmp += iRoot; 829 734 830 fInUnixTree = 1; 735 831 } … … 758 854 if (!psz) 759 855 { 760 rcRet = ENOENT;856 rcRet = -ENOENT; 761 857 break; 762 858 } … … 767 863 else 768 864 { 769 if (szTmp[0] == '/') 770 pszPrev = &szTmp[1]; 771 else 772 { 773 pszPrev = &szTmp[3]; 774 LIBC_ASSERT(szTmp[1] == ':' && szTmp[2] == '/'); 775 } 865 pszPrev = &szTmp[iRoot + 1]; 776 866 psz = strchr(pszPrev, '/'); 777 867 } 778 LIBC_ASSERT (iRoot >= pszPrev - &szTmp[0]);868 LIBC_ASSERTM(pszPrev - &szTmp[0] >= iRoot, "iRoot=%d pszPrev offset %d szTmp=%s\n", iRoot, pszPrev - &szTmp[0], szTmp); 779 869 /* If only one component, we'll check if the fVerifyLast was requested. */ 780 if (!psz && fVerifyLast) 870 if ( !psz 871 && (fFlags == BACKFS_FLAGS_RESOLVE_FULL || fFlags == BACKFS_FLAGS_RESOLVE_FULL_MAYBE)) 781 872 psz = strchr(szTmp, '\0'); 782 873 … … 813 904 if (!chSlash) 814 905 { 815 rcRet = 0;906 rcRet = -0; 816 907 break; 817 908 } … … 821 912 if (!*psz) 822 913 { 823 if (!fVerifyLast) 914 if ( fFlags != BACKFS_FLAGS_RESOLVE_FULL 915 && fFlags != BACKFS_FLAGS_RESOLVE_FULL_MAYBE) 824 916 { 825 rcRet = 0;917 rcRet = -0; 826 918 psz = NULL; 827 919 } … … 834 926 835 927 /* 836 * Query the symlink EA value and at the same time verifying the path837 * component.928 * Check for obviously illegal characters in this path component 929 * saving us from having DosFindFirst getting '*' and '?'. 838 930 */ 839 EAOP2 EaOp; 840 EaOp.fpGEA2List = (PGEA2LIST)&gSymlinkGEA2List; 841 EaOp.fpFEA2List = (PFEA2LIST)achBuffer; 842 EaOp.oError = 0; 843 EaOp.fpFEA2List->cbList = sizeof(achBuffer); 844 LIBC_ASSERT(!((uintptr_t)&achBuffer[0] & 4)); 845 int rc = DosQueryPathInfo((PCSZ)&szTmp[0], FIL_QUERYEASFROMLIST, &EaOp, sizeof(EaOp)); 846 if (rc) 847 { 848 LIBCLOG_MSG("DosQueryPathInfo(%s,,,) -> %d resolving %s\n", szTmp, rc, pszUserPathIn); 849 rcRet = rc == ERROR_FILE_NOT_FOUND && chSlash ? ENOTDIR : __libc_native2errno(rc); 931 if (strpbrk(pszPrev, "*?")) 932 { 933 rcRet = -ENOENT; /* hmm. will this be correct for all situation? */ 850 934 break; 851 935 } 852 936 853 937 /* 854 * Did we find any symlink EA? 938 * Find the correct name and to check if it is a directory or not. 939 * This'll of course also provide proper verification of the path too. :-) 855 940 */ 856 if (EaOp.fpFEA2List->list[0].cbValue) 857 { 858 /* Validate the EA. */ 859 PUSHORT pusType = (PUSHORT)((char *)&EaOp.fpFEA2List->list[1] + EaOp.fpFEA2List->list[0].cbName); 860 char *pszSymlink = (char *)&pusType[2]; 861 if ( pusType[0] != EAT_ASCII 862 || pusType[1] > EaOp.fpFEA2List->list[0].cbValue 863 || !pusType[1] 864 || !*pszSymlink) 941 PFILEFINDBUF4 pFindBuf = (PFILEFINDBUF4)pachBuffer; 942 ULONG cFiles = 1; 943 int rc = DosFindFirst((PCSZ)&szTmp[0], &hDir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED, 944 pFindBuf, SIZEOF_ACHBUFFER, &cFiles, FIL_QUERYEASIZE); 945 if (rc || cFiles == 0) 946 { 947 LIBCLOG_MSG("DosFindFirst('%s',,,,,) -> %d resolving '%s'\n", szTmp, rc, pszUserPathIn); 948 if (fFlags == BACKFS_FLAGS_RESOLVE_FULL_MAYBE && !chSlash) 949 rcRet = 0; 950 else 951 rcRet = rc == ERROR_FILE_NOT_FOUND && chSlash ? -ENOENT : -__libc_native2errno(rc); 952 hDir = HDIR_CREATE; 953 break; 954 } 955 memcpy(pszPrev, pFindBuf->achName, psz - pszPrev); 956 int fIsDirectory = (pFindBuf->attrFile & FILE_DIRECTORY) != 0; 957 958 /* 959 * Try querying the symlink EA value. 960 * (This operation will reuse the achBuffer overwriting the pFindBuf data!) 961 * 962 * Yeah, we could do this in the same operation as the DosFindFirst() but 963 * a little bird told me that level 3 DosFindFirst request had not been 964 * returning the right things at some point, and besides it's return data 965 * is rather clumsily laid out. So, I decided not to try my luck on it. 966 */ 967 if (pFindBuf->cbList > sizeof(USHORT) * 2 + 1) 968 { 969 EAOP2 EaOp; 970 EaOp.fpGEA2List = (PGEA2LIST)&gSymlinkGEA2List; 971 EaOp.fpFEA2List = (PFEA2LIST)pachBuffer; 972 EaOp.oError = 0; 973 EaOp.fpFEA2List->cbList = SIZEOF_ACHBUFFER; 974 rc = DosQueryPathInfo((PCSZ)&szTmp[0], FIL_QUERYEASFROMLIST, &EaOp, sizeof(EaOp)); 975 if (rc) 865 976 { 866 LIBC_ASSERTM_FAILED("Invalid symlink EA! type=%x len=%d cbValue=%d *pszSymlink=%c\n", 867 pusType[0], pusType[1], EaOp.fpFEA2List->list[0].cbValue, *pszSymlink); 868 rcRet = EFTYPE; 977 LIBCLOG_MSG("DosQueryPathInfo('%s',,,) -> %d resolving '%s'\n", szTmp, rc, pszUserPathIn); 978 if (fFlags == BACKFS_FLAGS_RESOLVE_FULL_MAYBE && !chSlash) 979 rcRet = 0; 980 else 981 rcRet = rc == ERROR_FILE_NOT_FOUND && chSlash ? -ENOENT : -__libc_native2errno(rc); 869 982 break; 870 983 } 871 984 872 /* Cleanup the symlink and find it's length. */ 873 pszSymlink[pusType[1]] = '\0'; 874 int cchSymlink = fsCleanPath(pszSymlink); 875 876 /* Merge symlink with the path. */ 877 int cchLeft = cchTmp - (psz - &szTmp[0]); 878 if (*pszSymlink == '/' || *pszSymlink == '\\' || pszSymlink[1] == ':') 985 /* 986 * Did we find any symlink EA? 987 */ 988 if ( EaOp.fpFEA2List->cbList > sizeof(EaOp.fpFEA2List->list[0]) 989 && EaOp.fpFEA2List->list[0].cbValue) 879 990 { 880 /* 881 * Replace the path up to the current point with the symlink, 882 */ 883 if (cchSymlink + cchLeft + 2 >= PATH_MAX) 991 /* Validate the EA. */ 992 PUSHORT pusType = (PUSHORT)((char *)&EaOp.fpFEA2List->list[1] + EaOp.fpFEA2List->list[0].cbName); 993 char *pszSymlink = (char *)&pusType[2]; 994 if ( pusType[0] != EAT_ASCII 995 || pusType[1] > EaOp.fpFEA2List->list[0].cbValue 996 || !pusType[1] 997 || !*pszSymlink) 998 { 999 LIBC_ASSERTM_FAILED("Invalid symlink EA! type=%x len=%d cbValue=%d *pszSymlink=%c\n", 1000 pusType[0], pusType[1], EaOp.fpFEA2List->list[0].cbValue, *pszSymlink); 1001 rcRet = -EFTYPE; 884 1002 break; 885 if (cchLeft) 1003 } 1004 1005 /* Cleanup the symlink and find it's length. */ 1006 pszSymlink[pusType[1]] = '\0'; 1007 int cchSymlink = fsCleanPath(pszSymlink); 1008 1009 /* Merge symlink with the path. */ 1010 int cchLeft = cchTmp - (psz - &szTmp[0]); 1011 if (*pszSymlink == '/' || *pszSymlink == '\\' || pszSymlink[1] == ':') 886 1012 { 887 if (pszSymlink[cchSymlink - 1] != '/') 1013 /* 1014 * Replace the path up to the current point with the symlink, 1015 */ 1016 if (cchSymlink + cchLeft + 2 >= PATH_MAX) 1017 break; 1018 if (cchLeft) 1019 { 1020 if (pszSymlink[cchSymlink - 1] != '/') 1021 pszSymlink[cchSymlink++] = '/'; 1022 memcpy(&pszSymlink[cchSymlink], psz + 1, cchLeft + 1); 1023 } 1024 1025 /* restart the whole shebang. */ 1026 pszUserPath = pszSymlink; 1027 fDone = 0; 1028 break; 1029 } 1030 else 1031 { 1032 /* 1033 * Squeeze the symlink in instead of the current path component. 1034 */ 1035 if (cchSymlink + cchTmp + 2 >= PATH_MAX) 1036 break; 1037 if (cchLeft) 1038 { 888 1039 pszSymlink[cchSymlink++] = '/'; 889 memcpy(&pszSymlink[cchSymlink], psz + 1, cchLeft + 1); 1040 memcpy(&pszSymlink[cchSymlink], psz + 1, cchLeft + 1); 1041 cchSymlink += cchLeft; 1042 } 1043 memcpy(pszPrev, pszSymlink, cchSymlink + 1); 1044 1045 psz = pszPrev; 1046 while (*psz != '/') 1047 { 1048 if (!*psz) 1049 { 1050 if ( fFlags != BACKFS_FLAGS_RESOLVE_FULL 1051 && fFlags != BACKFS_FLAGS_RESOLVE_FULL_MAYBE) 1052 { 1053 rcRet = 0; 1054 psz = NULL; 1055 } 1056 break; 1057 } 1058 psz++; 1059 } 1060 continue; 890 1061 } 891 892 /* restart the whole shebang. */893 pszUserPath = pszSymlink;894 fDone = 0;895 break;896 1062 } 897 else 898 { 899 /* 900 * Squeeze the symlink in instead of the current path component. 901 */ 902 if (cchSymlink + cchTmp + 2 >= PATH_MAX) 903 break; 904 if (cchLeft) 905 { 906 pszSymlink[cchSymlink++] = '/'; 907 memcpy(&pszSymlink[cchSymlink], psz + 1, cchLeft + 1); 908 cchSymlink += cchLeft; 909 } 910 memcpy(pszPrev, pszSymlink, cchSymlink + 1); 911 912 psz = pszPrev; 913 while (*psz != '/') 914 { 915 if (!*psz) 916 { 917 if (!fVerifyLast) 918 { 919 rcRet = 0; 920 psz = NULL; 921 } 922 break; 923 } 924 psz++; 925 } 926 continue; 927 } 1063 } 1064 1065 /* 1066 * If we get here it was not a symlink and we should check if the directoryness 1067 * of it fit's into the big picture... 1068 */ 1069 if (!fIsDirectory && chSlash) 1070 { 1071 LIBCLOG_MSG("'%s' is not a directory (resolving '%s')\n", szTmp, pszUserPathIn); 1072 rcRet = -ENOTDIR; 1073 break; 928 1074 } 929 1075 … … 942 1088 if (!*psz) 943 1089 { 944 if (!fVerifyLast) 1090 if ( fFlags != BACKFS_FLAGS_RESOLVE_FULL 1091 && fFlags != BACKFS_FLAGS_RESOLVE_FULL_MAYBE) 945 1092 { 946 1093 rcRet = 0; … … 957 1104 } /* outer loop */ 958 1105 1106 /* 1107 * Cleanup find handle. 1108 */ 1109 if (hDir != HDIR_CREATE) 1110 DosFindClose(hDir); 1111 FS_RESTORE(); 959 1112 960 1113 /* … … 969 1122 szTmp[cch++] = '\0'; 970 1123 } 971 if (cch <= cchNativePath) 972 { 973 memcpy(pszNativePath, szTmp, cch); 974 if (pfInUnixTree) 975 *pfInUnixTree = fInUnixTree; 976 LIBCLOG_RETURN_INT(0); 977 } 978 rcRet = ENAMETOOLONG; 1124 memcpy(pszNativePath, szTmp, cch); 1125 if (pfInUnixTree) 1126 *pfInUnixTree = fInUnixTree; 1127 LIBCLOG_RETURN_INT(0); 979 1128 } 980 1129 981 1130 /* failure */ 982 errno = rcRet; 983 LIBCLOG_RETURN_INT(-1); 1131 LIBCLOG_RETURN_INT(rcRet); 984 1132 pszUserPathIn = pszUserPathIn; 985 1133 } 1134 1135 1136 /** 1137 * Creates the unix EAs for a new file or directory. 1138 * @returns 0 on success. 1139 * @returns Negative errno on failure. 1140 * @param hFile File handle to the newly created fs object. If no 1141 * handle handy, set to -1. 1142 * @param pszNativePath Native path of the newly created fs object. If 1143 * handle is give this will be ignored. 1144 * @param mode The specified file permission mode mask. 1145 */ 1146 int __libc_back_fsSetUnixAttribs(int hFile, const char *pszNativePath, mode_t mode) 1147 { 1148 /* later */ 1149 return 0; 1150 } 1151 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/fs.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 31 31 #include <sys/syslimits.h> 32 32 #include <sys/types.h> 33 #include <InnoTekLIBC/sharedpm.h> 34 #include "backend.h" 33 35 36 struct stat; 34 37 35 38 __BEGIN_DECLS … … 41 44 /** The current unix root. */ 42 45 extern char __libc_gszUnixRoot[PATH_MAX]; 46 /** The current umask of the process. */ 47 extern mode_t __libc_gfsUMask; 43 48 49 #ifdef _OS2EMX_H 50 /** @group Large File Support - API pointers. 51 * Test if the function pointer is set before calling it. 52 * For APIs which take a structure level parameter, check __pfnDosOpenL. 53 * @{ */ 54 extern ULONG (* _System __libc_gpfnDosOpenL)(PCSZ pszFileName, PHFILE phFile, PULONG pulAction, LONGLONG llFileSize, ULONG ulAttribute, ULONG ulOpenFlags, ULONG ulOpenMode, PEAOP2 pEABuf); 55 extern ULONG (* _System __libc_gpfnDosSetFilePtrL)(HFILE hFile, LONGLONG llOffset, ULONG ulOrigin, PLONGLONG pllPos); 56 extern ULONG (* _System __libc_gpfnDosSetFileSizeL)(HFILE hFile, LONGLONG cbSize); 57 extern ULONG (* _System __libc_gpfnDosSetFileLocksL)(HFILE hFile, __const__ FILELOCKL *pflUnlock, __const__ FILELOCKL *pflLock, ULONG ulTimeout, ULONG flFlags); 58 /** @} */ 59 #endif 60 61 /** 62 * Init the file system stuff. 63 * 64 * @returns 0 on success. 65 * @returns -1 on failure. 66 */ 67 int __libc_back_fsInit(void); 68 69 /** 70 * Pack inherit data. 71 * @returns 0 on success. 72 * @returns -1 on failure. 73 * @param ppFS Where to store the pointer to the inherit data. 74 * @param pcbFS Where to store the size of the inherit data. 75 */ 76 int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS); 44 77 45 78 /** … … 70 103 * @returns -1 and errno on failure. 71 104 * @param pszUserPath The user path. 72 * @param pszNativePath Where to store the native path. 73 * @param cchNativePath Size of the buffer for the native path. 74 * @param fVerify Whether or not to verify that the path exists. 75 * @param pfDrvSpec Where to store the drive spec indicator. Optional. 76 * *pfDrvSpec will be set if the pszUserPath or any symbolic link 77 * contained pszUserPath referenced contained a drive letter specifier. 105 * @parm fFlags Flags controlling the operation of the function. 106 * See the BACKFS_FLAGS_* defines. 107 * @param pszNativePath Where to store the native path. This buffer is at 108 * least PATH_MAX bytes big. 109 * @param pfInUnixTree Where to store the result-in-unix-tree indicator. Optional. 78 110 */ 79 int __libc_back_fsResolve(const char *pszUserPath, int fVerify, char *pszNativePath, size_t cchNativePath, int *pfDrvSpec); 111 int __libc_back_fsResolve(const char *pszUserPath, unsigned fFlags, char *pszNativePath, int *pfInUnixTree); 112 113 /** __libc_back_fsResolve() flags. 114 * @{ */ 115 /** Resolves the path up to but not including the last component. */ 116 #define BACKFS_FLAGS_RESOLVE_PARENT 0x1 117 /** Resolves and verfies the entire path. */ 118 #define BACKFS_FLAGS_RESOLVE_FULL 0x2 119 /** Resolves and verfies the entire path but it's ok if the last component doesn't exist. */ 120 #define BACKFS_FLAGS_RESOLVE_FULL_MAYBE 0x3 121 /** @} */ 122 80 123 81 124 /** 82 * Creates a symlink. 125 * Creates the unix EAs for a new file or directory. 126 * @returns 0 on success. 127 * @returns Negative errno on failure. 128 * @param hFile File handle to the newly created fs object. If no 129 * handle handy, set to -1. 130 * @param pszNativePath Native path of the newly created fs object. If 131 * handle is give this will be ignored. 132 * @param mode The specified file permission mode mask. 133 */ 134 int __libc_back_fsSetUnixAttribs(int hFile, const char *pszNativePath, mode_t mode); 135 136 137 /** 138 * Creates a symbolic link. 83 139 * 84 140 * @returns 0 on success. 85 141 * @returns -1 and errno on failure. 86 * @param pszTarget The symlink target.87 * @param psz Symlink The symlink, the one to be updated.142 * @param pszTarget The target of the symlink link. 143 * @param pszNativePath The path to the symbolic link to create. 88 144 */ 89 int __libc_ Back_fsSymlinkCreate(const char *pszTarget, const char *pszSymlink);145 int __libc_back_fsNativeSymlinkCreate(const char *pszTarget, const char *pszNativePath); 90 146 91 147 /** 92 * Reads a symbolic link. 148 * Reads the content of a symbolic link. 149 * 150 * This is weird interface as it will return a truncated result if not 151 * enough buffer space. It is also weird in that there is no string 152 * terminator. 153 * 154 * @returns Number of bytes returned in pachBuf. 155 * @returns -1 and errno on failure. 156 * @param pszNativePath The path to the symlink to read. 157 * @param pachBuf Where to store the symlink value. 158 * @param cchBuf Size of buffer. 159 */ 160 int __libc_back_fsNativeSymlinkRead(const char *pszNativePath, char *pachBuf, size_t cchBuf); 161 162 /** 163 * Stats a native file. 93 164 * 94 165 * @returns 0 on success. 95 166 * @returns -1 and errno on failure. 96 * @param psz Path The symlink to read.97 * @param pszBuf Where to read to.98 * @param cchBuf Size of the buffer.167 * @param pszNativePath Path to the file to stat. This path is resolved, no 168 * processing required. 169 * @param pStat Where to store the file stats. 99 170 */ 100 int __libc_Back_fsSymlinkRead(const char *pszPath, char *pszBuf, size_t cchBuf); 101 171 int __libc_back_fsNativeFileStat(const char *pszNativePath, struct stat *pStat); 102 172 103 173 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/largefileio.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 1 /* $Id$ */ 2 /** @file 3 * 4 * Large File Support. 5 * 6 * Copyright (c) 2003 Dimitry Froloff 7 * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net> 8 * 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License as published 12 * by the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * along with This program; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * 24 */ 25 26 /******************************************************************************* 27 * Defined Constants And Macros * 28 *******************************************************************************/ 29 #define ORD_DOS32OPENL 981 30 #define ORD_DOS32SETFILEPTRL 988 31 #define ORD_DOS32SETFILESIZEL 989 32 #define ORD_DOS32SETFILELOCKSL 986 33 34 /******************************************************************************* 35 * Header Files * 36 *******************************************************************************/ 37 #define INCL_BASE 38 #include <os2.h> 39 #include "syscalls.h" 40 41 42 /******************************************************************************* 43 * Defined Constants And Macros * 44 *******************************************************************************/ 45 ULONG (* _System __pfnDosOpenL)(PCSZ pszFileName, PHFILE phFile, 46 PULONG pulAction, LONGLONG llFileSize, ULONG ulAttribute, ULONG ulOpenFlags, 47 ULONG ulOpenMode, PEAOP2 pEABuf) = NULL; 48 ULONG (* _System __pfnDosSetFilePtrL)(HFILE hFile, LONGLONG llOffset, 49 ULONG ulOrigin, PLONGLONG pllPos) = NULL; 50 ULONG (* _System __pfnDosSetFileSizeL)(HFILE hFile, LONGLONG cbSize) = NULL; 51 ULONG (* _System __pfnDosSetFileLocksL)(HFILE hFile, 52 __const__ FILELOCKL *pflUnlock, __const__ FILELOCKL *pflLock, 53 ULONG ulTimeout, ULONG flFlags) = NULL; 54 55 56 /** 57 * Initiates the function pointers to the large file APIs. 58 * 59 * I/O functions should test if the function pointer is NULL to determin 60 * support for large files. 61 * 62 * @author Dimitry Froloff 63 * @author knut st. osmundsen <bird-srcspam@anduin.net> 64 */ 65 void _sys_init_largefileio(void) 66 { 67 HMODULE hmod = NULLHANDLE; 68 69 /* only once! */ 70 if (__pfnDosOpenL) 71 return; 72 73 /* 74 * Get a handle to DOSCALLS/DOSCALL1 which is suitable for DosQueryProcAddr. 75 */ 76 if (DosLoadModule(NULL, 0, (PCSZ)"DOSCALLS", &hmod)) 77 { 78 /* this is impossible! */ 79 #ifdef DEBUG 80 asm ("int $3"); 81 #endif 82 return; 83 } 84 85 if ( DosQueryProcAddr(hmod, ORD_DOS32OPENL, NULL, (PFN*)(void *)&__pfnDosOpenL) 86 || DosQueryProcAddr(hmod, ORD_DOS32SETFILEPTRL, NULL, (PFN*)(void *)&__pfnDosSetFilePtrL) 87 || DosQueryProcAddr(hmod, ORD_DOS32SETFILESIZEL, NULL, (PFN*)(void *)&__pfnDosSetFileSizeL) 88 || DosQueryProcAddr(hmod, ORD_DOS32SETFILELOCKSL, NULL, (PFN*)(void *)&__pfnDosSetFileLocksL) 89 ) 90 { 91 __pfnDosOpenL = NULL; 92 __pfnDosSetFilePtrL = NULL; 93 __pfnDosSetFileSizeL = NULL; 94 __pfnDosSetFileLocksL = NULL; 95 } 96 DosFreeModule(hmod); 97 } 98 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/libcfork.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.20 * 21 * You should have received a copy of the GNU General Public License19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/os2error.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/pathrewrite.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 207 207 208 208 209 210 /* 211 * Unix root. 212 */ 213 /** The unixroot directory. */ 214 static char gszUnixRoot[260]; 215 /** /@unixroot/ -> ${UNIXROOT} rewrite rules */ 216 static __LIBC_PATHREWRITE gBltinRule_unixroot = 217 { __LIBC_PRWF_CASE_SENSITIVE | __LIBC_PRWF_TYPE_DIR, "/@unixroot", 10, gszUnixRoot, 0 }; 218 209 /** Flag which tells if we're initialized or not. */ 210 static int gfInited; 219 211 220 212 /******************************************************************************* … … 235 227 static void *pfnDummy = __libc_pathRewriteInit; 236 228 LIBCLOG_ENTER("\n"); 237 const char *psz; 238 239 /* 240 * Extra unix features. 241 */ 242 if (!__libc_gfNoUnix) 243 { 244 /* 245 * Check for unixroot. 246 */ 247 psz = getenv("UNIXROOT"); 248 if (psz) 249 { 250 size_t cch = strlen(psz); 251 if (cch < sizeof(gszUnixRoot) - 1) 252 { 253 memcpy(gszUnixRoot, psz, cch + 1); 254 gBltinRule_unixroot.cchTo = cch; 255 __libc_PathRewriteAdd(&gBltinRule_unixroot, 1); 256 } 257 } 258 } 229 if (gfInited) 230 LIBCLOG_RETURN_VOID(); 231 gfInited = 1; 259 232 260 233 /* 261 234 * Check for the presense of the variable. 262 235 */ 263 psz = getenv("LIBC_PATHREWRITERS");236 const char *psz = getenv("LIBC_PATHREWRITERS"); 264 237 if (!psz || !*psz) 265 238 LIBCLOG_RETURN_MSG_VOID("no rewriters\n"); … … 445 418 */ 446 419 cch = strlen(paRules[i].pszTo); 447 if (cch != paRules[i].cchTo )420 if (cch != paRules[i].cchTo || !cch) 448 421 { 449 422 LIBC_ASSERTM_FAILED("rule %d: invalid TO length. actual=%d given=%d\n", i, cch, paRules[i].cchTo); 450 423 LIBCLOG_RETURN_INT(-1); 451 424 } 452 if ( paRules[i].pszTo[cch - 1] == '\\' 453 || paRules[i].pszTo[cch - 1] == '/') 425 if ( !(cch == 1 || (cch == 3 && paRules[i].pszTo[1] == ':')) 426 && ( paRules[i].pszTo[cch - 1] == '\\' 427 || paRules[i].pszTo[cch - 1] == '/') ) 454 428 { 455 429 LIBC_ASSERTM_FAILED("rule %d: invalid TO ends with slash.\n", i); 456 430 LIBCLOG_RETURN_INT(-1); 457 431 } 432 458 433 459 434 /* … … 578 553 LIBCLOG_ENTER("paRules=%p cRules=%d\n", (void*)paRules, cRules); 579 554 int i; 555 556 /* 'Random' init order forces this. :/ */ 557 if (!gfInited) 558 __libc_pathRewriteInit(); 580 559 581 560 /* … … 720 699 int i; 721 700 701 /* 'Random' init order forces this. :/ */ 702 if (!gfInited) 703 __libc_pathRewriteInit(); 704 722 705 /* 723 706 * Validation. … … 859 842 const char *psz; 860 843 const char *pszBest; 844 845 /* 'Random' init order forces this. :/ */ 846 if (!gfInited) 847 __libc_pathRewriteInit(); 861 848 862 849 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/resource.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 11 11 * 12 12 * InnoTek LIBC is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or13 * it under the terms of the GNU Lesser General Public License as published 14 * by the Free Software Foundation; either version 2 of the License, or 15 15 * (at your option) any later version. 16 16 * … … 18 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details.20 * GNU Lesser General Public License for more details. 21 21 * 22 * You should have received a copy of the GNU General Public License22 * You should have received a copy of the GNU Lesser General Public License 23 23 * along with InnoTek LIBC; if not, write to the Free Software 24 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/seterrno.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 4 4 #include <errno.h> 5 5 #include "syscalls.h" 6 7 extern int errno; 6 #include "backend.h" 8 7 9 8 static unsigned char const errno_tab[] = -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/sharedpm.c
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r1518 r1519 11 11 * 12 12 * InnoTek LIBC is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or13 * it under the terms of the GNU Lesser General Public License as published 14 * by the Free Software Foundation; either version 2 of the License, or 15 15 * (at your option) any later version. 16 16 * … … 18 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details.21 * 22 * You should have received a copy of the GNU General Public License20 * GNU Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public License 23 23 * along with InnoTek LIBC; if not, write to the Free Software 24 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA … … 109 109 static int spmForkChild1(__LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation); 110 110 static void spmCrtInit1(void); 111 static int spmRequestMutexErrno(__LIBC_PSPMXCPTREGREC pRegRec); 111 112 static int spmRequestMutex(__LIBC_PSPMXCPTREGREC pRegRec); 112 113 static int spmReleaseMutex(__LIBC_PSPMXCPTREGREC pRegRec); … … 162 163 */ 163 164 FS_SAVE_LOAD(); 164 if (!spmRequestMutex (&RegRec))165 if (!spmRequestMutexErrno(&RegRec)) 165 166 { 166 167 /* … … 230 231 FS_SAVE_LOAD(); 231 232 DosGetInfoBlocks(&pTib, &pPib); 232 if (spmRequestMutex (&RegRec))233 if (spmRequestMutexErrno(&RegRec)) 233 234 LIBCLOG_RETURN_P(NULL); 234 235 if (!gpSPMSelf) … … 257 258 __LIBC_PSPMINHERIT pRet = NULL; 258 259 __LIBC_SPMXCPTREGREC RegRec; 259 if (!spmRequestMutex (&RegRec))260 if (!spmRequestMutexErrno(&RegRec)) 260 261 { 261 262 if ((pRet = gpSPMSelf->pInherit) != NULL) … … 285 286 LIBCLOG_ENTER("\n"); 286 287 __LIBC_SPMXCPTREGREC RegRec; 287 int rc = spmRequestMutex (&RegRec);288 int rc = spmRequestMutexErrno(&RegRec); 288 289 if (!rc) 289 290 { … … 312 313 { 313 314 __LIBC_SPMXCPTREGREC RegRec; 314 if (!spmRequestMutex (&RegRec))315 if (!spmRequestMutexErrno(&RegRec)) 315 316 { 316 317 if (gpSPMSelf->pInherit) … … 358 359 * Get mutex. 359 360 */ 360 if (spmRequestMutex (&RegRec))361 if (spmRequestMutexErrno(&RegRec)) 361 362 LIBCLOG_RETURN_P(NULL); 362 363 … … 448 449 * Request mutex. 449 450 */ 450 if (spmRequestMutex (&RegRec))451 if (spmRequestMutexErrno(&RegRec)) 451 452 LIBCLOG_RETURN_P(NULL); 452 453 … … 501 502 * Request mutex. 502 503 */ 503 if (spmRequestMutex (&RegRec))504 if (spmRequestMutexErrno(&RegRec)) 504 505 LIBCLOG_RETURN_P(NULL); 505 506 … … 545 546 * Obtain semaphore. 546 547 */ 547 if (spmRequestMutex (&RegRec))548 if (spmRequestMutexErrno(&RegRec)) 548 549 LIBCLOG_RETURN_INT(-1); 549 550 … … 585 586 { 586 587 LIBCLOG_ENTER("\n"); 587 int rc = spmRequestMutex(pRegRec); 588 LIBCLOG_RETURN_INT(rc); 588 int rc = spmRequestMutexErrno(pRegRec); 589 if (!rc) 590 LIBCLOG_RETURN_INT(0); 591 errno = rc; 592 LIBCLOG_RETURN_INT(-1); 589 593 } 590 594 … … 602 606 LIBCLOG_ENTER("\n"); 603 607 int rc = spmReleaseMutex(pRegRec); 604 LIBCLOG_RETURN_INT(rc); 608 if (!rc) 609 LIBCLOG_RETURN_INT(0); 610 errno = rc; 611 LIBCLOG_RETURN_INT(-1); 605 612 } 606 613 … … 632 639 * Request access to shared memory. 633 640 */ 634 if (spmRequestMutex (&RegRec))641 if (spmRequestMutexErrno(&RegRec)) 635 642 LIBCLOG_RETURN_P(NULL); 636 643 … … 676 683 * Take sem. 677 684 */ 678 if (spmRequestMutex (&RegRec))685 if (spmRequestMutexErrno(&RegRec)) 679 686 LIBCLOG_RETURN_INT(-1); 680 687 … … 819 826 * 820 827 * @returns 0 on success. 821 * @returns -1 and errnoon failure.828 * @returns Negative error code (errno.h) on failure. 822 829 * @param pLoadAvg Where to store the load average samples. 823 830 * @param puTimestamp Where to store the current timestamp. … … 842 849 *puTimestamp = spmTimestamp(); 843 850 844 return rc;851 return 0; 845 852 } 846 853 … … 850 857 * 851 858 * @returns 0 on success. 852 * @returns -1 and errnoon failure.859 * @returns Negative error code (errno.h) on failure. 853 860 * @param pLoadAvg Where to store the load average samples. 854 861 */ … … 863 870 LoadAvg.uTimestamp = spmTimestamp(); 864 871 865 rc = spmRequestMutex (&RegRec);872 rc = spmRequestMutexErrno(&RegRec); 866 873 if (rc) 867 874 return rc; … … 870 877 871 878 spmReleaseMutex(&RegRec); 872 return rc;879 return 0; 873 880 } 874 881 … … 888 895 int rc; 889 896 890 rc = spmRequestMutex (&RegRec);897 rc = spmRequestMutexErrno(&RegRec); 891 898 if (rc) 892 899 return rc; … … 981 988 982 989 983 984 990 /** 985 991 * Requests the shared mutex semphore and checks that we're 986 992 * successfully initialized. 987 993 * @internal 994 */ 995 static int spmRequestMutexErrno(__LIBC_PSPMXCPTREGREC pRegRec) 996 { 997 int rc = spmRequestMutex(pRegRec); 998 if (!rc) 999 return 0; 1000 errno = rc; 1001 return -1; 1002 } 1003 1004 1005 /** 1006 * Requests the shared mutex semphore and checks that we're 1007 * successfully initialized. 1008 * @internal 1009 * @returns 0 on success. 1010 * @returns Negative error code (errno.h) on failure. 988 1011 */ 989 1012 static int spmRequestMutex(__LIBC_PSPMXCPTREGREC pRegRec) … … 1010 1033 * Perform lazy init. 1011 1034 */ 1012 if (!spmInit()) 1035 rc = spmInit(); 1036 if (!rc) 1013 1037 { 1014 1038 FS_RESTORE(); … … 1019 1043 DosUnsetExceptionHandler(&pRegRec->Core); 1020 1044 FS_RESTORE(); 1021 LIBCLOG_RETURN_INT( -1);1045 LIBCLOG_RETURN_INT(rc); 1022 1046 } 1023 1047 … … 1037 1061 LIBC_ASSERTM_FAILED("Nested access to shared memory is not allowed\n"); 1038 1062 DosReleaseMutexSem(ghmtxSPM); 1039 errno =EBUSY;1063 rc = -EBUSY; 1040 1064 } 1041 1065 else … … 1043 1067 /* @todo recover from owner died. */ 1044 1068 LIBC_ASSERTM_FAILED("DosRequestMutexSem(%lu) failed with rc=%d!\n", ghmtxSPM, rc); 1045 _sys_set_errno(rc);1069 rc = -__libc_native2errno(rc); 1046 1070 } 1047 1071 … … 1049 1073 DosExitMustComplete(&ul); 1050 1074 FS_RESTORE(); 1051 LIBCLOG_RETURN_INT( -1);1075 LIBCLOG_RETURN_INT(rc); 1052 1076 } 1053 1077 … … 1091 1115 * 1092 1116 * @returns 0 on success. Mutex is owned. 1093 * @returns -1 and errnoon failure.1117 * @returns Negative error code (errno.h) on failure. 1094 1118 */ 1095 1119 static int spmInit(void) … … 1107 1131 LIBC_ASSERT(!gcNesting); 1108 1132 if (gcNesting) 1109 { 1110 errno = EINVAL; 1111 LIBCLOG_RETURN_INT(-1); 1112 } 1133 LIBCLOG_RETURN_INT(-EINVAL); 1113 1134 1114 1135 /* … … 1136 1157 LIBC_ASSERTM_FAILED("Failed to open mutex. rc=%d rc2=%d\n", rc, rc2); 1137 1158 ghmtxSPM = NULLHANDLE; 1138 _sys_set_errno(rc);1139 LIBCLOG_RETURN_INT( -1);1159 rc = -__libc_native2errno(rc); 1160 LIBCLOG_RETURN_INT(rc); 1140 1161 } 1141 1162 } … … 1231 1252 */ 1232 1253 LIBCLOG_MSG("Failed rc=%d\n", rc); 1233 _sys_set_errno(rc);1234 1254 DosCloseMutexSem(ghmtxSPM); 1235 1255 ghmtxSPM = NULLHANDLE; … … 1237 1257 gpSPMSelf = NULL; 1238 1258 FS_RESTORE(); 1239 LIBCLOG_RETURN_INT(-1); 1259 rc = -__libc_native2errno(rc); 1260 LIBCLOG_RETURN_INT(rc); 1240 1261 } 1241 1262 … … 1311 1332 FS_SAVE_LOAD(); 1312 1333 DosGetInfoBlocks(&pTib, &pPib); 1313 if (!spmRequestMutex (&RegRec))1334 if (!spmRequestMutexErrno(&RegRec)) 1314 1335 { 1315 1336 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r1518 r1519 48 48 }; 49 49 50 EXTERN int _sys_umask INIT (0022);51 50 EXTERN unsigned _sys_uflags INIT (0); 52 51 EXTERN unsigned long _sys_clock0_ms INIT (0); … … 86 85 87 86 #if defined (_OS2EMX_H) 88 89 /** @group Large File Support - API pointers.90 * Test if the function pointer is set before calling it.91 * For APIs which take a structure level parameter, check __pfnDosOpenL.92 * @{ */93 extern ULONG (* _System __pfnDosOpenL)(PCSZ pszFileName, PHFILE phFile,94 PULONG pulAction, LONGLONG llFileSize, ULONG ulAttribute, ULONG ulOpenFlags,95 ULONG ulOpenMode, PEAOP2 pEABuf);96 extern ULONG (* _System __pfnDosSetFilePtrL)(HFILE hFile, LONGLONG llOffset,97 ULONG ulOrigin, PLONGLONG pllPos);98 extern ULONG (* _System __pfnDosSetFileSizeL)(HFILE hFile, LONGLONG cbSize);99 extern ULONG (* _System __pfnDosSetFileLocksL)(HFILE hFile,100 __const__ FILELOCKL *pflUnlock, __const__ FILELOCKL *pflLock,101 ULONG ulTimeout, ULONG flFlags);102 /** @} */103 104 87 105 88 /** Test if a DOS/OS2 file time is zero. */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/tcpip.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 18 18 * 19 19 * InnoTek LIBC is free software; you can redistribute it and/or modify 20 * it under the terms of the GNU General Public License as published by21 * the Free Software Foundation; either version 2 of the License, or20 * it under the terms of the GNU Lesser General Public License as published 21 * by the Free Software Foundation; either version 2 of the License, or 22 22 * (at your option) any later version. 23 23 * … … 25 25 * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 * GNU General Public License for more details.27 * GNU Lesser General Public License for more details. 28 28 * 29 * You should have received a copy of the GNU General Public License29 * You should have received a copy of the GNU Lesser General Public License 30 30 * along with InnoTek LIBC; if not, write to the Free Software 31 31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/tcpipver.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1518 r1519 14 14 * 15 15 * InnoTek LIBC is free software; you can redistribute it and/or modify 16 * it under the terms of the GNU General Public License as published by17 * the Free Software Foundation; either version 2 of the License, or16 * it under the terms of the GNU Lesser General Public License as published 17 * by the Free Software Foundation; either version 2 of the License, or 18 18 * (at your option) any later version. 19 19 * … … 21 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details.24 * 25 * You should have received a copy of the GNU General Public License23 * GNU Lesser General Public License for more details. 24 * 25 * You should have received a copy of the GNU Lesser General Public License 26 26 * along with InnoTek LIBC; if not, write to the Free Software 27 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/timebomb.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1518 r1519 10 10 * 11 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * … … 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details.19 * GNU Lesser General Public License for more details. 20 20 * 21 * You should have received a copy of the GNU General Public License21 * You should have received a copy of the GNU Lesser General Public License 22 22 * along with InnoTek LIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/umask.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1518 r1519 1 /* sys/umask.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */ 1 /* $Id: $ *//* $Id: $ */ 2 /** @file 3 * 4 * LIBC SYS Backend - umask. 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 3 30 #include "libc-alias.h" 4 #include <emx/syscalls.h> 31 #include "fs.h" 32 #include <386/builtin.h> 5 33 #include <sys/stat.h> 6 #include "syscalls.h" 34 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 35 #include <InnoTekLIBC/logstrict.h> 7 36 8 mode_t _STD(umask) (int pmode) 37 38 /** 39 * Sets the umask to mask & 0777. 40 * 41 * The umask is used by open(), creat(), mkdir(), mkfifo(), 42 * mknod(), mq_open() and sem_open() to set the initial permissions 43 * for an newly created object. 44 * 45 * @returns The old umask. (Will never fail!) 46 * @param mask The new umask. 47 */ 48 mode_t _STD(umask)(mode_t mask) 9 49 { 10 mode_t old; 50 LIBCLOG_ENTER("mask=0%o\n", mask); 51 mask &= 0777; 52 mode_t rc = __atomic_xchg((volatile unsigned *)&__libc_gfsUMask, mask); /* (paranoia^2) */ 53 LIBCLOG_RETURN_MSG(rc, "ret 0%o (%d)\n", rc, rc); 54 } 11 55 12 old = _sys_umask;13 _sys_umask = pmode;14 return old;15 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.