Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 25 Jan 2005 21:13:22 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: more coreutils problems Message-ID: <20050125201322.GF31117@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <41F64DCA DOT 9030006 AT byu DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41F64DCA.9030006@byu.net> User-Agent: Mutt/1.4.2i On Jan 25 06:46, Eric Blake wrote: > It looks like the lstat() call is violating POSIX - it should be checking > the path prefix, note that `file' is not a directory, and set errno to > ENOTDIR, but instead it is just setting ENOENT. I tested the following three situations on Linux and on Cygwin: lstat("file/x") with file an existing file lstat("dir/x") with dir an existing directory lstat("dir/x") with dir non-existing. On linux, the first case sets errno to ENOTDIR, the other two cases set errno to ENOENT. On Cygwin, errno is the translated Win32 error code from a call to GetFileAttributes. GetFileAttributes results in ERROR_FILE_NOT_FOUND in the second case, in ERROR_PATH_NOT_FOUND in the first and third case. So there's no chance to get a 1:1 translation into the correct POSIX errno except for testing all path components if GetFileAttributes returns ERROR_PATH_NOT_FOUND until GetFileAttributes succeeds. Implementing checking of each parent path component would slow things down incredibly. > Also, I noticed there is no setpriority() or getpriority(), but nice() is > provided in which does the same thing. It looks like > winsup/cygwin/syscalls.cc always returns 0 in nice() on success, contrary > to POSIX (it should be the new nice value, between -NZERO and NZERO-1). > Furthermore, there is no definition of NZERO in , but POSIX > requires it to be defined, and at least 20, if nice() is implemented. > Ultimately, `nice nice' should print 10, not 0. But since Windows only > provides 4 priority levels, cygwin should maintain a separate "nice value" > per process that is mapped into Windows values, something like: -20 to > - -11, -10 to -1, 0 to 9, and 10 to 19. That would make 'nice 1 nice' print > 1, but not change the process priority; but 'nice nice' would print 10 and > lower the priority. On Linux, nice(2) also only returns 0 in case of success and -1 otherwise. If somebody needs to retrieve the nice value, she's pointed to getpriority. I'm going to implement setpriority/getpriority and leave the nice(2) return codes as on Linux. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/