Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-21 05:00:58 +0400
committerChristopher Faylor <me@cgf.cx>2002-10-21 05:00:58 +0400
commit5ec14fe40ae1a6b11d27b975feca1b20de435467 (patch)
tree568cd69f0dca513973fc6e6646fe6ea4b3b9dafe /winsup/cygwin/syscalls.cc
parentccefaab1d5735466b54f8c5dd279a310d6020a77 (diff)
Change _function() to function() throughout.
* cygwin.din: Remove last vestiges (?) of newlib wrappers. * cygthread.cc (cygthread::detach): Always wait for event or suffer an apparently inavoidable race. * dcrt0.cc (dll_crt0_1): Allocate threads after stack has been relocated. * debub.cc (lock_debug): Don't acquire lock on exit. * fork.cc (fork_child): Recreate mmaps before doing anything else since Windows has a habit of using blocks of memory in the child that could previously have been occupied by shared memory in the parent. * mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here and provide some details about what went wrong. (fixup_mmaps_after_fork): Remove error message. * shared.cc (open_shared): Move warning message so that more detail is possible. * sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a race. (sigproc_terminate): Specifically wait for process thread to terminate.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc56
1 files changed, 41 insertions, 15 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 305443f4c..fd571ebd9 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -8,6 +8,12 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#define _close __FOO_close__
+#define _lseek __FOO_lseek__
+#define _open __FOO_open__
+#define _read __FOO_read__
+#define _write __FOO_write__
+
#include "winsup.h"
#include <sys/stat.h>
#include <sys/vfs.h> /* needed for statfs */
@@ -40,6 +46,12 @@ details. */
#include <setjmp.h>
#include "perthread.h"
+#undef _close
+#undef _lseek
+#undef _open
+#undef _read
+#undef _write
+
SYSTEM_INFO system_info;
/* Close all files and process any queued deletions.
@@ -94,7 +106,7 @@ dup2 (int oldfd, int newfd)
}
extern "C" int
-_unlink (const char *ourname)
+unlink (const char *ourname)
{
int res = -1;
DWORD devn;
@@ -248,7 +260,7 @@ remove (const char *ourname)
return -1;
}
- return win32_name.isdir () ? rmdir (ourname) : _unlink (ourname);
+ return win32_name.isdir () ? rmdir (ourname) : unlink (ourname);
}
extern "C" pid_t
@@ -325,7 +337,7 @@ getsid (pid_t pid)
}
extern "C" ssize_t
-_read (int fd, void *ptr, size_t len)
+read (int fd, void *ptr, size_t len)
{
const struct iovec iov =
{
@@ -336,8 +348,11 @@ _read (int fd, void *ptr, size_t len)
return readv (fd, &iov, 1);
}
+extern "C" ssize_t _read (int, void *, size_t)
+ __attribute__ ((alias ("read")));
+
extern "C" ssize_t
-_write (int fd, const void *ptr, size_t len)
+write (int fd, const void *ptr, size_t len)
{
const struct iovec iov =
{
@@ -348,6 +363,9 @@ _write (int fd, const void *ptr, size_t len)
return writev (fd, &iov, 1);
}
+extern "C" ssize_t _write (int fd, const void *ptr, size_t len)
+ __attribute__ ((alias ("write")));
+
extern "C" ssize_t
readv (int fd, const struct iovec *const iov, const int iovcnt)
{
@@ -487,7 +505,7 @@ done:
/* newlib's fcntl.h defines _open as taking variable args so we must
correspond. The third arg if it exists is: mode_t mode. */
extern "C" int
-_open (const char *unix_path, int flags, ...)
+open (const char *unix_path, int flags, ...)
{
int res = -1;
va_list ap;
@@ -525,6 +543,9 @@ _open (const char *unix_path, int flags, ...)
return res;
}
+extern "C" int _open (const char *, int flags, ...)
+ __attribute__ ((alias ("open")));
+
extern "C" __off64_t
lseek64 (int fd, __off64_t pos, int dir)
{
@@ -550,13 +571,16 @@ lseek64 (int fd, __off64_t pos, int dir)
}
extern "C" __off32_t
-_lseek (int fd, __off32_t pos, int dir)
+lseek (int fd, __off32_t pos, int dir)
{
return lseek64 (fd, (__off64_t) pos, dir);
}
+extern "C" __off32_t _lseek (int, __off32_t, int)
+ __attribute__ ((alias ("lseek")));
+
extern "C" int
-_close (int fd)
+close (int fd)
{
int res;
sigframe thisframe (mainthread);
@@ -578,6 +602,8 @@ _close (int fd)
return res;
}
+extern "C" int _close (int) __attribute__ ((alias ("close")));
+
extern "C" int
isatty (int fd)
{
@@ -601,7 +627,7 @@ isatty (int fd)
*/
extern "C" int
-_link (const char *a, const char *b)
+link (const char *a, const char *b)
{
int res = -1;
sigframe thisframe (mainthread);
@@ -1231,7 +1257,7 @@ done:
}
extern "C" int
-_rename (const char *oldpath, const char *newpath)
+rename (const char *oldpath, const char *newpath)
{
sigframe thisframe (mainthread);
int res = 0;
@@ -2490,16 +2516,16 @@ setutent ()
sigframe thisframe (mainthread);
if (utmp_fd == -2)
{
- utmp_fd = _open (utmp_file, O_RDONLY);
+ utmp_fd = open (utmp_file, O_RDONLY);
}
- _lseek (utmp_fd, 0, SEEK_SET);
+ lseek (utmp_fd, 0, SEEK_SET);
}
extern "C" void
endutent ()
{
sigframe thisframe (mainthread);
- _close (utmp_fd);
+ close (utmp_fd);
utmp_fd = -2;
}
@@ -2522,7 +2548,7 @@ getutent ()
sigframe thisframe (mainthread);
if (utmp_fd == -2)
setutent ();
- if (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) != sizeof (utmp_data))
+ if (read (utmp_fd, &utmp_data, sizeof (utmp_data)) != sizeof (utmp_data))
return NULL;
return &utmp_data;
}
@@ -2533,7 +2559,7 @@ getutid (struct utmp *id)
sigframe thisframe (mainthread);
if (check_null_invalid_struct_errno (id))
return NULL;
- while (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data))
+ while (read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data))
{
switch (id->ut_type)
{
@@ -2566,7 +2592,7 @@ getutline (struct utmp *line)
sigframe thisframe (mainthread);
if (check_null_invalid_struct_errno (line))
return NULL;
- while (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data))
+ while (read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data))
{
if ((utmp_data.ut_type == LOGIN_PROCESS ||
utmp_data.ut_type == USER_PROCESS) &&