VirtualBox

Changeset 102203 in vbox


Ignore:
Timestamp:
Nov 21, 2023 1:20:07 PM (12 months ago)
Author:
vboxsync
Message:

libs/xpcom: Get rid of nsprpub I/O methods and associated code, bugref:10545 [build fix]

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  
    5959#include <errno.h>
    6060
    61 #include "prio.h"
    6261#include "prmem.h"
    6362#include "prclist.h"
     
    299298#define _MD_INIT_FILEDESC(fd)
    300299
    301 extern void             _MD_MakeNonblock(PRFileDesc *fd);
    302 #define _MD_MAKE_NONBLOCK                       _MD_MakeNonblock
    303 
    304300/************************************************************************/
    305301
     
    340336extern void _MD_UnblockClockInterrupts(void);
    341337extern 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_socket
    380 extern PRInt32          _MD_connect(PRFileDesc *fd, const PRNetAddr *addr,
    381                                                                 PRUint32 addrlen, PRIntervalTime timeout);
    382 #define _MD_CONNECT     _MD_connect
    383 extern PRInt32          _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
    384                                                                                                         PRIntervalTime timeout);
    385 #define _MD_ACCEPT      _MD_accept
    386 extern PRInt32          _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
    387 #define _MD_BIND        _MD_bind
    388 extern PRInt32          _MD_listen(PRFileDesc *fd, PRIntn backlog);
    389 #define _MD_LISTEN      _MD_listen
    390 extern PRInt32          _MD_shutdown(PRFileDesc *fd, PRIntn how);
    391 #define _MD_SHUTDOWN    _MD_shutdown
    392 
    393 extern PRInt32          _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
    394                                PRIntn flags, PRIntervalTime timeout);
    395 #define _MD_RECV        _MD_recv
    396 extern PRInt32          _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,
    397                                                                         PRIntn flags, PRIntervalTime timeout);
    398 #define _MD_SEND        _MD_send
    399 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_recvfrom
    403 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_sendto
    407 extern PRInt32          _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,
    408                                                                 PRInt32 iov_size, PRIntervalTime timeout);
    409 #define _MD_WRITEV      _MD_writev
    410 
    411 extern PRInt32          _MD_socketavailable(PRFileDesc *fd);
    412 #define _MD_SOCKETAVAILABLE             _MD_socketavailable
    413 extern PRInt64          _MD_socketavailable64(PRFileDesc *fd);
    414 #define _MD_SOCKETAVAILABLE64           _MD_socketavailable64
    415 
    416 #define _MD_PIPEAVAILABLE               _MD_socketavailable
    417 
    418 extern PRInt32 _MD_pr_poll(PRPollDesc *pds, PRIntn npds,
    419                                                                                                 PRIntervalTime timeout);
    420 #define _MD_PR_POLL             _MD_pr_poll
    421 
    422 extern PRInt32          _MD_close(PRInt32 osfd);
    423 #define _MD_CLOSE_FILE  _MD_close
    424 extern PRInt32          _MD_lseek(PRFileDesc*, PRInt32, PRSeekWhence);
    425 #define _MD_LSEEK       _MD_lseek
    426 extern PRInt64          _MD_lseek64(PRFileDesc*, PRInt64, PRSeekWhence);
    427 #define _MD_LSEEK64     _MD_lseek64
    428 extern PRInt32          _MD_fsync(PRFileDesc *fd);
    429 #define _MD_FSYNC       _MD_fsync
    430 
    431 extern PRInt32 _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
    432 #define _MD_SOCKETPAIR          _MD_socketpair
    433 
    434 #define _MD_CLOSE_SOCKET        _MD_close
    435 
    436 #ifndef NO_NSPR_10_SUPPORT
    437 #define _MD_STAT        stat
    438 #endif
    439 
    440 extern PRStatus _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr,
    441                                                                                         PRUint32 *addrlen);
    442 #define _MD_GETPEERNAME _MD_getpeername
    443 extern PRStatus _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr,
    444                                                                                         PRUint32 *addrlen);
    445 #define _MD_GETSOCKNAME _MD_getsockname
    446 
    447 extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level,
    448                                                 PRInt32 optname, char* optval, PRInt32* optlen);
    449 #define _MD_GETSOCKOPT          _MD_getsockopt
    450 extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level,
    451                                         PRInt32 optname, const char* optval, PRInt32 optlen);
    452 #define _MD_SETSOCKOPT          _MD_setsockopt
    453 
    454 extern PRStatus _MD_set_fd_inheritable(PRFileDesc *fd, PRBool inheritable);
    455 #define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
    456 
    457 extern void _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
    458 #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
    459 
    460 extern void _MD_query_fd_inheritable(PRFileDesc *fd);
    461 #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
    462 
    463 extern PRStatus _MD_gethostname(char *name, PRUint32 namelen);
    464 #define _MD_GETHOSTNAME         _MD_gethostname
    465 
    466 extern int _MD_unix_get_nonblocking_connect_error(int osfd);
    467338
    468339/*
     
    542413    mode_t st_mode;
    543414    nlink_t st_nlink;
    544     uid_t st_uid;
    545     gid_t st_gid;
     415    uid_t st_uid;    gid_t st_gid;
    546416    dev_t st_rdev;
    547417    long t_pad2[2];
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h

    r102178 r102203  
    184184*************************************************************************/
    185185/************************************************************************/
    186 
    187 extern PROffset32 _PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence);
    188 #define    _PR_MD_LSEEK _MD_LSEEK
    189 
    190 extern PROffset64 _PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence);
    191 #define    _PR_MD_LSEEK64 _MD_LSEEK64
    192 
    193 extern PRInt32 _PR_MD_GETFILEINFO(const char *fn, PRFileInfo *info);
    194 #define _PR_MD_GETFILEINFO _MD_GETFILEINFO
    195 
    196 extern PRInt32 _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info);
    197 #define _PR_MD_GETFILEINFO64 _MD_GETFILEINFO64
    198 
    199 extern PRInt32 _PR_MD_GETOPENFILEINFO(const PRFileDesc *fd, PRFileInfo *info);
    200 #define _PR_MD_GETOPENFILEINFO _MD_GETOPENFILEINFO
    201 
    202 extern PRInt32 _PR_MD_GETOPENFILEINFO64(const PRFileDesc *fd, PRFileInfo64 *info);
    203 #define _PR_MD_GETOPENFILEINFO64 _MD_GETOPENFILEINFO64
    204 
    205 
    206 /*
    207  * These flags are used by NSPR temporarily in the poll
    208  * descriptor's out_flags field to record the mapping of
    209  * NSPR's poll flags to the system poll flags.
    210  *
    211  * If _PR_POLL_READ_SYS_WRITE bit is set, it means the
    212  * PR_POLL_READ flag specified by the topmost layer is
    213  * mapped to the WRITE flag at the system layer.  Similarly
    214  * for the other three _PR_POLL_XXX_SYS_YYY flags.  It is
    215  * assumed that the PR_POLL_EXCEPT flag doesn't get mapped
    216  * to other flags.
    217  */
    218 #define _PR_POLL_READ_SYS_READ     0x1
    219 #define _PR_POLL_READ_SYS_WRITE    0x2
    220 #define _PR_POLL_WRITE_SYS_READ    0x4
    221 #define _PR_POLL_WRITE_SYS_WRITE   0x8
    222 
    223 /*
    224 ** These methods are coerced into file descriptor methods table
    225 ** when the intended service is inappropriate for the particular
    226 ** 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 union
    238 ** whose 'family' field is set.  It returns the size of the union
    239 ** 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 end
    255 **    (e.g., on Solaris 8),
    256 ** (_addr)->ipv6 is smaller than struct sockaddr_in6, and
    257 ** hence we can't pass sizeof((_addr)->ipv6) to socket
    258 ** functions such as connect because they would fail with
    259 ** EINVAL.
    260 **
    261 ** To pass the correct socket address length to socket
    262 ** functions, define the macro _PR_HAVE_MD_SOCKADDR_IN6 and
    263 ** define struct _md_sockaddr_in6 to be isomorphic to
    264 ** 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 #else
    275 #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 #else
    282 
    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 #else
    291 #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) */
    298186
    299187extern void _PR_InitThreads(
     
    388276};
    389277
    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 
    400278struct PRProcess {
    401279    _MDProcess md;
     
    403281
    404282/************************************************************************/
    405 
    406 /*
    407 ** File descriptors of the NSPR layer can be in one of the
    408 ** following states (stored in the 'state' field of struct
    409 ** PRFilePrivate):
    410 ** - _PR_FILEDESC_OPEN: The OS fd is open.
    411 ** - _PR_FILEDESC_CLOSED: The OS fd is closed.  The PRFileDesc
    412 **   is still open but is unusable.  The only operation allowed
    413 **   on the PRFileDesc is PR_Close().
    414 ** - _PR_FILEDESC_FREED: The OS fd is closed and the PRFileDesc
    415 **   structure is freed.
    416 */
    417 
    418 #define _PR_FILEDESC_OPEN       0xaaaaaaaa    /* 1010101... */
    419 #define _PR_FILEDESC_CLOSED     0x55555555    /* 0101010... */
    420 #define _PR_FILEDESC_FREED      0x11111111
    421 
    422 /*
    423 ** A boolean type with an additional "unknown" state
    424 */
    425 
    426 typedef enum {
    427     _PR_TRI_TRUE = 1,
    428     _PR_TRI_FALSE = 0,
    429     _PR_TRI_UNKNOWN = -1
    430 } _PRTriStateBool;
    431 
    432 struct PRFilePrivate {
    433     PRInt32 state;
    434     PRBool nonblocking;
    435     _PRTriStateBool inheritable;
    436     PRFileDesc *next;
    437     PRIntn lockCount;   /*   0: not locked
    438                          *  -1: a native lockfile call is in progress
    439                          * > 0: # times the file is locked */
    440 #ifdef _PR_HAVE_PEEK_BUFFER
    441     char *peekBuffer;
    442     PRInt32 peekBufSize;
    443     PRInt32 peekBytes;
    444 #endif
    445 #if !defined(XP_UNIX)   /* BugZilla: 4090 */
    446     PRBool  appendMode;
    447 #endif
    448     _MDFileDesc md;
    449 #ifdef _PR_STRICT_ADDR_LEN
    450     PRUint16 af;        /* If the platform requires passing the exact
    451                          * length of the sockaddr structure for the
    452                          * address family of the socket to socket
    453                          * functions like accept(), we need to save
    454                          * the address family of the socket. */
    455 #endif
    456 };
    457283
    458284extern void _PR_InitSegs(void);
     
    500326extern PRInt32 _pr_pageShift;
    501327
    502 extern PRFileDesc *_pr_stdin;
    503 extern PRFileDesc *_pr_stdout;
    504 extern PRFileDesc *_pr_stderr;
    505 
    506 
    507328/*************************************************************************
    508329* External machine-dependent code provided by each OS.                     *                                                                     *
     
    589410#define    _PR_MD_GETHOSTNAME _MD_GETHOSTNAME
    590411
    591 /* File descriptor inheritance */
    592 
    593 /*
    594  * If fd->secret->inheritable is _PR_TRI_UNKNOWN and we need to
    595  * know the inheritable attribute of the fd, call this function
    596  * 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_INHERITABLE
    600 
    601412PR_END_EXTERN_C
    602413
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c

    r102198 r102203  
    5050#include <iprt/process.h>
    5151#endif
    52 
    53 PRFileDesc *_pr_stdin;
    54 PRFileDesc *_pr_stdout;
    55 PRFileDesc *_pr_stderr;
    5652
    5753PRBool _pr_initialized = PR_FALSE;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette