svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Poul-Henning Kamp
Author: phk
Date: Wed Feb 17 09:11:21 2010
New Revision: 203990
URL: http://svn.freebsd.org/changeset/base/203990

Log:
  Mention EISDIR as a possible errno.

Modified:
  head/lib/libc/sys/unlink.2

Modified: head/lib/libc/sys/unlink.2
==
--- head/lib/libc/sys/unlink.2  Wed Feb 17 09:09:12 2010(r203989)
+++ head/lib/libc/sys/unlink.2  Wed Feb 17 09:11:21 2010(r203990)
@@ -114,6 +114,8 @@ succeeds unless:
 .Bl -tag -width Er
 .It Bq Er ENOTDIR
 A component of the path prefix is not a directory.
+.It Bq Er EISDIR
+The named file is a directory.
 .It Bq Er ENAMETOOLONG
 A component of a pathname exceeded 255 characters,
 or an entire path name exceeded 1023 characters.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204003 - head/sys/netinet/ipfw

2010-02-17 Thread Luigi Rizzo
Author: luigi
Date: Wed Feb 17 13:06:06 2010
New Revision: 204003
URL: http://svn.freebsd.org/changeset/base/204003

Log:
  remove recursive lock/unlock calls, we do them already before entering
  the switch.
  
  Reported by: Marta Carbone

Modified:
  head/sys/netinet/ipfw/ip_fw_sockopt.c

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==
--- head/sys/netinet/ipfw/ip_fw_sockopt.c   Wed Feb 17 11:19:21 2010
(r204002)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c   Wed Feb 17 13:06:06 2010
(r204003)
@@ -343,27 +343,22 @@ del_entry(struct ip_fw_chain *chain, u_i
break;
 
case 2: /* move rules with given number to new set */
-   IPFW_UH_WLOCK(chain);
for (i = 0; i < chain->n_rules; i++) {
rule = chain->map[i];
if (rule->rulenum == rulenum)
rule->set = new_set;
}
-   IPFW_UH_WUNLOCK(chain);
break;
 
case 3: /* move rules with given set number to new set */
-   IPFW_UH_WLOCK(chain);
for (i = 0; i < chain->n_rules; i++) {
rule = chain->map[i];
if (rule->set == rulenum)
rule->set = new_set;
}
-   IPFW_UH_WUNLOCK(chain);
break;
 
case 4: /* swap two sets */
-   IPFW_UH_WLOCK(chain);
for (i = 0; i < chain->n_rules; i++) {
rule = chain->map[i];
if (rule->set == rulenum)
@@ -371,7 +366,6 @@ del_entry(struct ip_fw_chain *chain, u_i
else if (rule->set == new_set)
rule->set = rulenum;
}
-   IPFW_UH_WUNLOCK(chain);
break;
}
rule = chain->reap;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204008 - head/lib/libjail

2010-02-17 Thread Ruslan Ermilov
Author: ru
Date: Wed Feb 17 16:45:03 2010
New Revision: 204008
URL: http://svn.freebsd.org/changeset/base/204008

Log:
  realloc() with a proper amount of memory.
  
  MFC after:3 days

Modified:
  head/lib/libjail/jail.c

Modified: head/lib/libjail/jail.c
==
--- head/lib/libjail/jail.c Wed Feb 17 15:44:01 2010(r204007)
+++ head/lib/libjail/jail.c Wed Feb 17 16:45:03 2010(r204008)
@@ -191,7 +191,7 @@ jailparam_all(struct jailparam **jpp)
/* Add the parameter to the list */
if (njp >= nlist) {
nlist *= 2;
-   jp = realloc(jp, nlist * sizeof(jp));
+   jp = realloc(jp, nlist * sizeof(*jp));
if (jp == NULL) {
jailparam_free(jp, njp);
return (-1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204009 - head/sys/dev/mge

2010-02-17 Thread Rafal Jaworowski
Author: raj
Date: Wed Feb 17 17:03:04 2010
New Revision: 204009
URL: http://svn.freebsd.org/changeset/base/204009

Log:
  Assorted fixes for mge(4).
  
  - Use proper map for the busdma sync on mge descriptor.
  - Remove unnecesary busdma sync.
  - Eliminate redundant locking in mge_reinit_rx() (just assert).
  - Kill unused variable.
  
  Submitted by: Grzegorz Bernacki
  Obtained from:Semihalf
  MFC after:1 week

Modified:
  head/sys/dev/mge/if_mge.c

Modified: head/sys/dev/mge/if_mge.c
==
--- head/sys/dev/mge/if_mge.c   Wed Feb 17 16:45:03 2010(r204008)
+++ head/sys/dev/mge/if_mge.c   Wed Feb 17 17:03:04 2010(r204009)
@@ -457,10 +457,7 @@ mge_allocate_dma(struct mge_softc *sc)
 {
int error;
struct mge_desc_wrapper *dw;
-   int num, i;
-
-
-   num = MGE_TX_DESC_NUM + MGE_RX_DESC_NUM;
+   int i;
 
/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
error = bus_dma_tag_create(NULL,/* parent */
@@ -543,7 +540,7 @@ mge_reinit_rx(struct mge_softc *sc)
struct mge_desc_wrapper *dw;
int i;
 
-   MGE_RECEIVE_LOCK(sc);
+   MGE_RECEIVE_LOCK_ASSERT(sc);
 
mge_free_desc(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM, sc->mge_rx_dtag, 1);
 
@@ -564,8 +561,6 @@ mge_reinit_rx(struct mge_softc *sc)
 
/* Enable RX queue */
MGE_WRITE(sc, MGE_RX_QUEUE_CMD, MGE_ENABLE_RXQ(MGE_RX_DEFAULT_QUEUE));
-
-   MGE_RECEIVE_UNLOCK(sc);
 }
 
 #ifdef DEVICE_POLLING
@@ -1375,9 +1370,6 @@ mge_encap(struct mge_softc *sc, struct m
dw = &sc->mge_tx_desc[desc_no];
mapp = dw->buffer_dmap;
 
-   bus_dmamap_sync(sc->mge_desc_dtag, mapp,
-   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-
/* Create mapping in DMA memory */
error = bus_dmamap_load_mbuf_sg(sc->mge_tx_dtag, mapp, m0, segs, &nsegs,
BUS_DMA_NOWAIT);
@@ -1401,7 +1393,7 @@ mge_encap(struct mge_softc *sc, struct m
mge_offload_setup_descriptor(sc, dw);
}
 
-   bus_dmamap_sync(sc->mge_desc_dtag, mapp,
+   bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
sc->tx_desc_curr = (++sc->tx_desc_curr) % MGE_TX_DESC_NUM;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203926 - in head/games/fortune: fortune strfile unstr

2010-02-17 Thread John Baldwin
On Monday 15 February 2010 10:10:22 am Ulrich Spoerlein wrote:
> Author: uqs
> Date: Mon Feb 15 15:10:21 2010
> New Revision: 203926
> URL: http://svn.freebsd.org/changeset/base/203926
> 
> Log:
>   fortune(6) switch to 3-clause BSDL; style(9)
>   
>   This reduces the diff to other *BSD and makes it possible to actually
>   see the code differences.
>   
>   Approved by:ed (Co-mentor)

There appear to be a lot of unrelated changes to at least fortune.c in this 
commit.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203758 - in head/sys: amd64/conf arm/conf i386/conf ia64/conf mips/conf pc98/conf powerpc/conf sparc64/conf sun4v/conf

2010-02-17 Thread John Baldwin
On Tuesday 16 February 2010 8:30:32 am Bernd Walter wrote:
> On Mon, Feb 15, 2010 at 05:14:25PM -0700, M. Warner Losh wrote:
> > In message: <4b79ce84.3060...@freebsd.org>
> > Andriy Gapon  writes:
> > : At least in the i386/amd64 kernel config files typically we have:
> > : optionsOPTION
> > : And it is the case for the quoted above amd64 context.
> > 
> > That's the standard way to add options in all kernel config files,
> > although there's pockets here and there which don't quite comply.
> 
> Interesting - I wasn't aware of this, but it surely makes sense.

There's a comment in sys/conf/NOTES:

#
# NOTES conventions and style guide:
#
# Large block comments should begin and end with a line containing only a
# comment character.
#
# To describe a particular object, a block comment (if it exists) should
# come first.  Next should come device, options, and hints lines in that
# order.  All device and option lines must be described by a comment that
# doesn't just expand the device or option name.  Use only a concise
# comment on the same line if possible.  Very detailed descriptions of
# devices and subsystems belong in man pages.
#
# A space followed by a tab separates 'options' from an option name.  Two
# spaces followed by a tab separate 'device' from a device name.  Comments
# after an option or device should use one space after the comment character.
# To comment out a negative option that disables code and thus should not be
# enabled for LINT builds, precede 'options' with "#!".
#

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Bruce Evans

On Wed, 17 Feb 2010, Poul-Henning Kamp wrote:


Log:
 Mention EISDIR as a possible errno.


It's not a possible error.


Modified:
 head/lib/libc/sys/unlink.2

Modified: head/lib/libc/sys/unlink.2
==
--- head/lib/libc/sys/unlink.2  Wed Feb 17 09:09:12 2010(r203989)
+++ head/lib/libc/sys/unlink.2  Wed Feb 17 09:11:21 2010(r203990)
@@ -114,6 +114,8 @@ succeeds unless:
.Bl -tag -width Er
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
+.It Bq Er EISDIR
+The named file is a directory.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded 255 characters,
or an entire path name exceeded 1023 characters.


According to the POSIX spec (old draft, current version is the same):

%%%
48397  [EPERM]  The file named by path is a directory, 
and either the calling process does not
48398   have appropriate privileges, or the 
implementation prohibits using unlink( )
48399   on directories.
   [EISDIR] [not mentioned for unlink()]
%%%

According to unlink.2:
%%%
 [EPERM]The named file is a directory.
 [EISDIR]   [previously not mentioned]
%%%

According to the source code: in kern_unlinkat():

%   if (vp->v_type == VDIR && oldinum == 0) {
%   error = EPERM;  /* POSIX */
%   } else if (oldinum != 0 &&
% ((error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td)) == 0) &&
% sb.st_ino != oldinum) {
%   error = EIDRM;  /* Identifier removed */
%   } else {

`oldinum' is always 0 for unlink(2).  Thus the code matches the specified
and previously-documented behaviour.  FreeBSD is still choosing to implement
the second possibility of the spec (that the implementation prohibits using
unlink() on directories) (except the first possibility allows this too --
appropriate privilege can mean "more privilege than anyone has").  The
difference may be a difference in FreeBSD since trying to use appropriate
privilege may have side effects, but it isn't required to be a difference
in POSIX.

`oldinum' is also always 0 for unlinkat(2).  It seems to be only nonzero
for the ffs_fsck sysctl.  I guess this sysctl is undocumented and its
EIDRM error is even less documented.

The oldinum code has bad style:
- weird indentation for both continued lines.  Far from KNF (-ci4).  Closer
  to -lp, but off-by 1 char for that.
- banal comment.

The "POSIX" comment for oldinum == 0 is banal and misleading too.  POSIX
does specify the errno as EPERM, but the only possibly-surprising thing
about this errno is that it occurs for the superuser too, not what it is.
Once upon a time, FreeBSD implemented the first possibility, with
appropriate privilege meaning that only the superuser can try to
unlink() (might still fail due to a leaf file system not liking it).
Then the errno of EPERM was generic for lack of appropriate privelege
and not commented on.  Only the superuse case changed, and the comment
misleads by documenting something banal instead of that.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203926 - in head/games/fortune: fortune strfile unstr

2010-02-17 Thread Ulrich Spörlein
On Wed, 17.02.2010 at 11:43:57 -0500, John Baldwin wrote:
> On Monday 15 February 2010 10:10:22 am Ulrich Spoerlein wrote:
> > Author: uqs
> > Date: Mon Feb 15 15:10:21 2010
> > New Revision: 203926
> > URL: http://svn.freebsd.org/changeset/base/203926
> > 
> > Log:
> >   fortune(6) switch to 3-clause BSDL; style(9)
> >   
> >   This reduces the diff to other *BSD and makes it possible to actually
> >   see the code differences.
> >   
> >   Approved by:  ed (Co-mentor)
> 
> There appear to be a lot of unrelated changes to at least fortune.c in this 
> commit.

Hi John,

care to elaborate? The commit log says that style(9) has been applied
and it is a diff reduction commit in general.

That said, the only object code altering change is the replacing of
exit(0) with return(0) at the end of main(). There's nothing definitive
in style(9) about that ...

Cheers,
Uli
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Poul-Henning Kamp
In message <20100218044931.s95...@delplex.bde.org>, Bruce Evans writes:
>On Wed, 17 Feb 2010, Poul-Henning Kamp wrote:
>
>> Log:
>>  Mention EISDIR as a possible errno.
>
>It's not a possible error.

critter phk> cat > a.c
#include 
#include 

int
main(int argc, char **argv)
{
if (unlink("/"))
err(1, "Told you so");
return (0);
}
critter phk> cc a.c
critter phk> ./a.out
a.out: Told you so: Is a directory
critter phk> 

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Bruce Evans

On Thu, 18 Feb 2010, Bruce Evans wrote:


On Wed, 17 Feb 2010, Poul-Henning Kamp wrote:


Log:
 Mention EISDIR as a possible errno.


It's not a possible error.


...


Related bug: unlink(1) bogusly prints a messages that looks like
strerror(EISDIR).  It doesn't even try unlink(2) on directories,
but prints this message from a private string.

%%%
Script started on Thu Feb 18 05:49:45 2010
ttyp0:b...@besplex:/tmp/z> mkdir z
ttyp0:b...@besplex:/tmp/z> /bin/unlink z
unlink: z: is a directory
ttyp0:b...@besplex:/tmp/z> truss /bin/unlink z
lstat("z",0xbfbfe840)  = 0 (0x0)
unlink: write(2,0xbfbfe0b0,8)= 8 (0x8)
z: is a directorywrite(2,0xbfbfe0d0,17)  = 17 (0x11)

write(2,0x80a6753,1) = 1 (0x1)
exit(0x1) 
process exit, rval = 256

%%%

Here I use /bin/unlink since the unlink in $PATH is missing the bug.

/bin/unlink is a link to /bin/rm.  rm(1) takes a -d flag which should
do the right thing for unlink, but this flag is neither settable nor
forced for unlink(1).

The above behaviour of unlink(1) is not permitted by POSIX or unlink(1)'s
man page:

POSIX (old draft, no change in current version):
%%%
36900The unlink utility shall perform the function call:
36901unlink(file);
36902A user may need appropriate privilege to invoke the unlink 
utility.
%%%

Man page:
%%%
 When the utility is called as unlink, only one argument, which must not
 be a directory, may be supplied.  No options may be supplied in this sim-
 ple mode of operation, which performs an unlink(2) operation on the
 passed argument.

STANDARDS
 The rm command conforms to IEEE Std 1003.2 (``POSIX.2'').

 The simplified unlink command conforms to Version 2 of the Single UNIX
 Specification (``SUSv2'').
%%%

Oops, the man page actually says that the arg must not be a directory.

POSIX doesn't make this restriction, except by possibly requiring
appropriate privilege, which can be interpreted as "more privilege
than exists" if the file is a directory so as to make FreeBSD conform
(except the error must involve unlink(1) not being invokable in this
case :-).  POSIX doesn't specify the form of the diagnostic message for
any case.

Anyway, unlink(1) shouldn't fall into rm(1)'s error handling to to
print its diagnostic.  It should use a special message (matching its
man page) for directories, or just try unlink(2).

rm(1)'s current special message should say something about directory
removal requiring -d, and not look like strerror(EISDIR).  Or since
directory removal is prohibited by the kernel, the -d option can never
work, so it should have been removed ~10 years ago when the kernel was
changed to prohibit it.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Garrett Cooper
On Wed, Feb 17, 2010 at 11:13 AM, Bruce Evans  wrote:
> On Thu, 18 Feb 2010, Bruce Evans wrote:
>
>> On Wed, 17 Feb 2010, Poul-Henning Kamp wrote:
>>
>>> Log:
>>>  Mention EISDIR as a possible errno.
>>
>> It's not a possible error.
>>
>>> ...
>
> Related bug: unlink(1) bogusly prints a messages that looks like
> strerror(EISDIR).  It doesn't even try unlink(2) on directories,
> but prints this message from a private string.
>
> %%%
> Script started on Thu Feb 18 05:49:45 2010
> ttyp0:b...@besplex:/tmp/z> mkdir z
> ttyp0:b...@besplex:/tmp/z> /bin/unlink z
> unlink: z: is a directory
> ttyp0:b...@besplex:/tmp/z> truss /bin/unlink z
> lstat("z",0xbfbfe840)                            = 0 (0x0)
> unlink: write(2,0xbfbfe0b0,8)                            = 8 (0x8)
> z: is a directorywrite(2,0xbfbfe0d0,17)                          = 17 (0x11)
>
> write(2,0x80a6753,1)                             = 1 (0x1)
> exit(0x1) process exit, rval = 256
> %%%
>
> Here I use /bin/unlink since the unlink in $PATH is missing the bug.
>
> /bin/unlink is a link to /bin/rm.  rm(1) takes a -d flag which should
> do the right thing for unlink, but this flag is neither settable nor
> forced for unlink(1).
>
> The above behaviour of unlink(1) is not permitted by POSIX or unlink(1)'s
> man page:
>
> POSIX (old draft, no change in current version):
> %%%
> 36900            The unlink utility shall perform the function call:
> 36901            unlink(file);
> 36902            A user may need appropriate privilege to invoke the unlink
> utility.
> %%%
>
> Man page:
> %%%
>     When the utility is called as unlink, only one argument, which must not
>     be a directory, may be supplied.  No options may be supplied in this
> sim-
>     ple mode of operation, which performs an unlink(2) operation on the
>     passed argument.
>
> STANDARDS
>     The rm command conforms to IEEE Std 1003.2 (``POSIX.2'').
>
>     The simplified unlink command conforms to Version 2 of the Single UNIX
>     Specification (``SUSv2'').
> %%%
>
> Oops, the man page actually says that the arg must not be a directory.
>
> POSIX doesn't make this restriction, except by possibly requiring
> appropriate privilege, which can be interpreted as "more privilege
> than exists" if the file is a directory so as to make FreeBSD conform
> (except the error must involve unlink(1) not being invokable in this
> case :-).  POSIX doesn't specify the form of the diagnostic message for
> any case.
>
> Anyway, unlink(1) shouldn't fall into rm(1)'s error handling to to
> print its diagnostic.  It should use a special message (matching its
> man page) for directories, or just try unlink(2).
>
> rm(1)'s current special message should say something about directory
> removal requiring -d, and not look like strerror(EISDIR).  Or since
> directory removal is prohibited by the kernel, the -d option can never
> work, so it should have been removed ~10 years ago when the kernel was
> changed to prohibit it.

1. Where is EISDIR used in rm(1)?

[garrc...@garrcoop-fbsd /usr/src/sys]$ grep EISDIR ../bin/rm/rm.c
[garrc...@garrcoop-fbsd /usr/src/sys]$ uname -a
FreeBSD garrcoop-fbsd.cisco.com 8.0-STABLE FreeBSD 8.0-STABLE #2: Wed
Feb  3 16:57:07 PST 2010
garrc...@garrcoop-fbsd.cisco.com:/usr/obj/usr/src/sys/LAPPY_X86  i386

2. phk's example in a latter email used unlink(2), not unlink(1).

Thanks,
-Garrett
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Garrett Cooper
On Wed, Feb 17, 2010 at 1:11 AM, Poul-Henning Kamp  wrote:
> Author: phk
> Date: Wed Feb 17 09:11:21 2010
> New Revision: 203990
> URL: http://svn.freebsd.org/changeset/base/203990
>
> Log:
>  Mention EISDIR as a possible errno.
>
> Modified:
>  head/lib/libc/sys/unlink.2
>
> Modified: head/lib/libc/sys/unlink.2
> ==
> --- head/lib/libc/sys/unlink.2  Wed Feb 17 09:09:12 2010        (r203989)
> +++ head/lib/libc/sys/unlink.2  Wed Feb 17 09:11:21 2010        (r203990)
> @@ -114,6 +114,8 @@ succeeds unless:
>  .Bl -tag -width Er
>  .It Bq Er ENOTDIR
>  A component of the path prefix is not a directory.
> +.It Bq Er EISDIR
> +The named file is a directory.
>  .It Bq Er ENAMETOOLONG
>  A component of a pathname exceeded 255 characters,
>  or an entire path name exceeded 1023 characters.

This is wrong as per POSIX
():

[EPERM]
The file named by path is a directory, and either the calling process
does not have appropriate privileges, or the implementation prohibits
using unlink() on directories.

... and the current manpage ...

 [EPERM]The named file is a directory.

The manpage needs to be modified to note that, or the offender
needs to be fixed.

Thanks,
-Garrett
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Bruce Evans

On Wed, 17 Feb 2010, Poul-Henning Kamp wrote:


In message <20100218044931.s95...@delplex.bde.org>, Bruce Evans writes:

On Wed, 17 Feb 2010, Poul-Henning Kamp wrote:


Log:
 Mention EISDIR as a possible errno.


It's not a possible error.


critter phk> cat > a.c
#include 
#include 

int
main(int argc, char **argv)
{
   if (unlink("/"))
   err(1, "Told you so");
   return (0);
}
critter phk> cc a.c
critter phk> ./a.out
a.out: Told you so: Is a directory
critter phk>


Better fix the kernel bug than break the documentation then.

The bug is very old -- it happens in ~5.2, where the code is a bit easier
to understand:

% int
% kern_unlink(struct thread *td, char *path, enum uio_seg pathseg)
% {
%   struct mount *mp;
%   struct vnode *vp;
%   int error;
%   struct nameidata nd;
% 
% restart:

%   bwillwrite();
%   NDINIT(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF, pathseg, path,
%   td);
%   if ((error = namei(&nd)) != 0)
%   return (error);

namei() returns EISDIR for "/" (due to DELETE and and the special handling
of the degenerate case which includes "/" and not much else, else the bug
would affect more cases).  Then we return the wrong errno before we test
VDIR.

%   vp = nd.ni_vp;
%   if (vp->v_type == VDIR)
%   error = EPERM;
%   else {

Untested fix for ~5.2.  Also fixes some style bugs.

% Index: vfs_syscalls.c
% ===
% RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v
% retrieving revision 1.354
% diff -u -2 -r1.354 vfs_syscalls.c
% --- vfs_syscalls.c24 Jun 2004 17:22:29 -  1.354
% +++ vfs_syscalls.c17 Feb 2010 20:01:09 -
% @@ -1614,10 +1605,11 @@
%  restart:
%   bwillwrite();
% - NDINIT(&nd, DELETE, LOCKPARENT|LOCKLEAF, pathseg, path, td);
% + NDINIT(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF, pathseg, path,
% + td);

Style fixes:
- spell out NOFOLLOW (NOFOLLOW is 0, so omitting it is just confusing).
  This bug is in about 3 other vfs syscalls.
- there are spaces around binary operators in KNF.  These spaces are
  especially important for the "|" operator since this operator looks
  more like an alphanumeric character than most operator symbols, but
  they are most often omitted for this operator :-(.

%   if ((error = namei(&nd)) != 0)
% - return (error);
% + return (error == EISDIR ? EPERM : error);

Fix the EISDIR bug.

%   vp = nd.ni_vp;
%   if (vp->v_type == VDIR)
% - error = EPERM;  /* POSIX */
% + error = EPERM;

Remove banal/misleading comment.  The new fixup needs a comment more than
this, but I don't want to add one.

%   else {
%   /*

ISTR trying to avoid the special handling for the degenerate case in
namei() and lookup() (2 almost identical copies of it).  The correct
fix may be there.  From lookup() in ~5.2:

%   /*
%* Check for degenerate name (e.g. / or "")
%* which is a way of talking about a directory,
%* e.g. like "/." or ".".
%*/
%   if (cnp->cn_nameptr[0] == '\0') {
%   if (dp->v_type != VDIR) {
%   error = ENOTDIR;
%   goto bad;
%   }
%   if (cnp->cn_nameiop != LOOKUP) {
%   error = EISDIR;
%   goto bad;
%   }

Cases with trailing slashes are handled by removing the slash, but
this doesn't work for "/" since we don't want to end up with the fully
degenerate name of "".  Cases starting with this fully degnerate name
haven't been permitted since ~1988 when POSIX disallowed it, but the
comment in the code hasn't caught up with this.  The comment gives
these cases as examples only, but I think that is another bug and that
this is a complete list of degenerate names so the comment should say
"i.e.,".  After catching up with 1988 and removing "" from the list,
only "/" remains.  This is not really degenerate and can hopefully be
handled more directly and simply.  The != VDIR case in the above might
already be unreachable.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Bruce Evans

On Wed, 17 Feb 2010, Garrett Cooper wrote:


On Wed, Feb 17, 2010 at 11:13 AM, Bruce Evans  wrote:

On Thu, 18 Feb 2010, Bruce Evans wrote:



...


Related bug: unlink(1) bogusly prints a messages that looks like
strerror(EISDIR). ?It doesn't even try unlink(2) on directories,
but prints this message from a private string.
...
Anyway, unlink(1) shouldn't fall into rm(1)'s error handling to to
print its diagnostic. ?It should use a special message (matching its
man page) for directories, or just try unlink(2).

rm(1)'s current special message should say something about directory
removal requiring -d, and not look like strerror(EISDIR). ?Or since
directory removal is prohibited by the kernel, the -d option can never
work, so it should have been removed ~10 years ago when the kernel was
changed to prohibit it.


1. Where is EISDIR used in rm(1)?


Nowhere.  As described above, unlink[rm](1) prints a message that looks
like sterror(EISDIR) from a private string.  It doesn't even fake the
string properly (the real message capitalizes "Is").


2. phk's example in a latter email used unlink(2), not unlink(1).


My first reply was about unlink(2).  My second reply was originally
about the related bug in unlink(1) but expanded to cover related bugs
in rm(1).

Bruce___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r203926 - in head/games/fortune: fortune strfile unstr

2010-02-17 Thread John Baldwin
On Wednesday 17 February 2010 1:51:33 pm Ulrich Spörlein wrote:
> On Wed, 17.02.2010 at 11:43:57 -0500, John Baldwin wrote:
> > On Monday 15 February 2010 10:10:22 am Ulrich Spoerlein wrote:
> > > Author: uqs
> > > Date: Mon Feb 15 15:10:21 2010
> > > New Revision: 203926
> > > URL: http://svn.freebsd.org/changeset/base/203926
> > > 
> > > Log:
> > >   fortune(6) switch to 3-clause BSDL; style(9)
> > >   
> > >   This reduces the diff to other *BSD and makes it possible to actually
> > >   see the code differences.
> > >   
> > >   Approved by:ed (Co-mentor)
> > 
> > There appear to be a lot of unrelated changes to at least fortune.c in this 
> > commit.
> 
> Hi John,
> 
> care to elaborate? The commit log says that style(9) has been applied
> and it is a diff reduction commit in general.
> 
> That said, the only object code altering change is the replacing of
> exit(0) with return(0) at the end of main(). There's nothing definitive
> in style(9) about that ...

Oh, I missed the 'style(9)' bit.  A full sentence and even separate line
items such as:

- Switch to a 3-clause BSD license.
- Various style(9) fixes.

might help to reduce any confusion in the future.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r203926 - in head/games/fortune: fortune strfile unstr

2010-02-17 Thread Dag-Erling Smørgrav
Ulrich Spörlein  writes:
> That said, the only object code altering change is the replacing of
> exit(0) with return(0) at the end of main().

That's a regression.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204016 - head/tools/regression/bin/sh/expansion

2010-02-17 Thread Jilles Tjoelker
Author: jilles
Date: Wed Feb 17 22:22:20 2010
New Revision: 204016
URL: http://svn.freebsd.org/changeset/base/204016

Log:
  sh: arith: Test an octal constant as well.

Modified:
  head/tools/regression/bin/sh/expansion/arith2.0

Modified: head/tools/regression/bin/sh/expansion/arith2.0
==
--- head/tools/regression/bin/sh/expansion/arith2.0 Wed Feb 17 22:10:47 
2010(r204015)
+++ head/tools/regression/bin/sh/expansion/arith2.0 Wed Feb 17 22:22:20 
2010(r204016)
@@ -22,6 +22,7 @@ check "4611686018427387904" 461168601842
 check "0x4000" 4611686018427387904
 check "04" 4611686018427387904
 check "0x4Ab0" 5381801554707742720
+check "010" 8
 
 # try out all operators
 v=42
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204017 - head/tools/regression/bin/sh/expansion

2010-02-17 Thread Jilles Tjoelker
Author: jilles
Date: Wed Feb 17 22:25:22 2010
New Revision: 204017
URL: http://svn.freebsd.org/changeset/base/204017

Log:
  sh: arith: Add a test for a bug in the dash arith code,
  which I plan to import at some point.
  Our current code handles it fine and it should stay that way.

Added:
  head/tools/regression/bin/sh/expansion/arith3.0   (contents, props changed)

Added: head/tools/regression/bin/sh/expansion/arith3.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/arith3.0 Wed Feb 17 22:25:22 
2010(r204017)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+failures=0
+
+check() {
+   if [ $(($1)) != $2 ]; then
+   failures=$((failures+1))
+   echo "For $1, expected $2 actual $(($1))"
+   fi
+}
+
+check "1 << 1 + 1 | 1" 5
+
+exit $((failures != 0))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204019 - head/sys/dev/aac

2010-02-17 Thread Ed Maste
Author: emaste
Date: Wed Feb 17 22:28:37 2010
New Revision: 204019
URL: http://svn.freebsd.org/changeset/base/204019

Log:
  Include command type in COMMAND TIMEOUT messages to aid in debugging.

Modified:
  head/sys/dev/aac/aac.c

Modified: head/sys/dev/aac/aac.c
==
--- head/sys/dev/aac/aac.c  Wed Feb 17 22:28:32 2010(r204018)
+++ head/sys/dev/aac/aac.c  Wed Feb 17 22:28:37 2010(r204019)
@@ -2352,8 +2352,9 @@ aac_timeout(struct aac_softc *sc)
/* && !(cm->cm_flags & AAC_CMD_TIMEDOUT) */) {
cm->cm_flags |= AAC_CMD_TIMEDOUT;
device_printf(sc->aac_dev,
- "COMMAND %p TIMEOUT AFTER %d SECONDS\n",
- cm, (int)(time_uptime-cm->cm_timestamp));
+   "COMMAND %p (TYPE %d) TIMEOUT AFTER %d SECONDS\n",
+   cm, cm->cm_fib->Header.Command,
+   (int)(time_uptime-cm->cm_timestamp));
AAC_PRINT_FIB(sc, cm->cm_fib);
timedout++;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204024 - head/share/mk

2010-02-17 Thread Marcel Moolenaar
Author: marcel
Date: Thu Feb 18 01:44:48 2010
New Revision: 204024
URL: http://svn.freebsd.org/changeset/base/204024

Log:
  Unbreak WARNS=6 builds for C++ code: -Wold-style-definition is not accepted
  by the C++ compiler. Filter it out.

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkThu Feb 18 01:15:58 2010(r204023)
+++ head/share/mk/sys.mkThu Feb 18 01:44:48 2010(r204024)
@@ -66,7 +66,7 @@ CFLAGS+=  -g
 .endif
 
 CXX?=  c++
-CXXFLAGS   ?=  
${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign}
+CXXFLAGS   ?=  
${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition}
 PO_CXXFLAGS?=  ${CXXFLAGS}
 
 CPP?=  cpp
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204025 - head/share/mk

2010-02-17 Thread Marcel Moolenaar
Author: marcel
Date: Thu Feb 18 02:06:57 2010
New Revision: 204025
URL: http://svn.freebsd.org/changeset/base/204025

Log:
  Allow suppression of -Wcast-align for WARNS>=4 by defining
  NO_WCAST_ALIGN. The headers of the standard C++ library are
  not 64-bit clean and trigger the warning. This prevents use
  of WARNS>=4 on ia64 for example.

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkThu Feb 18 01:44:48 2010(r204024)
+++ head/share/mk/bsd.sys.mkThu Feb 18 02:06:57 2010(r204025)
@@ -43,7 +43,10 @@ CWARNFLAGS   +=  -W -Wno-unused-parameter -
 .  endif
 .  if ${WARNS} >= 4
 CWARNFLAGS +=  -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
-   -Wshadow -Wcast-align -Wunused-parameter
+   -Wshadow -Wunused-parameter
+.   if !defined(NO_WCAST_ALIGN)
+CWARNFLAGS +=  -Wcast-align
+.   endif
 .  endif
 # BDECFLAGS
 .  if ${WARNS} >= 6
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204027 - head/share/mk

2010-02-17 Thread Marcel Moolenaar
Author: marcel
Date: Thu Feb 18 03:32:51 2010
New Revision: 204027
URL: http://svn.freebsd.org/changeset/base/204027

Log:
  Also add DEBUG_FLAGS to CXXFLAGS if defined.

Modified:
  head/share/mk/bsd.prog.mk

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Thu Feb 18 02:37:23 2010(r204026)
+++ head/share/mk/bsd.prog.mk   Thu Feb 18 03:32:51 2010(r204027)
@@ -17,6 +17,7 @@ NO_WERROR=
 
 .if defined(DEBUG_FLAGS)
 CFLAGS+=${DEBUG_FLAGS}
+CXXFLAGS+=${DEBUG_FLAGS}
 
 .if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "")
 CTFFLAGS+= -g
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204030 - head/usr.bin

2010-02-17 Thread Warner Losh
Author: imp
Date: Thu Feb 18 05:14:36 2010
New Revision: 204030
URL: http://svn.freebsd.org/changeset/base/204030

Log:
  bc and dc are not BSD version, not GNU version.

Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Thu Feb 18 05:12:05 2010(r204029)
+++ head/usr.bin/Makefile   Thu Feb 18 05:14:36 2010(r204030)
@@ -5,7 +5,7 @@
 
 # XXX MISSING: deroff diction graph learn plot
 #  spell spline struct xsend
-# XXX Use GNU versions: apropos bc dc diff grep ld man patch whatis
+# XXX Use GNU versions: apropos diff grep ld man patch whatis
 # Moved to secure: bdes
 #
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r204025 - head/share/mk

2010-02-17 Thread M. Warner Losh
In message: <201002180206.o1i26vjl023...@svn.freebsd.org>
Marcel Moolenaar  writes:
:   Allow suppression of -Wcast-align for WARNS>=4 by defining
:   NO_WCAST_ALIGN. The headers of the standard C++ library are
:   not 64-bit clean and trigger the warning. This prevents use
:   of WARNS>=4 on ia64 for example.

Even 32-bit ARM has issues with alignment and things like data puning
of types like sockaddr.

Warner
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r204031 - in head: share/mk sys/conf sys/kern sys/mips/mips

2010-02-17 Thread Neel Natu
Author: neel
Date: Thu Feb 18 05:49:52 2010
New Revision: 204031
URL: http://svn.freebsd.org/changeset/base/204031

Log:
  Kernel module support for mips.
  
  Reviewed by: gonzo
  
  Tested by: Alexandr Rybalko (r...@dlink.ua)

Modified:
  head/share/mk/bsd.cpu.mk
  head/sys/conf/files.mips
  head/sys/conf/kmod.mk
  head/sys/kern/link_elf_obj.c
  head/sys/mips/mips/elf_machdep.c

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkThu Feb 18 05:14:36 2010(r204030)
+++ head/share/mk/bsd.cpu.mkThu Feb 18 05:49:52 2010(r204031)
@@ -203,11 +203,9 @@ LD += -EB
 .if ${MACHINE_ARCH} == "mips" 
 . if defined(TARGET_BIG_ENDIAN)
 CFLAGS += -EB
-LDFLAGS += -Wl,-EB
 LD += -EB
 . else
 CFLAGS += -EL
-LDFLAGS += -Wl,-EL
 LD += -EL
 . endif
 CFLAGS += -msoft-float -G0 -mno-dsp -mabicalls

Modified: head/sys/conf/files.mips
==
--- head/sys/conf/files.mipsThu Feb 18 05:14:36 2010(r204030)
+++ head/sys/conf/files.mipsThu Feb 18 05:49:52 2010(r204031)
@@ -89,6 +89,8 @@ libkern/umoddi3.c optionalisa_mips32
 #libkern/mips/strcmp.S standard
 #libkern/mips/strncmp.Sstandard
 
+kern/link_elf_obj.cstandard
+
 dev/cfe/cfe_api.c  optionalcfe
 dev/cfe/cfe_console.c  optionalcfe_console
 dev/cfe/cfe_env.c  optionalcfe_env

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Thu Feb 18 05:14:36 2010(r204030)
+++ head/sys/conf/kmod.mk   Thu Feb 18 05:49:52 2010(r204031)
@@ -128,6 +128,10 @@ CFLAGS+=   -fno-omit-frame-pointer
 CFLAGS+=   -mlongcall -fno-omit-frame-pointer
 .endif
 
+.if ${MACHINE_ARCH} == "mips"
+CFLAGS+=   -G0 -fno-pic -mno-abicalls -mlong-calls
+.endif
+
 .if defined(FIRMWS)
 .if !exists(@)
 ${KMOD:S/$/.c/}: @
@@ -174,7 +178,7 @@ ${PROG}.symbols: ${FULLPROG}
${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET}
 .endif
 
-.if ${MACHINE_ARCH} != amd64
+.if ${MACHINE_ARCH} != amd64 && ${MACHINE_ARCH} != mips
 ${FULLPROG}: ${KMOD}.kld
${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld
 .if !defined(DEBUG_FLAGS)
@@ -187,7 +191,7 @@ EXPORT_SYMS?=   NO
 CLEANFILES+=   export_syms
 .endif
 
-.if ${MACHINE_ARCH} != amd64
+.if ${MACHINE_ARCH} != amd64 && ${MACHINE_ARCH} != mips
 ${KMOD}.kld: ${OBJS}
 .else
 ${FULLPROG}: ${OBJS}
@@ -206,7 +210,8 @@ ${FULLPROG}: ${OBJS}
export_syms | xargs -J% ${OBJCOPY} % ${.TARGET}
 .endif
 .endif
-.if !defined(DEBUG_FLAGS) && ${MACHINE_ARCH} == amd64
+.if !defined(DEBUG_FLAGS) && \
+(${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == mips)
${OBJCOPY} --strip-debug ${.TARGET}
 .endif
 

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cThu Feb 18 05:14:36 2010
(r204030)
+++ head/sys/kern/link_elf_obj.cThu Feb 18 05:49:52 2010
(r204031)
@@ -853,8 +853,8 @@ link_elf_load_file(linker_class_t cls, c
panic("lost relatab");
if (mapbase != (vm_offset_t)ef->address + mapsize)
panic("mapbase 0x%lx != address %p + mapsize 0x%lx (0x%lx)\n",
-   mapbase, ef->address, mapsize,
-   (vm_offset_t)ef->address + mapsize);
+   (u_long)mapbase, ef->address, (u_long)mapsize,
+   (u_long)(vm_offset_t)ef->address + mapsize);
 
/* Local intra-module relocations */
link_elf_reloc_local(lf);

Modified: head/sys/mips/mips/elf_machdep.c
==
--- head/sys/mips/mips/elf_machdep.cThu Feb 18 05:14:36 2010
(r204030)
+++ head/sys/mips/mips/elf_machdep.cThu Feb 18 05:49:52 2010
(r204031)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #ifdef __mips_n64
 struct sysentvec elf64_freebsd_sysvec = {
@@ -163,7 +164,12 @@ elf_reloc_internal(linker_file_t lf, Elf
Elf_Addr addend = (Elf_Addr)0;
Elf_Word rtype = (Elf_Word)0, symidx;
const Elf_Rel *rel;
-   const Elf_Rela *rela;
+
+   /*
+* Stash R_MIPS_HI16 info so we can use it when processing R_MIPS_LO16
+*/
+   static Elf_Addr ahl;
+   static Elf_Addr *where_hi16;
 
switch (type) {
case ELF_RELOC_REL:
@@ -173,108 +179,63 @@ elf_reloc_internal(linker_file_t lf, Elf
rtype = ELF_R_TYPE(rel->r_info);
symidx = ELF_R_SYM(rel->r_info);
break;
-   case ELF_RELOC_RELA:
-   rela = (const Elf_Rela *)data;
-   where = (Elf_Addr *) (relocbase + rela->r_offset);
-   addend = rela->r_addend;

Re: svn commit: r203990 - head/lib/libc/sys

2010-02-17 Thread Tim Kientzle

Garrett Cooper wrote:

On Wed, Feb 17, 2010 at 1:11 AM, Poul-Henning Kamp  wrote:

Author: phk
Date: Wed Feb 17 09:11:21 2010
New Revision: 203990
URL: http://svn.freebsd.org/changeset/base/203990

Log:
 Mention EISDIR as a possible errno.

Modified:
 head/lib/libc/sys/unlink.2


This is wrong as per POSIX
():

[EPERM]
The file named by path is a directory, and either the calling process
does not have appropriate privileges, or the implementation prohibits
using unlink() on directories.


On a not-entirely-unrelated note, I wonder if
any of the POSIX experts around know whether POSIX
specifies an errno value for this call:
  open("/", O_WRONLY | O_EXCL | O_CREAT, 0777)

I ran into this puzzler back when I was trying to optimize
the restore sequence for libarchive.  As near as I've
been able to tell, POSIX is ambiguous here:  It
requires EISDIR for open(O_WRONLY) on a dir and EEXIST
for open(O_EXCL | O_CREAT) on an existing item but
without any clear guidance on which of those takes
priority in this case.

Anyone think they know the answer?

Cheers,

Tim

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"