(mode_t, off_t): New.
(posix_mkdir, posix_bind, posix_setsockopt, posix_lseek, posix_read) (posix_write): Fix prototypes to conform to POSIX.
This commit is contained in:
parent
95bdfebe78
commit
318f4b10f3
4 changed files with 19 additions and 16 deletions
|
@ -37,7 +37,7 @@
|
||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
posix_mkdir(const char *dirname, int perm)
|
posix_mkdir(const char *dirname, mode_t perm)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ posix_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
*/
|
*/
|
||||||
#undef bind
|
#undef bind
|
||||||
int
|
int
|
||||||
posix_bind(int fd, const struct sockaddr *name, int namelen)
|
posix_bind(int fd, const struct sockaddr *name, socklen_t namelen)
|
||||||
{
|
{
|
||||||
SOCKET_FUNCTION(bind(handle, name, namelen))
|
SOCKET_FUNCTION(bind(handle, name, namelen))
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ posix_listen(int fd, int backlog)
|
||||||
#undef setsockopt
|
#undef setsockopt
|
||||||
int
|
int
|
||||||
posix_setsockopt(int fd, int level, int optname,
|
posix_setsockopt(int fd, int level, int optname,
|
||||||
const void *optval, int optlen)
|
const void *optval, socklen_t optlen)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* SO_REUSEADDR requests from tcp_listen.c
|
* SO_REUSEADDR requests from tcp_listen.c
|
||||||
|
@ -388,8 +388,8 @@ posix_fstat(int fd, struct stat *buffer)
|
||||||
/*
|
/*
|
||||||
* POSIX equivalent for lseek().
|
* POSIX equivalent for lseek().
|
||||||
*/
|
*/
|
||||||
int
|
off_t
|
||||||
posix_lseek(int fd, long offset, int origin)
|
posix_lseek(int fd, off_t offset, int origin)
|
||||||
{
|
{
|
||||||
FILE_FUNCTION(FDMAP_IO_FILE, _lseek(handle, offset, origin))
|
FILE_FUNCTION(FDMAP_IO_FILE, _lseek(handle, offset, origin))
|
||||||
}
|
}
|
||||||
|
@ -454,8 +454,8 @@ posix_open(const char *fname, int oflag, ...)
|
||||||
/*
|
/*
|
||||||
* POSIX equivalent for read().
|
* POSIX equivalent for read().
|
||||||
*/
|
*/
|
||||||
int
|
ssize_t
|
||||||
posix_read(int fd, void *buffer, unsigned int count)
|
posix_read(int fd, void *buffer, size_t count)
|
||||||
{
|
{
|
||||||
SHARED_FUNCTION(recv(handle, buffer, count, 0),
|
SHARED_FUNCTION(recv(handle, buffer, count, 0),
|
||||||
_read(handle, buffer, count))
|
_read(handle, buffer, count))
|
||||||
|
@ -509,8 +509,8 @@ readv(int fd, const struct iovec *iov, int iovcnt)
|
||||||
/*
|
/*
|
||||||
* POSIX equivalent for write().
|
* POSIX equivalent for write().
|
||||||
*/
|
*/
|
||||||
int
|
ssize_t
|
||||||
posix_write(int fd, const void *buffer, unsigned int count)
|
posix_write(int fd, const void *buffer, size_t count)
|
||||||
{
|
{
|
||||||
SHARED_FUNCTION(send(handle, buffer, count, 0),
|
SHARED_FUNCTION(send(handle, buffer, count, 0),
|
||||||
_write(handle, buffer, count))
|
_write(handle, buffer, count))
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include "sys/socket.h"
|
#include "sys/socket.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include "w32misc.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getopt.c
|
* getopt.c
|
||||||
|
@ -53,7 +54,7 @@ extern int optind, opterr, optopt;
|
||||||
*/
|
*/
|
||||||
#define mkdir(dir, perm) posix_mkdir((dir), (perm))
|
#define mkdir(dir, perm) posix_mkdir((dir), (perm))
|
||||||
|
|
||||||
extern int posix_mkdir(const char *dirname, int perm);
|
extern int posix_mkdir(const char *dirname, mode_t perm);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* posixio.c
|
* posixio.c
|
||||||
|
@ -130,19 +131,19 @@ struct flock
|
||||||
extern int posix_fd2socket(int fd);
|
extern int posix_fd2socket(int fd);
|
||||||
|
|
||||||
extern int posix_accept(int fd, struct sockaddr *addr, socklen_t *addrlen);
|
extern int posix_accept(int fd, struct sockaddr *addr, socklen_t *addrlen);
|
||||||
extern int posix_bind(int fd, const struct sockaddr *name, int namelen);
|
extern int posix_bind(int fd, const struct sockaddr *name, socklen_t namelen);
|
||||||
extern int posix_listen(int fd, int backlog);
|
extern int posix_listen(int fd, int backlog);
|
||||||
extern int posix_setsockopt(int fd, int level, int optname,
|
extern int posix_setsockopt(int fd, int level, int optname,
|
||||||
const void *optval, int optlen);
|
const void *optval, socklen_t optlen);
|
||||||
extern int posix_shutdown(int fd, int how);
|
extern int posix_shutdown(int fd, int how);
|
||||||
extern int posix_socket(int domain, int type, int protocol);
|
extern int posix_socket(int domain, int type, int protocol);
|
||||||
|
|
||||||
extern int posix_close(int fd);
|
extern int posix_close(int fd);
|
||||||
extern int posix_fstat(int fd, struct stat *buffer);
|
extern int posix_fstat(int fd, struct stat *buffer);
|
||||||
extern int posix_lseek(int fd, long offset, int origin);
|
extern off_t posix_lseek(int fd, off_t offset, int origin);
|
||||||
extern int posix_open(const char *fname, int oflag, ...);
|
extern int posix_open(const char *fname, int oflag, ...);
|
||||||
extern int posix_read(int fd, void *buffer, unsigned int count);
|
extern ssize_t posix_read(int fd, void *buffer, size_t count);
|
||||||
extern int posix_write(int fd, const void *buffer, unsigned int count);
|
extern ssize_t posix_write(int fd, const void *buffer, size_t count);
|
||||||
|
|
||||||
extern int posix_fileno(FILE *stream);
|
extern int posix_fileno(FILE *stream);
|
||||||
extern int posix_fsync(int fd);
|
extern int posix_fsync(int fd);
|
||||||
|
|
|
@ -52,8 +52,10 @@
|
||||||
#define srandom srand
|
#define srandom srand
|
||||||
|
|
||||||
/* sys/types.h */
|
/* sys/types.h */
|
||||||
typedef long ssize_t;
|
typedef int mode_t;
|
||||||
|
typedef long off_t;
|
||||||
typedef int pid_t;
|
typedef int pid_t;
|
||||||
|
typedef long ssize_t;
|
||||||
|
|
||||||
/* time.h */
|
/* time.h */
|
||||||
struct tm;
|
struct tm;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue