[patch] gcc4 fixes

2005-05-17 Thread Brian Dessent

This is just a trivial change of argument to execl() testcases, which
supresses the warning 'missing sentinel in function call' in gcc4 that
causes the tests to fail.

winsup/testsuite
2005-05-17  Brian Dessent  [EMAIL PROTECTED]

* winsup.api/signal-into-win32-api.c (main): Use 'NULL' instead
of '0' in argument list to avoid compiler warning with gcc4.
* winsup.api/ltp/execle01.c (main): Ditto.
* winsup.api/ltp/execlp01.c (main): Ditto.
* winsup.api/ltp/fcntl07.c (do_exec): Ditto.
* winsup.api/ltp/fcntl07B.c (do_exec): Ditto.

This fixes the problem of mmap() not working with gcc4.

winsup/cygwin
2005-05-17  Brian Dessent  [EMAIL PROTECTED]

* mmap.cc (mmap64): Move 'granularity' into file scope so that
it will be initialized.Index: winsup.api/signal-into-win32-api.c
===
RCS file: /cvs/src/src/winsup/testsuite/winsup.api/signal-into-win32-api.c,v
retrieving revision 1.3
diff -u -p -r1.3 signal-into-win32-api.c
--- winsup.api/signal-into-win32-api.c  23 Jan 2003 21:21:28 -  1.3
+++ winsup.api/signal-into-win32-api.c  17 May 2005 20:12:57 -
@@ -37,7 +37,7 @@ main (int argc, char** argv)
   return 2;
 }
   else if (pid == 0)
-execl ( argv[0], argv[0], child, 0 );
+execl ( argv[0], argv[0], child, (char *)NULL );
   else
 {
   sleep_stage = 0;
Index: winsup.api/ltp/execle01.c
===
RCS file: /cvs/src/src/winsup/testsuite/winsup.api/ltp/execle01.c,v
retrieving revision 1.3
diff -u -p -r1.3 execle01.c
--- winsup.api/ltp/execle01.c   24 Jan 2003 01:09:39 -  1.3
+++ winsup.api/ltp/execle01.c   17 May 2005 20:12:57 -
@@ -172,7 +172,7 @@ main(int ac, char **av)
 */
switch(pid=fork()) {
case 0: /* CHILD - Call execle(2) */
-   execle(test, test, 0, environ);
+   execle(test, test, (char *)NULL, environ);
/* should not get here!! if we do, the parent will fail the Test 
Case */
exit(errno);
case -1:/* ERROR!!! exit now!!*/
Index: winsup.api/ltp/execlp01.c
===
RCS file: /cvs/src/src/winsup/testsuite/winsup.api/ltp/execlp01.c,v
retrieving revision 1.3
diff -u -p -r1.3 execlp01.c
--- winsup.api/ltp/execlp01.c   24 Jan 2003 01:09:39 -  1.3
+++ winsup.api/ltp/execlp01.c   17 May 2005 20:12:57 -
@@ -171,7 +171,7 @@ main(int ac, char **av)
 */
switch(pid=fork()) {
case 0: /* CHILD - Call execlp(2) */
-   execlp(/usr/bin/test, /usr/bin/test, 0);
+   execlp(/usr/bin/test, /usr/bin/test, (char *)NULL);
/* should not get here!! if we do, the parent will fail the Test 
Case */
exit(errno);
case -1:/* ERROR!!! exit now!!*/
Index: winsup.api/ltp/fcntl07.c
===
RCS file: /cvs/src/src/winsup/testsuite/winsup.api/ltp/fcntl07.c,v
retrieving revision 1.3
diff -u -p -r1.3 fcntl07.c
--- winsup.api/ltp/fcntl07.c24 Jan 2003 01:09:39 -  1.3
+++ winsup.api/ltp/fcntl07.c17 May 2005 20:12:57 -
@@ -375,7 +375,7 @@ do_exec(const char *prog, int fd, const 
 case -1:
return(-1);
 case 0:/* child */
-   execlp(prog, openck, -T, pidname, 0);
+   execlp(prog, openck, -T, pidname, (char *)NULL);
 
/* the ONLY reason to do this is to get the errno printed out */
fprintf(stderr, exec(%s, %s, -T, %s) failed.  Errno %s [%d]\n,
Index: winsup.api/ltp/fcntl07B.c
===
RCS file: /cvs/src/src/winsup/testsuite/winsup.api/ltp/fcntl07B.c,v
retrieving revision 1.3
diff -u -p -r1.3 fcntl07B.c
--- winsup.api/ltp/fcntl07B.c   24 Jan 2003 01:09:39 -  1.3
+++ winsup.api/ltp/fcntl07B.c   17 May 2005 20:12:57 -
@@ -374,7 +374,7 @@ do_exec(const char *prog, int fd, const 
 case -1:
return(-1);
 case 0:/* child */
-   execlp(prog, openck, -T, pidname, 0);
+   execlp(prog, openck, -T, pidname, (char *)NULL);
 
/* the ONLY reason to do this is to get the errno printed out */
fprintf(stderr, exec(%s, %s, -T, %s) failed.  Errno %s [%d]\n,


Index: mmap.cc
===
RCS file: /cvs/src/src/winsup/cygwin/mmap.cc,v
retrieving revision 1.109
diff -u -r1.109 mmap.cc
--- mmap.cc 2 May 2005 03:50:07 -   1.109
+++ mmap.cc 17 May 2005 22:40:14 -
@@ -500,14 +500,14 @@
 }
 }
 
+static DWORD granularity = getshmlba ();
+
 extern C void *
 mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
 {
   syscall_printf (addr %x, len %u, prot %x, flags %x, fd %d, off %D,
  addr, len, prot, 

Re: [patch] gcc4 fixes

2005-05-17 Thread Brian Dessent
Christopher Faylor wrote:

 Go ahead and check these in but please use GNU formatting conventions,
 i.e., it's (char *) NULL, not (char *)NULL.  Actually, isn't just NULL
 sufficient?

I must have had C++ on the mind, thinking that the cast was necessary.

 Sorry but no.  This is a workaround.  We need to fix the actual problem.

Certainly.  I fully admit I have no real idea what the 'actual' problem
is yet.

Brian


Re: [patch] gcc4 fixes

2005-05-17 Thread Christopher Faylor
On Tue, May 17, 2005 at 06:15:08PM -0700, Brian Dessent wrote:
Christopher Faylor wrote:

 Go ahead and check these in but please use GNU formatting conventions,
 i.e., it's (char *) NULL, not (char *)NULL.  Actually, isn't just NULL
 sufficient?

I must have had C++ on the mind, thinking that the cast was necessary.

 Sorry but no.  This is a workaround.  We need to fix the actual problem.

Certainly.  I fully admit I have no real idea what the 'actual' problem
is yet.

I don't either, obviously.  Nice job tracking it down, regardless.

cgf


[patch] update documentation Was: cygwin-host-setup does not install sshd

2005-05-17 Thread Brian Dessent
admin wrote:
 
 Thanks so much that worked like a charm.
 
 umount -A to remove all mounts, and then delete the cygwin install
 directory.  Rummaging around in the registry is not recommended.
 
 
 http://www.cygwin.com/faq/faq_2.html#SEC20 ---  when removing the two 
 registry values suggested there didnt work, i just removed anything, like i 
 do when we get malware :).  I figured that would get it.
 
 It sounds like you still have a sshd service installed that is
 referencing a nonexistent path.  Type cygrunsrv -Q sshd to see if
 there is such a service, and if so cygrunsrv -R ssh and then rerun
 ssh-host-config.
 
 i did, and it was, and that worked.  Some values in the registry could not 
 be deleted  i didnt really pay attention to which, i guess one was the 
 running ssh server.

I have to admit, the documentation could be a little more clear about
the fact that you need to remove services.  I've also often read that
people encounter problems when trying to delete the Cygwin tree because
they encounter files with permissions that don't allow the file to be
deleted (e.g. files created by SYSTEM.)

I therefore propose the following rewrite of the How do I uninstall all
of Cygwin entry in the FAQ.  This version is much more wordy, I admit. 
But since it seems to come up every so often I feel a little
hand-holding in the FAQ can't hurt.  Rather than saying basically to
delete the folder and the registry key and you're on your own for the
other stuff, this gives a list of steps that should cover everything.

2005-05-17  Brian Dessent  [EMAIL PROTECTED]

* install.texinfo (How do I uninstall...): Rewrite to cover
removing services, dealing with permissions, and other common
tasks for removing Cygwin completely.Index: install.texinfo
===
RCS file: /cvs/src/src/winsup/doc/install.texinfo,v
retrieving revision 1.52
diff -u -r1.52 install.texinfo
--- install.texinfo 29 Jan 2005 22:35:17 -  1.52
+++ install.texinfo 18 May 2005 03:15:57 -
@@ -252,29 +252,60 @@
 
 @subsection How do I uninstall @strong{all} of Cygwin?
 
-Setup has no automatic uninstall facility.  Just delete everything
-manually:
+Setup has no automatic uninstall facility.  The recommended method to remove 
all 
+of Cygwin is as follows:
 
[EMAIL PROTECTED] @bullet
[EMAIL PROTECTED] Cygwin shortcuts on the Desktop and Start Menu
-
[EMAIL PROTECTED] The registry tree @samp{Software\Cygnus Solutions} under
[EMAIL PROTECTED] and/or @code{HKEY_CURRENT_USER}.
-
[EMAIL PROTECTED] Anything under the Cygwin root folder, @samp{C:\cygwin} by
-default.
[EMAIL PROTECTED]
 
[EMAIL PROTECTED] Anything created by setup in its temporary working directory.
[EMAIL PROTECTED] Remove all Cygwin services.  If a service is currently 
running, it must 
+first be stopped with @samp{cygrunsrv -E name}, where @samp{name} 
+is the name of the service.  Then use @samp{cygrunsrv -R name} to uninstall 
the 
+service from the registry.  Repeat this for all services that you installed.  
+Common services that might have been installed are @code{sshd}, @code{cron}, 
[EMAIL PROTECTED], @code{inetd}, @code{apache}, and so on.
+
[EMAIL PROTECTED] Remove all mount information with @samp{umount -A}.  If you 
want to 
+save your mount points for a later reinstall, first save the output of 
[EMAIL PROTECTED] -m} as described at 
[EMAIL PROTECTED]://cygwin.com/cygwin-ug-net/using-utils.html#mount}.
 
[EMAIL PROTECTED] itemize
[EMAIL PROTECTED] Close all Cygwin command prompts, xterms, etc. and stop the 
X11 server if 
+it is running.
 
-It's up to you to deal with other changes you made to your system, such
-as installing the inetd service, altering system paths, etc.  Setup
-would not have done any of these things for you.
[EMAIL PROTECTED] Delete the Cygwin root folder and all subfolders.  If you get 
an error 
+that an object is in use, then ensure that you've stopped all services and 
+closed all Cygwin programs.  If you get a 'Permission Denied' error then you 
+will need to modify the permissions and/or ownership of the files or folders 
+that are causing the error.  For example, sometimes files used by system 
+services end up owned by the SYSTEM account and not writable by regular users. 
 
+
+The quickest way to delete the entire tree if you run into this problem is to 
+change the ownership of all files and folders to your account.  To do this in 
+Windows Explorer, right click on the root Cygwin folder, choose Properties, 
then 
+the Security tab.  Select Advanced, then go to the Owner tab and make sure 
your 
+account is listed as the owner.  Select the 'Replace owner on subcontainers 
and 
+objects' checkbox and press Ok.  After Explorer applies the changes you should 
+be able to delete the entire tree in one operation.  Note that you can also 
+achieve this in Cygwin by typing @samp{chown -R user /} or by using other 
tools 
+such as CACLS.EXE.
+
[EMAIL