1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
42 * If FD_SETSIZE is not defined on the command line, set the default value
43 * before include select.h
46 * Linux: FD_SETSIZE is defined in /usr/include/sys/select.h and should
49 #if !defined(LINUX) && !defined(__GNU__) && !defined(__GLIBC__) \
50 && !defined(DARWIN) && !defined(NEXTSTEP)
52 #define FD_SETSIZE 4096
67 * For select(), fd_set, and struct timeval.
69 * In The Single UNIX(R) Specification, Version 2,
70 * the header file for select() is <sys/time.h>.
71 * In Version 3, the header file for select() is
72 * changed to <sys/select.h>.
74 * fd_set is defined in <sys/types.h>. Usually
75 * <sys/time.h> includes <sys/types.h>, but on some
76 * older systems <sys/time.h> does not include
77 * <sys/types.h>, so we include it explicitly.
80 #include <sys/types.h>
81 #if defined(AIX) || defined(SYMBIAN)
82 #include <sys/select.h>
86 #define HAVE_NETINET_TCP_H
89 #define _PR_HAVE_O_APPEND
91 #define PR_DIRECTORY_SEPARATOR '/'
92 #define PR_DIRECTORY_SEPARATOR_STR "/"
93 #define PR_PATH_SEPARATOR ':'
94 #define PR_PATH_SEPARATOR_STR ":"
96 typedef int (*FARPROC
)();
99 * intervals at which GLOBAL threads wakeup to check for pending interrupt
101 #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
102 extern PRIntervalTime intr_timeout_ticks
;
105 * The bit flags for the in_flags and out_flags fields
106 * of _PR_UnixPollDesc
109 #define _PR_UNIX_POLL_READ POLLIN
110 #define _PR_UNIX_POLL_WRITE POLLOUT
111 #define _PR_UNIX_POLL_EXCEPT POLLPRI
112 #define _PR_UNIX_POLL_ERR POLLERR
113 #define _PR_UNIX_POLL_NVAL POLLNVAL
114 #define _PR_UNIX_POLL_HUP POLLHUP
115 #else /* _PR_USE_POLL */
116 #define _PR_UNIX_POLL_READ 0x1
117 #define _PR_UNIX_POLL_WRITE 0x2
118 #define _PR_UNIX_POLL_EXCEPT 0x4
119 #define _PR_UNIX_POLL_ERR 0x8
120 #define _PR_UNIX_POLL_NVAL 0x10
121 #define _PR_UNIX_POLL_HUP 0x20
122 #endif /* _PR_USE_POLL */
124 typedef struct _PRUnixPollDesc
{
130 typedef struct PRPollQueue
{
131 PRCList links
; /* for linking PRPollQueue's together */
132 _PRUnixPollDesc
*pds
; /* array of poll descriptors */
133 PRUintn npds
; /* length of the array */
134 PRPackedBool on_ioq
; /* is this on the async i/o work q? */
135 PRIntervalTime timeout
; /* timeout, in ticks */
136 struct PRThread
*thr
;
139 #define _PR_POLLQUEUE_PTR(_qp) \
140 ((PRPollQueue*) ((char*) (_qp) - offsetof(PRPollQueue,links)))
143 extern PRInt32
_PR_WaitForMultipleFDs(
144 _PRUnixPollDesc
*unixpds
,
146 PRIntervalTime timeout
);
147 extern void _PR_Unblock_IO_Wait(struct PRThread
*thr
);
149 #if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
150 #define _MD_CHECK_FOR_EXIT()
153 extern fd_set _pr_md_read_set
, _pr_md_write_set
, _pr_md_exception_set
;
154 extern PRInt16 _pr_md_read_cnt
[], _pr_md_write_cnt
[], _pr_md_exception_cnt
[];
155 extern PRInt32 _pr_md_ioq_max_osfd
;
156 extern PRUint32 _pr_md_ioq_timeout
;
160 #if defined(LINUX) && defined(_PR_PTHREADS)
161 int tcp_nodelay
; /* used by pt_LinuxSendFile */
170 extern void _MD_unix_init_running_cpu(struct _PRCPU
*cpu
);
173 ** Make a redzone at both ends of the stack segment. Disallow access
174 ** to those pages of memory. It's ok if the mprotect call's don't
175 ** work - it just means that we don't really have a functional
178 #include <sys/mman.h>
180 #define PROT_NONE 0x0
183 #if defined(DEBUG) && !defined(DARWIN) && !defined(NEXTSTEP)
184 #if !defined(SOLARIS)
185 #include <string.h> /* for memset() */
186 #define _MD_INIT_STACK(ts,REDZONE) \
188 (void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
189 (void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
190 REDZONE, PROT_NONE); \
192 ** Fill stack memory with something that turns into an illegal \
193 ** pointer value. This will sometimes find runtime references to \
194 ** uninitialized pointers. We don't do this for solaris because we \
195 ** can use purify instead. \
197 if (_pr_debugStacks) { \
198 memset(ts->allocBase + REDZONE, 0xf7, ts->stackSize); \
202 #define _MD_INIT_STACK(ts,REDZONE) \
204 (void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
205 (void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
206 REDZONE, PROT_NONE); \
208 #endif /* !SOLARIS */
212 * Allow access to the redzone pages; the access was turned off in
215 #define _MD_CLEAR_STACK(ts) \
217 (void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_READ|PROT_WRITE);\
218 (void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
219 REDZONE, PROT_READ|PROT_WRITE); \
224 #define _MD_INIT_STACK(ts,REDZONE)
225 #define _MD_CLEAR_STACK(ts)
229 #if !defined(SOLARIS)
231 #define PR_SET_INTSOFF(newval)
235 /************************************************************************/
237 extern void _PR_UnixInit(void);
239 /************************************************************************/
246 struct PRProcessAttr
;
248 /* Create a new process (fork() + exec()) */
249 #define _MD_CREATE_PROCESS _MD_CreateUnixProcess
250 extern struct PRProcess
* _MD_CreateUnixProcess(
254 const struct PRProcessAttr
*attr
257 #define _MD_DETACH_PROCESS _MD_DetachUnixProcess
258 extern PRStatus
_MD_DetachUnixProcess(struct PRProcess
*process
);
260 /* Wait for a child process to terminate */
261 #define _MD_WAIT_PROCESS _MD_WaitUnixProcess
262 extern PRStatus
_MD_WaitUnixProcess(struct PRProcess
*process
,
265 #define _MD_KILL_PROCESS _MD_KillUnixProcess
266 extern PRStatus
_MD_KillUnixProcess(struct PRProcess
*process
);
268 /************************************************************************/
270 extern void _MD_EnableClockInterrupts(void);
271 extern void _MD_DisableClockInterrupts(void);
273 #define _MD_START_INTERRUPTS _MD_StartInterrupts
274 #define _MD_STOP_INTERRUPTS _MD_StopInterrupts
275 #define _MD_DISABLE_CLOCK_INTERRUPTS _MD_DisableClockInterrupts
276 #define _MD_ENABLE_CLOCK_INTERRUPTS _MD_EnableClockInterrupts
277 #define _MD_BLOCK_CLOCK_INTERRUPTS _MD_BlockClockInterrupts
278 #define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_UnblockClockInterrupts
280 /************************************************************************/
282 extern void _MD_InitCPUS(void);
283 #define _MD_INIT_CPUS _MD_InitCPUS
285 extern void _MD_Wakeup_CPUs(void);
286 #define _MD_WAKEUP_CPUS _MD_Wakeup_CPUs
288 #define _MD_PAUSE_CPU _MD_PauseCPU
290 #if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
291 #define _MD_CLEANUP_BEFORE_EXIT()
295 #define _MD_EXIT(status) _exit(status)
298 /************************************************************************/
300 #define _MD_GET_ENV getenv
301 #define _MD_PUT_ENV putenv
303 /************************************************************************/
305 #define _MD_INIT_FILEDESC(fd)
307 extern void _MD_MakeNonblock(PRFileDesc
*fd
);
308 #define _MD_MAKE_NONBLOCK _MD_MakeNonblock
310 /************************************************************************/
312 #if !defined(_PR_PTHREADS)
314 extern void _MD_InitSegs(void);
315 extern PRStatus
_MD_AllocSegment(PRSegment
*seg
, PRUint32 size
,
317 extern void _MD_FreeSegment(PRSegment
*seg
);
319 #define _MD_INIT_SEGS _MD_InitSegs
320 #define _MD_ALLOC_SEGMENT _MD_AllocSegment
321 #define _MD_FREE_SEGMENT _MD_FreeSegment
323 #endif /* !defined(_PR_PTHREADS) */
325 /************************************************************************/
327 #if !defined(HPUX_LW_TIMER)
328 #define _MD_INTERVAL_INIT()
330 #define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
331 #define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
333 /************************************************************************/
335 #define _MD_ERRNO() (errno)
336 #define _MD_GET_SOCKET_ERROR() (errno)
338 /************************************************************************/
340 extern PRInt32
_MD_AvailableSocket(PRInt32 osfd
);
342 extern void _MD_StartInterrupts(void);
343 extern void _MD_StopInterrupts(void);
344 extern void _MD_DisableClockInterrupts(void);
345 extern void _MD_BlockClockInterrupts(void);
346 extern void _MD_UnblockClockInterrupts(void);
347 extern void _MD_PauseCPU(PRIntervalTime timeout
);
349 extern PRStatus
_MD_open_dir(struct _MDDir
*, const char *);
350 extern PRInt32
_MD_close_dir(struct _MDDir
*);
351 extern char * _MD_read_dir(struct _MDDir
*, PRIntn
);
352 extern PRInt32
_MD_open(const char *name
, PRIntn osflags
, PRIntn mode
);
353 extern PRInt32
_MD_delete(const char *name
);
354 extern PRInt32
_MD_getfileinfo(const char *fn
, PRFileInfo
*info
);
355 extern PRInt32
_MD_getfileinfo64(const char *fn
, PRFileInfo64
*info
);
356 extern PRInt32
_MD_getopenfileinfo(const PRFileDesc
*fd
, PRFileInfo
*info
);
357 extern PRInt32
_MD_getopenfileinfo64(const PRFileDesc
*fd
, PRFileInfo64
*info
);
358 extern PRInt32
_MD_rename(const char *from
, const char *to
);
359 extern PRInt32
_MD_access(const char *name
, PRAccessHow how
);
360 extern PRInt32
_MD_mkdir(const char *name
, PRIntn mode
);
361 extern PRInt32
_MD_rmdir(const char *name
);
362 extern PRInt32
_MD_accept_read(PRInt32 sock
, PRInt32
*newSock
,
363 PRNetAddr
**raddr
, void *buf
, PRInt32 amount
);
364 extern PRInt32
_PR_UnixSendFile(PRFileDesc
*sd
, PRSendFileData
*sfd
,
365 PRTransmitFileFlags flags
, PRIntervalTime timeout
);
367 extern PRStatus
_MD_LockFile(PRInt32 osfd
);
368 extern PRStatus
_MD_TLockFile(PRInt32 osfd
);
369 extern PRStatus
_MD_UnlockFile(PRInt32 osfd
);
371 #define _MD_OPEN_DIR(dir, name) _MD_open_dir(dir, name)
372 #define _MD_CLOSE_DIR(dir) _MD_close_dir(dir)
373 #define _MD_READ_DIR(dir, flags) _MD_read_dir(dir, flags)
374 #define _MD_OPEN(name, osflags, mode) _MD_open(name, osflags, mode)
375 #define _MD_OPEN_FILE(name, osflags, mode) _MD_open(name, osflags, mode)
376 extern PRInt32
_MD_read(PRFileDesc
*fd
, void *buf
, PRInt32 amount
);
377 #define _MD_READ(fd,buf,amount) _MD_read(fd,buf,amount)
378 extern PRInt32
_MD_write(PRFileDesc
*fd
, const void *buf
, PRInt32 amount
);
379 #define _MD_WRITE(fd,buf,amount) _MD_write(fd,buf,amount)
380 #define _MD_DELETE(name) _MD_delete(name)
381 #define _MD_GETFILEINFO(fn, info) _MD_getfileinfo(fn, info)
382 #define _MD_GETFILEINFO64(fn, info) _MD_getfileinfo64(fn, info)
383 #define _MD_GETOPENFILEINFO(fd, info) _MD_getopenfileinfo(fd, info)
384 #define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)
385 #define _MD_RENAME(from, to) _MD_rename(from, to)
386 #define _MD_ACCESS(name, how) _MD_access(name, how)
387 #define _MD_MKDIR(name, mode) _MD_mkdir(name, mode)
388 #define _MD_MAKE_DIR(name, mode) _MD_mkdir(name, mode)
389 #define _MD_RMDIR(name) _MD_rmdir(name)
390 #define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount) _MD_accept_read(sock, newSock, raddr, buf, amount)
392 #define _MD_LOCKFILE _MD_LockFile
393 #define _MD_TLOCKFILE _MD_TLockFile
394 #define _MD_UNLOCKFILE _MD_UnlockFile
397 extern PRInt32
_MD_socket(int af
, int type
, int flags
);
398 #define _MD_SOCKET _MD_socket
399 extern PRInt32
_MD_connect(PRFileDesc
*fd
, const PRNetAddr
*addr
,
400 PRUint32 addrlen
, PRIntervalTime timeout
);
401 #define _MD_CONNECT _MD_connect
402 extern PRInt32
_MD_accept(PRFileDesc
*fd
, PRNetAddr
*addr
, PRUint32
*addrlen
,
403 PRIntervalTime timeout
);
404 #define _MD_ACCEPT _MD_accept
405 extern PRInt32
_MD_bind(PRFileDesc
*fd
, const PRNetAddr
*addr
, PRUint32 addrlen
);
406 #define _MD_BIND _MD_bind
407 extern PRInt32
_MD_listen(PRFileDesc
*fd
, PRIntn backlog
);
408 #define _MD_LISTEN _MD_listen
409 extern PRInt32
_MD_shutdown(PRFileDesc
*fd
, PRIntn how
);
410 #define _MD_SHUTDOWN _MD_shutdown
412 extern PRInt32
_MD_recv(PRFileDesc
*fd
, void *buf
, PRInt32 amount
,
413 PRIntn flags
, PRIntervalTime timeout
);
414 #define _MD_RECV _MD_recv
415 extern PRInt32
_MD_send(PRFileDesc
*fd
, const void *buf
, PRInt32 amount
,
416 PRIntn flags
, PRIntervalTime timeout
);
417 #define _MD_SEND _MD_send
418 extern PRInt32
_MD_recvfrom(PRFileDesc
*fd
, void *buf
, PRInt32 amount
,
419 PRIntn flags
, PRNetAddr
*addr
, PRUint32
*addrlen
,
420 PRIntervalTime timeout
);
421 #define _MD_RECVFROM _MD_recvfrom
422 extern PRInt32
_MD_sendto(PRFileDesc
*fd
, const void *buf
, PRInt32 amount
,
423 PRIntn flags
, const PRNetAddr
*addr
, PRUint32 addrlen
,
424 PRIntervalTime timeout
);
425 #define _MD_SENDTO _MD_sendto
426 extern PRInt32
_MD_writev(PRFileDesc
*fd
, const struct PRIOVec
*iov
,
427 PRInt32 iov_size
, PRIntervalTime timeout
);
428 #define _MD_WRITEV _MD_writev
430 extern PRInt32
_MD_socketavailable(PRFileDesc
*fd
);
431 #define _MD_SOCKETAVAILABLE _MD_socketavailable
432 extern PRInt64
_MD_socketavailable64(PRFileDesc
*fd
);
433 #define _MD_SOCKETAVAILABLE64 _MD_socketavailable64
435 #define _MD_PIPEAVAILABLE _MD_socketavailable
437 extern PRInt32
_MD_pr_poll(PRPollDesc
*pds
, PRIntn npds
,
438 PRIntervalTime timeout
);
439 #define _MD_PR_POLL _MD_pr_poll
441 extern PRInt32
_MD_close(PRInt32 osfd
);
442 #define _MD_CLOSE_FILE _MD_close
443 extern PRInt32
_MD_lseek(PRFileDesc
*, PRInt32
, PRSeekWhence
);
444 #define _MD_LSEEK _MD_lseek
445 extern PRInt64
_MD_lseek64(PRFileDesc
*, PRInt64
, PRSeekWhence
);
446 #define _MD_LSEEK64 _MD_lseek64
447 extern PRInt32
_MD_fsync(PRFileDesc
*fd
);
448 #define _MD_FSYNC _MD_fsync
450 extern PRInt32
_MD_socketpair(int af
, int type
, int flags
, PRInt32
*osfd
);
451 #define _MD_SOCKETPAIR _MD_socketpair
453 #define _MD_CLOSE_SOCKET _MD_close
455 #ifndef NO_NSPR_10_SUPPORT
456 #define _MD_STAT stat
459 extern PRStatus
_MD_getpeername(PRFileDesc
*fd
, PRNetAddr
*addr
,
461 #define _MD_GETPEERNAME _MD_getpeername
462 extern PRStatus
_MD_getsockname(PRFileDesc
*fd
, PRNetAddr
*addr
,
464 #define _MD_GETSOCKNAME _MD_getsockname
466 extern PRStatus
_MD_getsockopt(PRFileDesc
*fd
, PRInt32 level
,
467 PRInt32 optname
, char* optval
, PRInt32
* optlen
);
468 #define _MD_GETSOCKOPT _MD_getsockopt
469 extern PRStatus
_MD_setsockopt(PRFileDesc
*fd
, PRInt32 level
,
470 PRInt32 optname
, const char* optval
, PRInt32 optlen
);
471 #define _MD_SETSOCKOPT _MD_setsockopt
473 extern PRStatus
_MD_set_fd_inheritable(PRFileDesc
*fd
, PRBool inheritable
);
474 #define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
476 extern void _MD_init_fd_inheritable(PRFileDesc
*fd
, PRBool imported
);
477 #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
479 extern void _MD_query_fd_inheritable(PRFileDesc
*fd
);
480 #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
482 extern PRStatus
_MD_gethostname(char *name
, PRUint32 namelen
);
483 #define _MD_GETHOSTNAME _MD_gethostname
485 extern PRStatus
_MD_getsysinfo(PRSysInfo cmd
, char *name
, PRUint32 namelen
);
486 #define _MD_GETSYSINFO _MD_getsysinfo
488 extern int _MD_unix_get_nonblocking_connect_error(int osfd
);
490 /* Memory-mapped files */
495 PRBool isAnonFM
; /* when true, PR_CloseFileMap() must close the related fd */
498 extern PRStatus
_MD_CreateFileMap(struct PRFileMap
*fmap
, PRInt64 size
);
499 #define _MD_CREATE_FILE_MAP _MD_CreateFileMap
501 #define _MD_GET_MEM_MAP_ALIGNMENT() PR_GetPageSize()
503 extern void * _MD_MemMap(struct PRFileMap
*fmap
, PRInt64 offset
,
505 #define _MD_MEM_MAP _MD_MemMap
507 extern PRStatus
_MD_MemUnmap(void *addr
, PRUint32 size
);
508 #define _MD_MEM_UNMAP _MD_MemUnmap
510 extern PRStatus
_MD_CloseFileMap(struct PRFileMap
*fmap
);
511 #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
514 * The standard (XPG4) gettimeofday() (from BSD) takes two arguments.
515 * On some SVR4 derivatives, gettimeofday() takes only one argument.
516 * The GETTIMEOFDAY macro is intended to hide this difference.
518 #ifdef HAVE_SVID_GETTOD
519 #define GETTIMEOFDAY(tp) gettimeofday(tp)
521 #define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
524 #if defined(_PR_PTHREADS) && !defined(_PR_POLL_AVAILABLE)
525 #define _PR_NEED_FAKE_POLL
528 #if defined(_PR_NEED_FAKE_POLL)
531 * Some platforms don't have poll(), but our pthreads code calls poll().
532 * As a temporary measure, I implemented a fake poll() using select().
533 * Here are the struct and macro definitions copied from sys/poll.h
545 #define POLLIN 0x0001 /* fd is readable */
546 #define POLLPRI 0x0002 /* high priority info at fd */
547 #define POLLOUT 0x0004 /* fd is writeable (won't block) */
548 #define POLLRDNORM 0x0040 /* normal data is readable */
549 #define POLLWRNORM POLLOUT
550 #define POLLRDBAND 0x0080 /* out-of-band data is readable */
551 #define POLLWRBAND 0x0100 /* out-of-band data is writeable */
553 #define POLLNORM POLLRDNORM
555 #define POLLERR 0x0008 /* fd has error condition */
556 #define POLLHUP 0x0010 /* fd has been hung up on */
557 #define POLLNVAL 0x0020 /* invalid pollfd entry */
559 extern int poll(struct pollfd
*, unsigned long, int);
561 #endif /* _PR_NEED_FAKE_POLL */
564 ** A vector of the UNIX I/O calls we use. These are here to smooth over
565 ** the rough edges needed for large files. All of NSPR's implmentaions
566 ** go through this vector using syntax of the form
567 ** result = _md_iovector.xxx64(args);
570 #if defined(SOLARIS2_5)
572 ** Special case: Solaris 2.5.1
573 ** Solaris starts to have 64-bit file I/O in 2.6. We build on Solaris
574 ** 2.5.1 so that we can use the same binaries on both Solaris 2.5.1 and
575 ** 2.6. At run time, we detect whether 64-bit file I/O is available by
576 ** looking up the 64-bit file function symbols in libc. At build time,
577 ** we need to define the 64-bit file I/O datatypes that are compatible
578 ** with their definitions on Solaris 2.6.
580 typedef PRInt64 off64_t
;
581 typedef PRUint64 ino64_t
;
582 typedef PRInt64 blkcnt64_t
;
598 blkcnt64_t st_blocks
;
599 char st_fstype
[_ST_FSTYPSZ
];
602 typedef struct stat64 _MDStat64
;
603 typedef off64_t _MDOff64_t
;
605 #elif defined(_PR_HAVE_OFF64_T)
606 typedef struct stat64 _MDStat64
;
607 typedef off64_t _MDOff64_t
;
608 #elif defined(_PR_HAVE_LARGE_OFF_T)
609 typedef struct stat _MDStat64
;
610 typedef off_t _MDOff64_t
;
611 #elif defined(_PR_NO_LARGE_FILES)
612 typedef struct stat _MDStat64
;
613 typedef PRInt64 _MDOff64_t
;
615 #error "I don't know yet"
618 typedef PRIntn (*_MD_Fstat64
)(PRIntn osfd
, _MDStat64
*buf
);
619 typedef PRIntn (*_MD_Open64
)(const char *path
, int oflag
, ...);
621 typedef PRIntn (*_MD_Stat64
)(const char *path
, _MDStat64
*buf
, ...);
623 typedef PRIntn (*_MD_Stat64
)(const char *path
, _MDStat64
*buf
);
625 typedef _MDOff64_t (*_MD_Lseek64
)(PRIntn osfd
, _MDOff64_t
, PRIntn whence
);
626 typedef void* (*_MD_Mmap64
)(
627 void *addr
, PRSize len
, PRIntn prot
, PRIntn flags
,
628 PRIntn fildes
, _MDOff64_t offset
);
634 _MD_Fstat64 _fstat64
;
635 _MD_Lseek64 _lseek64
;
637 extern struct _MD_IOVector _md_iovector
;
639 #endif /* prunixos_h___ */