Changeset 102203 in vbox
- Timestamp:
- Nov 21, 2023 1:20:07 PM (12 months ago)
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h
r101930 r102203 59 59 #include <errno.h> 60 60 61 #include "prio.h"62 61 #include "prmem.h" 63 62 #include "prclist.h" … … 299 298 #define _MD_INIT_FILEDESC(fd) 300 299 301 extern void _MD_MakeNonblock(PRFileDesc *fd);302 #define _MD_MAKE_NONBLOCK _MD_MakeNonblock303 304 300 /************************************************************************/ 305 301 … … 340 336 extern void _MD_UnblockClockInterrupts(void); 341 337 extern void _MD_PauseCPU(PRIntervalTime timeout); 342 343 extern PRStatus _MD_open_dir(struct _MDDir *, const char *);344 extern PRInt32 _MD_close_dir(struct _MDDir *);345 extern char * _MD_read_dir(struct _MDDir *, PRIntn);346 extern PRInt32 _MD_open(const char *name, PRIntn osflags, PRIntn mode);347 extern PRInt32 _MD_delete(const char *name);348 extern PRInt32 _MD_getfileinfo(const char *fn, PRFileInfo *info);349 extern PRInt32 _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);350 extern PRInt32 _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);351 extern PRInt32 _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);352 extern PRInt32 _MD_rename(const char *from, const char *to);353 extern PRInt32 _MD_mkdir(const char *name, PRIntn mode);354 extern PRInt32 _MD_rmdir(const char *name);355 extern PRInt32 _MD_accept_read(PRInt32 sock, PRInt32 *newSock,356 PRNetAddr **raddr, void *buf, PRInt32 amount);357 358 #define _MD_OPEN_DIR(dir, name) _MD_open_dir(dir, name)359 #define _MD_CLOSE_DIR(dir) _MD_close_dir(dir)360 #define _MD_READ_DIR(dir, flags) _MD_read_dir(dir, flags)361 #define _MD_OPEN(name, osflags, mode) _MD_open(name, osflags, mode)362 #define _MD_OPEN_FILE(name, osflags, mode) _MD_open(name, osflags, mode)363 extern PRInt32 _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);364 #define _MD_READ(fd,buf,amount) _MD_read(fd,buf,amount)365 extern PRInt32 _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);366 #define _MD_WRITE(fd,buf,amount) _MD_write(fd,buf,amount)367 #define _MD_DELETE(name) _MD_delete(name)368 #define _MD_GETFILEINFO(fn, info) _MD_getfileinfo(fn, info)369 #define _MD_GETFILEINFO64(fn, info) _MD_getfileinfo64(fn, info)370 #define _MD_GETOPENFILEINFO(fd, info) _MD_getopenfileinfo(fd, info)371 #define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)372 #define _MD_RENAME(from, to) _MD_rename(from, to)373 #define _MD_MKDIR(name, mode) _MD_mkdir(name, mode)374 #define _MD_MAKE_DIR(name, mode) _MD_mkdir(name, mode)375 #define _MD_RMDIR(name) _MD_rmdir(name)376 #define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount) _MD_accept_read(sock, newSock, raddr, buf, amount)377 378 extern PRInt32 _MD_socket(int af, int type, int flags);379 #define _MD_SOCKET _MD_socket380 extern PRInt32 _MD_connect(PRFileDesc *fd, const PRNetAddr *addr,381 PRUint32 addrlen, PRIntervalTime timeout);382 #define _MD_CONNECT _MD_connect383 extern PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,384 PRIntervalTime timeout);385 #define _MD_ACCEPT _MD_accept386 extern PRInt32 _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);387 #define _MD_BIND _MD_bind388 extern PRInt32 _MD_listen(PRFileDesc *fd, PRIntn backlog);389 #define _MD_LISTEN _MD_listen390 extern PRInt32 _MD_shutdown(PRFileDesc *fd, PRIntn how);391 #define _MD_SHUTDOWN _MD_shutdown392 393 extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,394 PRIntn flags, PRIntervalTime timeout);395 #define _MD_RECV _MD_recv396 extern PRInt32 _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,397 PRIntn flags, PRIntervalTime timeout);398 #define _MD_SEND _MD_send399 extern PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,400 PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen,401 PRIntervalTime timeout);402 #define _MD_RECVFROM _MD_recvfrom403 extern PRInt32 _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount,404 PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen,405 PRIntervalTime timeout);406 #define _MD_SENDTO _MD_sendto407 extern PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,408 PRInt32 iov_size, PRIntervalTime timeout);409 #define _MD_WRITEV _MD_writev410 411 extern PRInt32 _MD_socketavailable(PRFileDesc *fd);412 #define _MD_SOCKETAVAILABLE _MD_socketavailable413 extern PRInt64 _MD_socketavailable64(PRFileDesc *fd);414 #define _MD_SOCKETAVAILABLE64 _MD_socketavailable64415 416 #define _MD_PIPEAVAILABLE _MD_socketavailable417 418 extern PRInt32 _MD_pr_poll(PRPollDesc *pds, PRIntn npds,419 PRIntervalTime timeout);420 #define _MD_PR_POLL _MD_pr_poll421 422 extern PRInt32 _MD_close(PRInt32 osfd);423 #define _MD_CLOSE_FILE _MD_close424 extern PRInt32 _MD_lseek(PRFileDesc*, PRInt32, PRSeekWhence);425 #define _MD_LSEEK _MD_lseek426 extern PRInt64 _MD_lseek64(PRFileDesc*, PRInt64, PRSeekWhence);427 #define _MD_LSEEK64 _MD_lseek64428 extern PRInt32 _MD_fsync(PRFileDesc *fd);429 #define _MD_FSYNC _MD_fsync430 431 extern PRInt32 _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);432 #define _MD_SOCKETPAIR _MD_socketpair433 434 #define _MD_CLOSE_SOCKET _MD_close435 436 #ifndef NO_NSPR_10_SUPPORT437 #define _MD_STAT stat438 #endif439 440 extern PRStatus _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr,441 PRUint32 *addrlen);442 #define _MD_GETPEERNAME _MD_getpeername443 extern PRStatus _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr,444 PRUint32 *addrlen);445 #define _MD_GETSOCKNAME _MD_getsockname446 447 extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level,448 PRInt32 optname, char* optval, PRInt32* optlen);449 #define _MD_GETSOCKOPT _MD_getsockopt450 extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level,451 PRInt32 optname, const char* optval, PRInt32 optlen);452 #define _MD_SETSOCKOPT _MD_setsockopt453 454 extern PRStatus _MD_set_fd_inheritable(PRFileDesc *fd, PRBool inheritable);455 #define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable456 457 extern void _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);458 #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable459 460 extern void _MD_query_fd_inheritable(PRFileDesc *fd);461 #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable462 463 extern PRStatus _MD_gethostname(char *name, PRUint32 namelen);464 #define _MD_GETHOSTNAME _MD_gethostname465 466 extern int _MD_unix_get_nonblocking_connect_error(int osfd);467 338 468 339 /* … … 542 413 mode_t st_mode; 543 414 nlink_t st_nlink; 544 uid_t st_uid; 545 gid_t st_gid; 415 uid_t st_uid; gid_t st_gid; 546 416 dev_t st_rdev; 547 417 long t_pad2[2]; -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r102178 r102203 184 184 *************************************************************************/ 185 185 /************************************************************************/ 186 187 extern PROffset32 _PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence);188 #define _PR_MD_LSEEK _MD_LSEEK189 190 extern PROffset64 _PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence);191 #define _PR_MD_LSEEK64 _MD_LSEEK64192 193 extern PRInt32 _PR_MD_GETFILEINFO(const char *fn, PRFileInfo *info);194 #define _PR_MD_GETFILEINFO _MD_GETFILEINFO195 196 extern PRInt32 _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info);197 #define _PR_MD_GETFILEINFO64 _MD_GETFILEINFO64198 199 extern PRInt32 _PR_MD_GETOPENFILEINFO(const PRFileDesc *fd, PRFileInfo *info);200 #define _PR_MD_GETOPENFILEINFO _MD_GETOPENFILEINFO201 202 extern PRInt32 _PR_MD_GETOPENFILEINFO64(const PRFileDesc *fd, PRFileInfo64 *info);203 #define _PR_MD_GETOPENFILEINFO64 _MD_GETOPENFILEINFO64204 205 206 /*207 * These flags are used by NSPR temporarily in the poll208 * descriptor's out_flags field to record the mapping of209 * NSPR's poll flags to the system poll flags.210 *211 * If _PR_POLL_READ_SYS_WRITE bit is set, it means the212 * PR_POLL_READ flag specified by the topmost layer is213 * mapped to the WRITE flag at the system layer. Similarly214 * for the other three _PR_POLL_XXX_SYS_YYY flags. It is215 * assumed that the PR_POLL_EXCEPT flag doesn't get mapped216 * to other flags.217 */218 #define _PR_POLL_READ_SYS_READ 0x1219 #define _PR_POLL_READ_SYS_WRITE 0x2220 #define _PR_POLL_WRITE_SYS_READ 0x4221 #define _PR_POLL_WRITE_SYS_WRITE 0x8222 223 /*224 ** These methods are coerced into file descriptor methods table225 ** when the intended service is inappropriate for the particular226 ** type of file descriptor.227 */228 extern PRIntn _PR_InvalidInt(void);229 extern PRInt16 _PR_InvalidInt16(void);230 extern PRInt64 _PR_InvalidInt64(void);231 extern PRStatus _PR_InvalidStatus(void);232 extern PRFileDesc *_PR_InvalidDesc(void);233 234 extern PRIOMethods _pr_faulty_methods;235 236 /*237 ** The PR_NETADDR_SIZE macro can only be called on a PRNetAddr union238 ** whose 'family' field is set. It returns the size of the union239 ** member corresponding to the specified address family.240 */241 242 extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr);243 244 #if defined(_PR_INET6)245 246 #define PR_NETADDR_SIZE(_addr) _PR_NetAddrSize(_addr)247 248 #elif defined(_PR_HAVE_MD_SOCKADDR_IN6)249 250 /*251 ** Under the following conditions:252 ** 1. _PR_INET6 is not defined;253 ** 2. _PR_INET6_PROBE is defined;254 ** 3. struct sockaddr_in6 has nonstandard fields at the end255 ** (e.g., on Solaris 8),256 ** (_addr)->ipv6 is smaller than struct sockaddr_in6, and257 ** hence we can't pass sizeof((_addr)->ipv6) to socket258 ** functions such as connect because they would fail with259 ** EINVAL.260 **261 ** To pass the correct socket address length to socket262 ** functions, define the macro _PR_HAVE_MD_SOCKADDR_IN6 and263 ** define struct _md_sockaddr_in6 to be isomorphic to264 ** struct sockaddr_in6.265 */266 267 #if defined(XP_UNIX) || defined(XP_OS2_EMX)268 #define PR_NETADDR_SIZE(_addr) \269 ((_addr)->raw.family == PR_AF_INET \270 ? sizeof((_addr)->inet) \271 : ((_addr)->raw.family == PR_AF_INET6 \272 ? sizeof(struct _md_sockaddr_in6) \273 : sizeof((_addr)->local)))274 #else275 #define PR_NETADDR_SIZE(_addr) \276 ((_addr)->raw.family == PR_AF_INET \277 ? sizeof((_addr)->inet) \278 : sizeof(struct _md_sockaddr_in6)279 #endif /* defined(XP_UNIX) */280 281 #else282 283 #if defined(XP_UNIX) || defined(XP_OS2_EMX)284 #define PR_NETADDR_SIZE(_addr) \285 ((_addr)->raw.family == PR_AF_INET \286 ? sizeof((_addr)->inet) \287 : ((_addr)->raw.family == PR_AF_INET6 \288 ? sizeof((_addr)->ipv6) \289 : sizeof((_addr)->local)))290 #else291 #define PR_NETADDR_SIZE(_addr) \292 ((_addr)->raw.family == PR_AF_INET \293 ? sizeof((_addr)->inet) \294 : sizeof((_addr)->ipv6))295 #endif /* defined(XP_UNIX) */296 297 #endif /* defined(_PR_INET6) */298 186 299 187 extern void _PR_InitThreads( … … 388 276 }; 389 277 390 struct PRProcessAttr {391 PRFileDesc *stdinFd;392 PRFileDesc *stdoutFd;393 PRFileDesc *stderrFd;394 char *currentDirectory;395 char *fdInheritBuffer;396 PRSize fdInheritBufferSize;397 PRSize fdInheritBufferUsed;398 };399 400 278 struct PRProcess { 401 279 _MDProcess md; … … 403 281 404 282 /************************************************************************/ 405 406 /*407 ** File descriptors of the NSPR layer can be in one of the408 ** following states (stored in the 'state' field of struct409 ** PRFilePrivate):410 ** - _PR_FILEDESC_OPEN: The OS fd is open.411 ** - _PR_FILEDESC_CLOSED: The OS fd is closed. The PRFileDesc412 ** is still open but is unusable. The only operation allowed413 ** on the PRFileDesc is PR_Close().414 ** - _PR_FILEDESC_FREED: The OS fd is closed and the PRFileDesc415 ** structure is freed.416 */417 418 #define _PR_FILEDESC_OPEN 0xaaaaaaaa /* 1010101... */419 #define _PR_FILEDESC_CLOSED 0x55555555 /* 0101010... */420 #define _PR_FILEDESC_FREED 0x11111111421 422 /*423 ** A boolean type with an additional "unknown" state424 */425 426 typedef enum {427 _PR_TRI_TRUE = 1,428 _PR_TRI_FALSE = 0,429 _PR_TRI_UNKNOWN = -1430 } _PRTriStateBool;431 432 struct PRFilePrivate {433 PRInt32 state;434 PRBool nonblocking;435 _PRTriStateBool inheritable;436 PRFileDesc *next;437 PRIntn lockCount; /* 0: not locked438 * -1: a native lockfile call is in progress439 * > 0: # times the file is locked */440 #ifdef _PR_HAVE_PEEK_BUFFER441 char *peekBuffer;442 PRInt32 peekBufSize;443 PRInt32 peekBytes;444 #endif445 #if !defined(XP_UNIX) /* BugZilla: 4090 */446 PRBool appendMode;447 #endif448 _MDFileDesc md;449 #ifdef _PR_STRICT_ADDR_LEN450 PRUint16 af; /* If the platform requires passing the exact451 * length of the sockaddr structure for the452 * address family of the socket to socket453 * functions like accept(), we need to save454 * the address family of the socket. */455 #endif456 };457 283 458 284 extern void _PR_InitSegs(void); … … 500 326 extern PRInt32 _pr_pageShift; 501 327 502 extern PRFileDesc *_pr_stdin;503 extern PRFileDesc *_pr_stdout;504 extern PRFileDesc *_pr_stderr;505 506 507 328 /************************************************************************* 508 329 * External machine-dependent code provided by each OS. * * … … 589 410 #define _PR_MD_GETHOSTNAME _MD_GETHOSTNAME 590 411 591 /* File descriptor inheritance */592 593 /*594 * If fd->secret->inheritable is _PR_TRI_UNKNOWN and we need to595 * know the inheritable attribute of the fd, call this function596 * to find that out. This typically requires a system call.597 */598 extern void _PR_MD_QUERY_FD_INHERITABLE(PRFileDesc *fd);599 #define _PR_MD_QUERY_FD_INHERITABLE _MD_QUERY_FD_INHERITABLE600 601 412 PR_END_EXTERN_C 602 413 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
r102198 r102203 50 50 #include <iprt/process.h> 51 51 #endif 52 53 PRFileDesc *_pr_stdin;54 PRFileDesc *_pr_stdout;55 PRFileDesc *_pr_stderr;56 52 57 53 PRBool _pr_initialized = PR_FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.