extern void __gnat_set_exit_status (int);
extern int __gnat_expect_fork (void);
-extern void __gnat_expect_portable_execvp (char *, char *[]);
+extern void __gnat_expect_portable_execvp (int *, char *, char *[]);
extern int __gnat_pipe (int *);
-extern int __gnat_expect_poll (int *, int, int, int *);
+extern int __gnat_expect_poll (int *, int, int, int *,
+ int *);
extern void __gnat_set_binary_mode (int);
extern void __gnat_set_text_mode (int);
extern void __gnat_set_mode (int,int);
#include <process.h>
#include <signal.h>
#include <io.h>
+#include "adaint.h"
#include "mingw32.h"
int
{
HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
DWORD exitcode = 1;
- DWORD res;
if (h != NULL)
{
- res = WaitForSingleObject (h, INFINITE);
+ (void) WaitForSingleObject (h, INFINITE);
GetExitCodeProcess (h, &exitcode);
CloseHandle (h);
}
}
void
-__gnat_expect_portable_execvp (int *pid, char *cmd, char *argv[])
+__gnat_expect_portable_execvp (int *pid, char *cmd ATTRIBUTE_UNUSED,
+ char *argv[])
{
*pid = __gnat_portable_no_block_spawn (argv);
}
/* Define __gnat_personality_v0 for convenience */
-PERSONALITY_STORAGE _Unwind_Reason_Code
+PERSONALITY_STORAGE ATTRIBUTE_UNUSED _Unwind_Reason_Code
__gnat_personality_v0 (version_arg_t version_arg,
phases_arg_t phases_arg,
_Unwind_Exception_Class uw_exception_class,
}
#else
int
-__gnat_gethostbyname (const char *name,
- struct hostent *ret, char *buf, size_t buflen,
+__gnat_gethostbyname (const char *name, struct hostent *ret,
+ char *buf ATTRIBUTE_UNUSED, size_t buflen ATTRIBUTE_UNUSED,
int *h_errnop)
{
struct hostent *rh;
}
int
-__gnat_gethostbyaddr (const char *addr, int len, int type,
- struct hostent *ret, char *buf, size_t buflen,
+__gnat_gethostbyaddr (const char *addr, int len, int type, struct hostent *ret,
+ char *buf ATTRIBUTE_UNUSED, size_t buflen ATTRIBUTE_UNUSED,
int *h_errnop)
{
struct hostent *rh;
}
int
-__gnat_getservbyname (const char *name, const char *proto,
- struct servent *ret, char *buf, size_t buflen)
+__gnat_getservbyname (const char *name, const char *proto, struct servent *ret,
+ char *buf ATTRIBUTE_UNUSED, size_t buflen ATTRIBUTE_UNUSED)
{
struct servent *rh;
rh = getservbyname (name, proto);
}
int
-__gnat_getservbyport (int port, const char *proto,
- struct servent *ret, char *buf, size_t buflen)
+__gnat_getservbyport (int port, const char *proto, struct servent *ret,
+ char *buf ATTRIBUTE_UNUSED, size_t buflen ATTRIBUTE_UNUSED)
{
struct servent *rh;
rh = getservbyport (port, proto);
void
__gnat_last_socket_in_set (fd_set *set, int *last)
{
- int s;
int l;
l = -1;
#ifdef _WIN32
/* More efficient method for NT. */
- for (s = 0; s < set->fd_count; s++)
+ for (unsigned int s = 0; s < set->fd_count; s++)
if ((int) set->fd_array[s] > l)
l = set->fd_array[s];
#else
- for (s = *last; s != -1; s--)
+ for (int s = *last; s != -1; s--)
if (FD_ISSET (s, set))
{
l = s;
int
__gnat_socket_ioctl (int fd, IOCTL_Req_T req, int *arg) {
#if defined (_WIN32)
- return ioctlsocket (fd, req, arg);
+ return ioctlsocket (fd, req, (unsigned long *)arg);
#elif defined (__APPLE__)
/*
* On Darwin, req is an unsigned long, and we want to convert without sign
int rc;
ss.ss_family = af;
- rc = WSAStringToAddressA (src, af, NULL, (struct sockaddr *)&ss, &sslen);
+ rc = WSAStringToAddressA ((char *)src, af, NULL, (struct sockaddr *)&ss,
+ &sslen);
if (rc == 0) {
switch (af) {
case AF_INET:
to get timezone settings that depend on the year. We cannot use them as
we still support Windows XP and Windows 2003. */
- status = (tzi_status >= 0 && tzi_status <= 2)
+ status = tzi_status <= 2
&& FileTimeToSystemTime (&utc_time.ft_time, &utc_sys_time)
&& SystemTimeToTzSpecificLocalTime (&tzi, &utc_sys_time, &local_sys_time)
&& SystemTimeToFileTime (&local_sys_time, &local_time.ft_time);
#include <windows.h>
#include <winternl.h>
+#include <io.h>
#define MAXPATHLEN 1024
{
HANDLE hImage;
- DWORD bytes;
- DWORD iSection;
- DWORD SectionOffset;
DWORD CoffHeaderOffset;
DWORD MoreDosHeader[16];
CHAR *file;
IMAGE_DOS_HEADER image_dos_header;
IMAGE_FILE_HEADER image_file_header;
IMAGE_OPTIONAL_HEADER image_optional_header;
- IMAGE_SECTION_HEADER image_section_header;
/*
* Open the reference file.
*/
CoffHeaderOffset = AbsoluteSeek(hImage, image_dos_header.e_lfanew) +
sizeof(ULONG);
- if (CoffHeaderOffset < 0) {
+ if (CoffHeaderOffset == (DWORD) -1) {
CloseHandle (hImage);
return -1;
}
return -1;
}
- SectionOffset = CoffHeaderOffset + IMAGE_SIZEOF_FILE_HEADER +
- IMAGE_SIZEOF_NT_OPTIONAL_HEADER;
-
ReadBytes(hImage, &image_file_header, IMAGE_SIZEOF_FILE_HEADER);
/*
}
static int
-nt_spawnve (char *exe, char **argv, char *env, struct TTY_Process *process)
+nt_spawnve (char *exe ATTRIBUTE_UNUSED, char **argv, char *env,
+ struct TTY_Process *process)
{
STARTUPINFO start;
SECURITY_ATTRIBUTES sec_attrs;
SECURITY_DESCRIPTOR sec_desc;
DWORD flags;
- char dir[ MAXPATHLEN ];
int pid;
int is_gui, use_cmd;
char *cmdline, *parg, **targ;
int do_quoting = 0;
- char escape_char;
+ char escape_char = 0;
int arglen;
/* we have to do some conjuring here to put argv and envp into the
if (need_quotes)
{
int escape_char_run = 0;
- char * first;
- char * last;
p = *targ;
- first = p;
- last = p + strlen (p) - 1;
*parg++ = '"';
for ( ; *p; p++)
{
flags, env, NULL, &start, &process->procinfo))
goto EH_Fail;
- pid = (int) process->procinfo.hProcess;
- process->pid=pid;
+ pid = (int) (intptr_t) process->procinfo.hProcess;
+ process->pid = pid;
return pid;
int Use_Pipes)
{
int cpid;
- HANDLE parent;
SECURITY_ATTRIBUTES sec_attrs;
char slavePath [MAX_PATH];
char **nargv;
char pipeNameIn[100];
HANDLE hSlaveInDrv = NULL; /* Handle to communicate with slave driver */
- parent = GetCurrentProcess ();
-
/* Set inheritance for the pipe handles */
sec_attrs.nLength = sizeof (SECURITY_ATTRIBUTES);
sec_attrs.bInheritHandle = TRUE;
/* We create a named pipe for Input, as we handle input by sending special
commands to the explaunch process, that uses it to feed the actual input
of the process */
- sprintf(pipeNameIn, "%sIn%08x_%08x", EXP_PIPE_BASENAME,
+ sprintf(pipeNameIn, "%sIn%08lx_%08x", EXP_PIPE_BASENAME,
GetCurrentProcessId(), pipeNameId);
pipeNameId++;
int* err,
int* pid)
{
- *in = _open_osfhandle ((long) process->w_infd, 0);
- *out = _open_osfhandle ((long) process->w_outfd, 0);
+ *in = _open_osfhandle ((intptr_t) process->w_infd, 0);
+ *out = _open_osfhandle ((intptr_t) process->w_outfd, 0);
/* child's stderr is always redirected to outfd */
*err = *out;
*pid = process->pid;
os_subtype = OS_NT;
}
-static BOOL CALLBACK
-find_child_console (HWND hwnd, child_process * cp)
+static WINBOOL CALLBACK
+find_child_console (HWND hwnd, LPARAM param)
{
- DWORD thread_id;
+ child_process *cp = (child_process *) param;
DWORD process_id;
- thread_id = GetWindowThreadProcessId (hwnd, &process_id);
+ (void) GetWindowThreadProcessId (hwnd, &process_id);
if (process_id == cp->procinfo->dwProcessId)
{
char window_class[32];
return TRUE;
}
-int
-__gnat_interrupt_process (struct TTY_Process* p)
-{
- char buf[2];
- DWORD written;
- BOOL bret;
-
- if (p->usePipe == TRUE) {
- bret = FALSE;
- } else {
- buf[0] = EXP_SLAVE_KILL;
- buf[1] = EXP_KILL_CTRL_C;
- bret = WriteFile (p->w_infd, buf, 2, &written, NULL);
- }
-
- if (bret == FALSE) {
- return __gnat_interrupt_pid (p->procinfo.dwProcessId);
- }
- return 0;
-}
-
int
__gnat_interrupt_pid (int pid)
{
return rc;
}
+int
+__gnat_interrupt_process (struct TTY_Process* p)
+{
+ char buf[2];
+ DWORD written;
+ BOOL bret;
+
+ if (p->usePipe == TRUE) {
+ bret = FALSE;
+ } else {
+ buf[0] = EXP_SLAVE_KILL;
+ buf[1] = EXP_KILL_CTRL_C;
+ bret = WriteFile (p->w_infd, buf, 2, &written, NULL);
+ }
+
+ if (bret == FALSE) {
+ return __gnat_interrupt_pid (p->procinfo.dwProcessId);
+ }
+ return 0;
+}
+
/* kill a process, as this implementation use CreateProcess on Win32 we need
to use Win32 TerminateProcess API */
int
HANDLE hwnd;
} pid_struct;
-static BOOL CALLBACK
-find_process_handle (HWND hwnd, pid_struct * ps)
+static WINBOOL CALLBACK
+find_process_handle (HWND hwnd, LPARAM param)
{
- DWORD thread_id;
+ pid_struct *ps = (pid_struct *) param;
DWORD process_id;
- thread_id = GetWindowThreadProcessId (hwnd, &process_id);
+ (void) GetWindowThreadProcessId (hwnd, &process_id);
if (process_id == ps->dwProcessId)
{
ps->hwnd = hwnd;
}
void
-__gnat_reset_tty (TTY_Handle* t)
+__gnat_reset_tty (TTY_Handle* t ATTRIBUTE_UNUSED)
{
- return;
}
void
}
void
-__gnat_setup_winsize (void *desc, int rows, int columns)
+__gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
+ int rows ATTRIBUTE_UNUSED, int columns ATTRIBUTE_UNUSED)
{
}