whitespace
This commit is contained in:
parent
66dca8bb0d
commit
6cae97d5dc
|
@ -48,8 +48,8 @@ private:
|
||||||
|
|
||||||
attach_t (class process *const client)
|
attach_t (class process *const client)
|
||||||
: _client (client),
|
: _client (client),
|
||||||
_refcnt (0),
|
_refcnt (0),
|
||||||
_next (NULL)
|
_next (NULL)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ private:
|
||||||
|
|
||||||
attach_t (class process *const client)
|
attach_t (class process *const client)
|
||||||
: _client (client),
|
: _client (client),
|
||||||
_refcnt (0),
|
_refcnt (0),
|
||||||
_next (NULL)
|
_next (NULL)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ child_info NO_COPY *child_proc_info = NULL;
|
||||||
static MEMORY_BASIC_INFORMATION NO_COPY sm;
|
static MEMORY_BASIC_INFORMATION NO_COPY sm;
|
||||||
|
|
||||||
#define CYGWIN_GUARD ((wincap.has_page_guard ()) ? \
|
#define CYGWIN_GUARD ((wincap.has_page_guard ()) ? \
|
||||||
PAGE_EXECUTE_READWRITE|PAGE_GUARD : PAGE_NOACCESS)
|
PAGE_EXECUTE_READWRITE|PAGE_GUARD : PAGE_NOACCESS)
|
||||||
|
|
||||||
// __inline__ void
|
// __inline__ void
|
||||||
extern void
|
extern void
|
||||||
|
|
|
@ -425,7 +425,7 @@ format_proc_uptime (char *destbuf, size_t maxsize)
|
||||||
{
|
{
|
||||||
idle_time = spt.IdleTime.QuadPart / 100000ULL;
|
idle_time = spt.IdleTime.QuadPart / 100000ULL;
|
||||||
uptime = (spt.KernelTime.QuadPart +
|
uptime = (spt.KernelTime.QuadPart +
|
||||||
spt.UserTime.QuadPart) / 100000ULL;
|
spt.UserTime.QuadPart) / 100000ULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return __small_sprintf (destbuf, "%U.%02u %U.%02u\n",
|
return __small_sprintf (destbuf, "%U.%02u %U.%02u\n",
|
||||||
|
|
|
@ -48,7 +48,7 @@ fhandler_dev_random* entropy_source;
|
||||||
/* cygwin internal: map sockaddr into internet domain address */
|
/* cygwin internal: map sockaddr into internet domain address */
|
||||||
static int
|
static int
|
||||||
get_inet_addr (const struct sockaddr *in, int inlen,
|
get_inet_addr (const struct sockaddr *in, int inlen,
|
||||||
struct sockaddr_in *out, int *outlen, int* secret = 0)
|
struct sockaddr_in *out, int *outlen, int* secret = 0)
|
||||||
{
|
{
|
||||||
int secret_buf [4];
|
int secret_buf [4];
|
||||||
int* secret_ptr = (secret ? : secret_buf);
|
int* secret_ptr = (secret ? : secret_buf);
|
||||||
|
@ -63,24 +63,24 @@ get_inet_addr (const struct sockaddr *in, int inlen,
|
||||||
{
|
{
|
||||||
int fd = _open (in->sa_data, O_RDONLY);
|
int fd = _open (in->sa_data, O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
memset (buf, 0, sizeof buf);
|
memset (buf, 0, sizeof buf);
|
||||||
if (read (fd, buf, sizeof buf) != -1)
|
if (read (fd, buf, sizeof buf) != -1)
|
||||||
{
|
{
|
||||||
sockaddr_in sin;
|
sockaddr_in sin;
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sscanf (buf + strlen (SOCKET_COOKIE), "%hu %08x-%08x-%08x-%08x",
|
sscanf (buf + strlen (SOCKET_COOKIE), "%hu %08x-%08x-%08x-%08x",
|
||||||
&sin.sin_port,
|
&sin.sin_port,
|
||||||
secret_ptr, secret_ptr + 1, secret_ptr + 2, secret_ptr + 3);
|
secret_ptr, secret_ptr + 1, secret_ptr + 2, secret_ptr + 3);
|
||||||
sin.sin_port = htons (sin.sin_port);
|
sin.sin_port = htons (sin.sin_port);
|
||||||
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||||
*out = sin;
|
*out = sin;
|
||||||
*outlen = sizeof sin;
|
*outlen = sizeof sin;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
_close (fd);
|
_close (fd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -507,12 +507,12 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
|
||||||
ev[0] = WSACreateEvent ();
|
ev[0] = WSACreateEvent ();
|
||||||
|
|
||||||
if (ev[0] != WSA_INVALID_EVENT &&
|
if (ev[0] != WSA_INVALID_EVENT &&
|
||||||
!WSAEventSelect (get_socket (), ev[0], FD_ACCEPT))
|
!WSAEventSelect (get_socket (), ev[0], FD_ACCEPT))
|
||||||
{
|
{
|
||||||
WSANETWORKEVENTS sock_event;
|
WSANETWORKEVENTS sock_event;
|
||||||
int wait_result;
|
int wait_result;
|
||||||
|
|
||||||
wait_result = WSAWaitForMultipleEvents (2, ev, FALSE, WSA_INFINITE,
|
wait_result = WSAWaitForMultipleEvents (2, ev, FALSE, WSA_INFINITE,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (wait_result == WSA_WAIT_EVENT_0)
|
if (wait_result == WSA_WAIT_EVENT_0)
|
||||||
WSAEnumNetworkEvents (get_socket (), ev[0], &sock_event);
|
WSAEnumNetworkEvents (get_socket (), ev[0], &sock_event);
|
||||||
|
|
|
@ -178,12 +178,12 @@ read_etc_group ()
|
||||||
DWORD siz;
|
DWORD siz;
|
||||||
|
|
||||||
if (OpenProcessToken (hMainProc, TOKEN_QUERY, &ptok))
|
if (OpenProcessToken (hMainProc, TOKEN_QUERY, &ptok))
|
||||||
{
|
{
|
||||||
if (GetTokenInformation (ptok, TokenPrimaryGroup, &tg,
|
if (GetTokenInformation (ptok, TokenPrimaryGroup, &tg,
|
||||||
sizeof tg, &siz)
|
sizeof tg, &siz)
|
||||||
&& LookupAccountSidA (NULL, tg, group_name,
|
&& LookupAccountSidA (NULL, tg, group_name,
|
||||||
&group_name_len, domain_name,
|
&group_name_len, domain_name,
|
||||||
&domain_name_len, &acType))
|
&domain_name_len, &acType))
|
||||||
{
|
{
|
||||||
char strbuf[100];
|
char strbuf[100];
|
||||||
snprintf (linebuf, sizeof (linebuf), "%s:%s:%lu:",
|
snprintf (linebuf, sizeof (linebuf), "%s:%s:%lu:",
|
||||||
|
|
|
@ -169,9 +169,9 @@ read_etc_passwd ()
|
||||||
DWORD siz;
|
DWORD siz;
|
||||||
|
|
||||||
if (OpenProcessToken (hMainProc, TOKEN_QUERY, &ptok))
|
if (OpenProcessToken (hMainProc, TOKEN_QUERY, &ptok))
|
||||||
{
|
{
|
||||||
if (GetTokenInformation (ptok, TokenUser, &tu, sizeof tu,
|
if (GetTokenInformation (ptok, TokenUser, &tu, sizeof tu,
|
||||||
&siz)
|
&siz)
|
||||||
&& GetTokenInformation (ptok, TokenPrimaryGroup, &tg,
|
&& GetTokenInformation (ptok, TokenPrimaryGroup, &tg,
|
||||||
sizeof tg, &siz))
|
sizeof tg, &siz))
|
||||||
{
|
{
|
||||||
|
@ -180,16 +180,16 @@ read_etc_passwd ()
|
||||||
"%s::%lu:%lu:%s:%s:/bin/sh",
|
"%s::%lu:%lu:%s:%s:/bin/sh",
|
||||||
cygheap->user.name (),
|
cygheap->user.name (),
|
||||||
*GetSidSubAuthority (tu,
|
*GetSidSubAuthority (tu,
|
||||||
*GetSidSubAuthorityCount(tu) - 1),
|
*GetSidSubAuthorityCount(tu) - 1),
|
||||||
*GetSidSubAuthority (tg,
|
*GetSidSubAuthority (tg,
|
||||||
*GetSidSubAuthorityCount(tg) - 1),
|
*GetSidSubAuthorityCount(tg) - 1),
|
||||||
tu.string (strbuf), getenv ("HOME") ?: "/");
|
tu.string (strbuf), getenv ("HOME") ?: "/");
|
||||||
debug_printf ("Emulating /etc/passwd: %s", linebuf);
|
debug_printf ("Emulating /etc/passwd: %s", linebuf);
|
||||||
add_pwd_line (linebuf);
|
add_pwd_line (linebuf);
|
||||||
passwd_state = emulated;
|
passwd_state = emulated;
|
||||||
}
|
}
|
||||||
CloseHandle (ptok);
|
CloseHandle (ptok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (passwd_state != emulated)
|
if (passwd_state != emulated)
|
||||||
{
|
{
|
||||||
|
|
|
@ -338,17 +338,17 @@ set_bits (select_record *me, fd_set *readfds, fd_set *writefds,
|
||||||
{
|
{
|
||||||
UNIX_FD_SET (me->fd, writefds);
|
UNIX_FD_SET (me->fd, writefds);
|
||||||
if (me->except_on_write && me->fh->get_device () == FH_SOCKET)
|
if (me->except_on_write && me->fh->get_device () == FH_SOCKET)
|
||||||
((fhandler_socket *) me->fh)->set_connect_state (CONNECTED);
|
((fhandler_socket *) me->fh)->set_connect_state (CONNECTED);
|
||||||
ready++;
|
ready++;
|
||||||
}
|
}
|
||||||
if ((me->except_selected || me->except_on_write) && me->except_ready)
|
if ((me->except_selected || me->except_on_write) && me->except_ready)
|
||||||
{
|
{
|
||||||
if (me->except_on_write) /* Only on sockets */
|
if (me->except_on_write) /* Only on sockets */
|
||||||
{
|
{
|
||||||
UNIX_FD_SET (me->fd, writefds);
|
UNIX_FD_SET (me->fd, writefds);
|
||||||
if (me->fh->get_device () == FH_SOCKET)
|
if (me->fh->get_device () == FH_SOCKET)
|
||||||
((fhandler_socket *) me->fh)->set_connect_state (CONNECTED);
|
((fhandler_socket *) me->fh)->set_connect_state (CONNECTED);
|
||||||
}
|
}
|
||||||
if (me->except_selected)
|
if (me->except_selected)
|
||||||
UNIX_FD_SET (me->fd, exceptfds);
|
UNIX_FD_SET (me->fd, exceptfds);
|
||||||
ready++;
|
ready++;
|
||||||
|
|
|
@ -218,11 +218,11 @@ tty_list::allocate_tty (int with_console)
|
||||||
__small_sprintf (buf, "cygwin.find.console.%d", myself->pid);
|
__small_sprintf (buf, "cygwin.find.console.%d", myself->pid);
|
||||||
SetConsoleTitle (buf);
|
SetConsoleTitle (buf);
|
||||||
for (int times = 0; times < 25; times++)
|
for (int times = 0; times < 25; times++)
|
||||||
{
|
{
|
||||||
Sleep (10);
|
Sleep (10);
|
||||||
if ((console = FindWindow (NULL, buf)))
|
if ((console = FindWindow (NULL, buf)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetConsoleTitle (oldtitle);
|
SetConsoleTitle (oldtitle);
|
||||||
Sleep (40);
|
Sleep (40);
|
||||||
ReleaseMutex (title_mutex);
|
ReleaseMutex (title_mutex);
|
||||||
|
|
Loading…
Reference in New Issue