Commit 23688fa8 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Correct the API of some functions in the portability headers

Summary: They were based on the signatures of the original functions as defined by MSVC. They should be based on the signatures as defined by Posix instead.

Reviewed By: yfeldblum

Differential Revision: D4471711

fbshipit-source-id: 8a6fd60ba2b326ca57058c119fc77c46f1d21d10
parent 55e591f9
......@@ -159,7 +159,9 @@ int isatty(int fh) { return _isatty(fh); }
int lockf(int fd, int cmd, off_t len) { return _locking(fd, cmd, len); }
long lseek(int fh, long off, int orig) { return _lseek(fh, off, orig); }
off_t lseek(int fh, off_t off, int orig) {
return _lseek(fh, off, orig);
}
int rmdir(const char* path) { return _rmdir(path); }
......@@ -169,11 +171,11 @@ int pipe(int pth[2]) {
return socketpair(PF_UNIX, SOCK_STREAM, 0, pth);
}
int pread(int fd, void* buf, size_t count, off_t offset) {
ssize_t pread(int fd, void* buf, size_t count, off_t offset) {
return wrapPositional(_read, fd, offset, buf, (unsigned int)count);
}
int pwrite(int fd, const void* buf, size_t count, off_t offset) {
ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset) {
return wrapPositional(_write, fd, offset, buf, (unsigned int)count);
}
......@@ -228,8 +230,6 @@ ssize_t readlink(const char* path, char* buf, size_t buflen) {
void* sbrk(intptr_t i) { return (void*)-1; }
int setmode(int fh, int md) { return _setmode(fh, md); }
unsigned int sleep(unsigned int seconds) {
Sleep((DWORD)(seconds * 1000));
return 0;
......@@ -252,8 +252,6 @@ long sysconf(int tp) {
}
}
long tell(int fh) { return _tell(fh); }
int truncate(const char* path, off_t len) {
int fd = _open(path, O_WRONLY);
if (!fd) {
......
......@@ -68,18 +68,16 @@ pid_t getppid();
int getuid();
int isatty(int fh);
int lockf(int fd, int cmd, off_t len);
long lseek(int fh, long off, int orig);
off_t lseek(int fh, off_t off, int orig);
ssize_t read(int fh, void* buf, size_t mcc);
int rmdir(const char* path);
int pipe(int pth[2]);
int pread(int fd, void* buf, size_t count, off_t offset);
int pwrite(int fd, const void* buf, size_t count, off_t offset);
ssize_t pread(int fd, void* buf, size_t count, off_t offset);
ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset);
ssize_t readlink(const char* path, char* buf, size_t buflen);
int setmode(int fh, int md);
void* sbrk(intptr_t i);
unsigned int sleep(unsigned int seconds);
long sysconf(int tp);
long tell(int fh);
int truncate(const char* path, off_t len);
int usleep(unsigned int ms);
ssize_t write(int fh, void const* buf, size_t count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment