Changeset 102217 in vbox for trunk/src/libs/xpcom18a4/nsprpub
- Timestamp:
- Nov 21, 2023 3:14:20 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h
r102203 r102217 75 75 #include <sys/time.h> 76 76 #include <sys/types.h> 77 #if defined(AIX) /* Only pre-4.2 AIX needs it, but for simplicity... */78 #include <sys/select.h>79 #endif80 77 81 78 #define PR_DIRECTORY_SEPARATOR '/' … … 91 88 #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 92 89 extern PRIntervalTime intr_timeout_ticks; 93 94 /*95 * The bit flags for the in_flags and out_flags fields96 * of _PR_UnixPollDesc97 */98 #ifdef _PR_USE_POLL99 #define _PR_UNIX_POLL_READ POLLIN100 #define _PR_UNIX_POLL_WRITE POLLOUT101 #define _PR_UNIX_POLL_EXCEPT POLLPRI102 #define _PR_UNIX_POLL_ERR POLLERR103 #define _PR_UNIX_POLL_NVAL POLLNVAL104 #define _PR_UNIX_POLL_HUP POLLHUP105 #else /* _PR_USE_POLL */106 #define _PR_UNIX_POLL_READ 0x1107 #define _PR_UNIX_POLL_WRITE 0x2108 #define _PR_UNIX_POLL_EXCEPT 0x4109 #define _PR_UNIX_POLL_ERR 0x8110 #define _PR_UNIX_POLL_NVAL 0x10111 #define _PR_UNIX_POLL_HUP 0x20112 #endif /* _PR_USE_POLL */113 114 typedef struct _PRUnixPollDesc {115 PRInt32 osfd;116 PRInt16 in_flags;117 PRInt16 out_flags;118 } _PRUnixPollDesc;119 120 typedef struct PRPollQueue {121 PRCList links; /* for linking PRPollQueue's together */122 _PRUnixPollDesc *pds; /* array of poll descriptors */123 PRUintn npds; /* length of the array */124 PRPackedBool on_ioq; /* is this on the async i/o work q? */125 PRIntervalTime timeout; /* timeout, in ticks */126 struct PRThread *thr;127 } PRPollQueue;128 129 #define _PR_POLLQUEUE_PTR(_qp) \130 ((PRPollQueue*) ((char*) (_qp) - offsetof(PRPollQueue,links)))131 132 133 extern PRInt32 _PR_WaitForMultipleFDs(134 _PRUnixPollDesc *unixpds,135 PRInt32 pdcnt,136 PRIntervalTime timeout);137 extern void _PR_Unblock_IO_Wait(struct PRThread *thr);138 139 extern fd_set _pr_md_read_set, _pr_md_write_set, _pr_md_exception_set;140 extern PRInt16 _pr_md_read_cnt[], _pr_md_write_cnt[], _pr_md_exception_cnt[];141 extern PRInt32 _pr_md_ioq_max_osfd;142 extern PRUint32 _pr_md_ioq_timeout;143 144 struct _MDFileDesc {145 int osfd;146 #if defined(LINUX) && defined(_PR_PTHREADS)147 int tcp_nodelay; /* used by pt_LinuxSendFile */148 #endif149 };150 151 struct _MDDir {152 DIR *d;153 };154 155 struct _PRCPU;156 extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);157 90 158 91 /* … … 225 158 /************************************************************************/ 226 159 227 struct _MDProcess {228 pid_t pid;229 };230 231 struct PRProcess;232 struct PRProcessAttr;233 234 /* Create a new process (fork() + exec()) */235 #define _MD_CREATE_PROCESS _MD_CreateUnixProcess236 extern struct PRProcess * _MD_CreateUnixProcess(237 const char *path,238 char *const *argv,239 char *const *envp,240 const struct PRProcessAttr *attr241 );242 243 #ifdef VBOX244 /* Create a new detached process (fork() + exec()) */245 #define _MD_CREATE_PROCESS_DETACHED _MD_CreateUnixProcessDetached246 extern PRStatus _MD_CreateUnixProcessDetached(247 const char *path,248 char *const *argv,249 char *const *envp,250 const struct PRProcessAttr *attr251 );252 #endif /* VBOX */253 254 #define _MD_DETACH_PROCESS _MD_DetachUnixProcess255 extern PRStatus _MD_DetachUnixProcess(struct PRProcess *process);256 257 /* Wait for a child process to terminate */258 #define _MD_WAIT_PROCESS _MD_WaitUnixProcess259 extern PRStatus _MD_WaitUnixProcess(struct PRProcess *process,260 PRInt32 *exitCode);261 262 #define _MD_KILL_PROCESS _MD_KillUnixProcess263 extern PRStatus _MD_KillUnixProcess(struct PRProcess *process);264 265 /************************************************************************/266 267 extern void _MD_EnableClockInterrupts(void);268 extern void _MD_DisableClockInterrupts(void);269 270 #define _MD_START_INTERRUPTS _MD_StartInterrupts271 #define _MD_STOP_INTERRUPTS _MD_StopInterrupts272 #define _MD_DISABLE_CLOCK_INTERRUPTS _MD_DisableClockInterrupts273 #define _MD_ENABLE_CLOCK_INTERRUPTS _MD_EnableClockInterrupts274 #define _MD_BLOCK_CLOCK_INTERRUPTS _MD_BlockClockInterrupts275 #define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_UnblockClockInterrupts276 277 /************************************************************************/278 279 extern void _MD_InitCPUS(void);280 #define _MD_INIT_CPUS _MD_InitCPUS281 282 extern void _MD_Wakeup_CPUs(void);283 #define _MD_WAKEUP_CPUS _MD_Wakeup_CPUs284 285 #define _MD_PAUSE_CPU _MD_PauseCPU286 287 #ifndef IRIX288 #define _MD_EXIT(status) _exit(status)289 #endif290 291 /************************************************************************/292 293 #define _MD_GET_ENV getenv294 #define _MD_PUT_ENV putenv295 296 /************************************************************************/297 298 #define _MD_INIT_FILEDESC(fd)299 300 /************************************************************************/301 302 #if !defined(_PR_PTHREADS)303 304 extern void _MD_InitSegs(void);305 extern PRStatus _MD_AllocSegment(PRSegment *seg, PRUint32 size,306 void *vaddr);307 extern void _MD_FreeSegment(PRSegment *seg);308 309 #define _MD_INIT_SEGS _MD_InitSegs310 #define _MD_ALLOC_SEGMENT _MD_AllocSegment311 #define _MD_FREE_SEGMENT _MD_FreeSegment312 313 #endif /* !defined(_PR_PTHREADS) */314 315 /************************************************************************/316 317 160 #if !defined(HPUX_LW_TIMER) 318 161 #define _MD_INTERVAL_INIT() … … 328 171 /************************************************************************/ 329 172 330 extern PRInt32 _MD_AvailableSocket(PRInt32 osfd);331 332 extern void _MD_StartInterrupts(void);333 extern void _MD_StopInterrupts(void);334 extern void _MD_DisableClockInterrupts(void);335 extern void _MD_BlockClockInterrupts(void);336 extern void _MD_UnblockClockInterrupts(void);337 extern void _MD_PauseCPU(PRIntervalTime timeout);338 339 173 /* 340 174 * The standard (XPG4) gettimeofday() (from BSD) takes two arguments. … … 348 182 #endif 349 183 350 #if defined(_PR_PTHREADS) && !defined(_PR_POLL_AVAILABLE)351 #define _PR_NEED_FAKE_POLL352 #endif353 354 #if defined(_PR_NEED_FAKE_POLL)355 356 /*357 * Some platforms don't have poll(), but our pthreads code calls poll().358 * As a temporary measure, I implemented a fake poll() using select().359 * Here are the struct and macro definitions copied from sys/poll.h360 * on Solaris 2.5.361 */362 363 struct pollfd {364 int fd;365 short events;366 short revents;367 };368 369 /* poll events */370 371 #define POLLIN 0x0001 /* fd is readable */372 #define POLLPRI 0x0002 /* high priority info at fd */373 #define POLLOUT 0x0004 /* fd is writeable (won't block) */374 #define POLLRDNORM 0x0040 /* normal data is readable */375 #define POLLWRNORM POLLOUT376 #define POLLRDBAND 0x0080 /* out-of-band data is readable */377 #define POLLWRBAND 0x0100 /* out-of-band data is writeable */378 379 #define POLLNORM POLLRDNORM380 381 #define POLLERR 0x0008 /* fd has error condition */382 #define POLLHUP 0x0010 /* fd has been hung up on */383 #define POLLNVAL 0x0020 /* invalid pollfd entry */384 385 extern int poll(struct pollfd *, unsigned long, int);386 387 #endif /* _PR_NEED_FAKE_POLL */388 389 /*390 ** A vector of the UNIX I/O calls we use. These are here to smooth over391 ** the rough edges needed for large files. All of NSPR's implmentaions392 ** go through this vector using syntax of the form393 ** result = _md_iovector.xxx64(args);394 */395 396 #if defined(SOLARIS2_5)397 /*398 ** Special case: Solaris 2.5.1399 ** Solaris starts to have 64-bit file I/O in 2.6. We build on Solaris400 ** 2.5.1 so that we can use the same binaries on both Solaris 2.5.1 and401 ** 2.6. At run time, we detect whether 64-bit file I/O is available by402 ** looking up the 64-bit file function symbols in libc. At build time,403 ** we need to define the 64-bit file I/O datatypes that are compatible404 ** with their definitions on Solaris 2.6.405 */406 typedef PRInt64 off64_t;407 typedef PRUint64 ino64_t;408 typedef PRInt64 blkcnt64_t;409 struct stat64 {410 dev_t st_dev;411 long st_pad1[3];412 ino64_t st_ino;413 mode_t st_mode;414 nlink_t st_nlink;415 uid_t st_uid; gid_t st_gid;416 dev_t st_rdev;417 long t_pad2[2];418 off64_t st_size;419 timestruc_t st_atim;420 timestruc_t st_mtim;421 timestruc_t st_ctim;422 long st_blksize;423 blkcnt64_t st_blocks;424 char st_fstype[_ST_FSTYPSZ];425 long st_pad4[8];426 };427 typedef struct stat64 _MDStat64;428 typedef off64_t _MDOff64_t;429 430 #elif defined(_PR_HAVE_OFF64_T)431 typedef struct stat64 _MDStat64;432 typedef off64_t _MDOff64_t;433 #elif defined(_PR_HAVE_LARGE_OFF_T)434 typedef struct stat _MDStat64;435 typedef off_t _MDOff64_t;436 #elif defined(_PR_NO_LARGE_FILES)437 typedef struct stat _MDStat64;438 typedef PRInt64 _MDOff64_t;439 #else440 #error "I don't know yet"441 #endif442 443 typedef PRIntn (*_MD_Fstat64)(PRIntn osfd, _MDStat64 *buf);444 typedef PRIntn (*_MD_Open64)(const char *path, int oflag, ...);445 #if defined(VMS)446 typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf, ...);447 #else448 typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf);449 #endif450 typedef _MDOff64_t (*_MD_Lseek64)(PRIntn osfd, _MDOff64_t, PRIntn whence);451 typedef void* (*_MD_Mmap64)(452 void *addr, PRSize len, PRIntn prot, PRIntn flags,453 PRIntn fildes, _MDOff64_t offset);454 struct _MD_IOVector455 {456 _MD_Open64 _open64;457 _MD_Mmap64 _mmap64;458 _MD_Stat64 _stat64;459 _MD_Fstat64 _fstat64;460 _MD_Lseek64 _lseek64;461 };462 extern struct _MD_IOVector _md_iovector;463 464 184 #endif /* prunixos_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.