Commit Graph

18 Commits

Author SHA1 Message Date
Konstantin Belousov
c4ecd13b77 Move scandir(3) and alphasort(3) into XSI namespace.
Noted and reviewed by:	bde
MFC after:	2 weeks
2010-01-05 20:17:13 +00:00
Konstantin Belousov
4176dd5267 Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.

Remove requirement for "sys/types.h" include for functions from manpage.

POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.

Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.

PR:	standards/142255
MFC after:	2 weeks
2010-01-04 15:40:17 +00:00
Xin LI
6fda52ba75 Implement fdopendir(3) by splitting __opendir2() into two parts, the upper part
deals with the usual __opendir2() calls, and the rest part with an interface
translator to expose fdopendir(3) functionality.  Manual page was obtained from
kib@'s work for *at(2) system calls.
2008-04-16 18:59:36 +00:00
John Birrell
6276af0ff1 Use a forward definition of an opaque structure rather than a void
to avoid a strict alias type check failure in gcc 4.2.
2007-11-20 01:49:00 +00:00
Marcel Moolenaar
12eb46c8bb Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
   by virtue of the generated code implicitly widens ints to longs and
   allows the use of an 32-bit integral type for 64-bit arguments.
   Subsequent arguments are passed onto the memory stack, which does
   not exhibit the same behaviour and consequently do not allow this.
   In practice this means that variadic functions taking pointers
   and given NULL (without cast) work as long as the NULL is passed
   in one of the first 8 arguments. A SIGSEGV is more likely the
   result if such would be done for stack-based arguments. This is
   due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
   exception of ia64, allow 32-bit integral types (specifically NULL)
   when 64-bit pointers are expected in variadic functions by way of
   how the compiler generates code. As such, code that works correctly
   (whether rightfully so or not) on any platform other than ia64, may
   fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...
2003-12-07 21:10:06 +00:00
Mike Barcroft
9ad8e31ee8 Fix namespace issues by using the relatively new visibility
primitives.
2002-09-10 18:12:16 +00:00
Mike Barcroft
006d0ddf67 style(9): line up function names. 2002-09-09 03:52:43 +00:00
Warner Losh
bb28f3c29b Breath deep and take __P out of the system include files.
# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.
2002-03-23 17:24:55 +00:00
Daniel Eischen
f9447cd112 Add a lock to DIR to make telldir and friends MT-safe.
Clean up stdio.h a bit and remove _THREAD_SAFE.  Some of the
usual macros getc, putc, getchar, putchar are no longer macros.

Approved by:	-arch
2001-01-24 13:01:47 +00:00
Daniel Eischen
10d1cba0bf Move telldir position recording type definitions and prototypes
to "telldir.h" in order to prevent namespace pollution in
<dirent.h> (which was including <sys/queue.h>).

Add $FreeBSD$ to rewinddir.c and seekdir.c.
2000-12-11 04:00:36 +00:00
Daniel Eischen
9b8551d0a5 Add a LIST_HEAD to DIR for a queue of telldir positions.
Also add a location count (used as the magic for telldir)
to DIR.  A future change will also add a mutex/lock.
2000-12-06 03:14:28 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Bruce Evans
19fa8f60e9 Fixed missing declaration of getdents(2). 1999-12-23 15:52:13 +00:00
Alfred Perlstein
8b6c02f328 style fixes, remove extra braces.
readdir_r is not POSIX according to POSIX_SOURCE, bruce says:
> readdir_r() is in the _POSIX_SOURCE section, but is not a POSIX.1-1990
> function.  It's POSIX.1-1996 so it should be under a different feature
> test which we don't support yet.

make sure errno is saved so that its contents are cleared unless
necessary.

Submitted by: bde
1999-11-29 19:12:50 +00:00
Alfred Perlstein
7285bccf1a add pthread_cancel, obtained from OpenBSD.
eischen (Daniel Eischen) added wrappers to protect against cancled
threads orphaning internal resources.

the cancelability code is still a bit fuzzy but works for test
programs of my own, OpenBSD's and some examples from ORA's books.

add readdir_r to both libc and libc_r

add some 'const' attributes to function parameters

Reviewed by: eischen, jasone
1999-11-28 05:38:13 +00:00
Peter Wemm
48eaae4831 Merge Lite2 changes onto mainline:
- declare opendir2(), which is used to control how readdir() handles
 whiteouts etc.
1997-03-11 11:15:46 +00:00
Rodney W. Grimes
4399be3cbd Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
Rodney W. Grimes
59deaec541 BSD 4.4 Lite Include Sources 1994-05-24 09:57:34 +00:00