Commit Graph

428 Commits

Author SHA1 Message Date
Salvatore Benedetto 461106374f * Fix year in license
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26922 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-10 17:02:34 +00:00
Salvatore Benedetto 4093d16d51 * updating license
* use _{BEGIN|END}_DECL macro instead of ifdef C++



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26921 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-10 16:29:51 +00:00
Ingo Weinhold a9d7be0708 * Implemented mprotect(). A vm_area does now have an optional array
specifying the protection of each page (4 bits per page).
* Added no-op implementation of posix_madvise().
* Replaced a few "addr_t size" parameters by "size_t size".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26871 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-08 01:00:06 +00:00
Salvatore Benedetto b3ae704659 * fix year in copyright
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26856 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-07 10:59:35 +00:00
Salvatore Benedetto 40353b088c * Updating license
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-07 08:14:09 +00:00
Axel Dörfler f8009f7ba4 * Applied patch by kaliber: those headers weren't self-containing.
* This closes bug #2346.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26841 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-06 10:01:53 +00:00
Axel Dörfler 8169e6b4e6 * Patch by Andreas that adds sched.h, and sched_yield() to Haiku.
* This closes ticket #2568.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-05 17:54:14 +00:00
Axel Dörfler 6449b66e22 * As pointed out by Andreas, the previous patch wasn't really correct; ALLPERMS
should really contain all permission bits.
* It now uses S_ISVTX instead of S_ISTXT - this is how it works in Linux as
  well, while FreeBSD uses S_ISTXT there (but S_ISTXT and S_ISVTX have the
  same value there, too).
* Also fixed the fs_shell this time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26761 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 16:30:30 +00:00
Axel Dörfler 826df7bec8 * Patch by Andreas Färber: remove undefined S_ISTXT from ALLPERMS.
* This fixes bug #2560.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26754 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 12:51:40 +00:00
Axel Dörfler cc6c784ae7 * Sean C. Farley made me aware that some of the possible solutions to clear
the environment would crash on Haiku. Added a small test application that
  just checks every one of those.
* Fixed env locking (in userland, you better check against B_INTERRUPTED).
* Made our code safe against an environ of NULL.
* There is now an additional sManagedEnviron that points to the environment
  our code actually managed; whenever an application overrides environ, we'll
  get aware of it with the next *env() function invocation, and will handle
  it adequately.
* Added non-POSIX clearenv() function.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-01 15:02:03 +00:00
Axel Dörfler 47ca7595ca First patch by Salvatore to implement XSI semaphores with a few changes
by myself:
* renamed xsi_do_undo() to xsi_sem_undo() (there is more to XSI than sems).
* Fixed coding style issues in sys/sem.h and xsi_sem.cpp.
* Added _kern_*() syscall prototypes to syscalls.h.
* Added a TODO in xsi_sem.cpp and xsi_semaphore.h about moving union semun to
  a shared header.
* Made the team::xsi_sem_undo_requests int32 - due to padding, it would have
  needed 4 bytes anyway; please always use specific types over int/short/long.
* xsi_sem_undo() now checks if it needs to do anything - the calls in team.cpp
  no longer needs to do this.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26676 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-29 12:03:41 +00:00
Axel Dörfler eaf71fbdb6 * Build fix: coreutils had a replacement for dirfd().
* Made DIR argument const in dirfd().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26469 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-17 01:22:13 +00:00
Michael Lotz d73327e274 Make dirfd() publically available. It used on other systems as well it seems.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26466 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-17 01:01:52 +00:00
Oliver Ruiz Dorantes 0501b7cd80 Add AF_BLUETOOTH sockets family
- Feel free to change the index
 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26445 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 17:30:36 +00:00
Axel Dörfler 9c5c79ad86 * Made DIR definition private, and moved it into the new dirent_private.h
header.
* Added fields necessary to make it possible to retrieve more than one
  dirent from the underlying file system.
* Unless some app creates a DIR on its own to it to feed readdir(), this
  change should be binary compatible. If we find an application misbehaving,
  we can still make it a GCC4 only thing.
* fs_attr/fs_index/fs_query now all use readdir() directly (as that one
  contains the logic to iterate through a number of dirents in userspace).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26339 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-09 11:16:00 +00:00
Jérôme Duval 765ae3a785 Applied patch from Mika Lindqvist: This patch implements both strlwr() and strupr() functions in libroot and includes strupr() in kernel build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26226 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 19:30:46 +00:00
François Revol 63dff3f9a3 Placeholder for ARM.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-25 22:57:34 +00:00
Salvatore Benedetto 93dd5d6569 * Fix typo. Thanks mjw!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26132 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-25 19:29:03 +00:00
Ingo Weinhold a2cf1d70ef Removed <syscalls.h>' dependency to <semaphore.h> by giving the sem_t
structure a name.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26015 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-19 00:05:01 +00:00
Axel Dörfler 3b2c863f1c The "search.h" header had a couple of issues:
* It was not self containing, as it used size_t without defining it.
* It was not C++ safe.
* It used the restrict keyword that is not recognized in GCC2. This fixes bug
  #2262.
* It did not contain parameter names as demanded by our coding style.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-06 07:42:58 +00:00
Ingo Weinhold d46a010c43 Patch by Vasilis Kaoutsis: Added sigpause().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25682 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-28 15:28:49 +00:00
Axel Dörfler 187c576425 * Added sys/ipc.h header. As the functionality has not yet been implemented,
I added an #error directive, so configure scripts shouldn't be fooled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25663 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-26 16:55:57 +00:00
Axel Dörfler a411c76cd6 * Added pthread_attr_setscope(), and pthread_attr_getscope(). We only support
PTHREAD_SCOPE_SYSTEM which makes the implementation rather simple.
* This closed ticket #2242.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25628 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-23 11:24:40 +00:00
François Revol 74be35c78b Some more funny sysconf()...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25627 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-23 01:38:05 +00:00
François Revol 4b9329efe1 Define PAGE_SIZE and PAGESIZE in limits.h. It should really depend on B_PAGE_SIZE, but I'm not sure we can #include anything in there...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25626 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-23 01:01:57 +00:00
François Revol 3a17a548da - factored out [f]pathconf().
- *pathconf() now uses statvfs and fs_info data when appropriate. It should also check for file type though, some only apply to directory or others.
- added confstr(_CS_PATH) with a sensible default.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-23 00:33:08 +00:00
François Revol ca974ded95 Some more [f]pathconf() names, not yet handled. filesizebits returns 64 though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-22 23:22:26 +00:00
Ingo Weinhold 0f448d21e5 * Added vm_page_write_modified_page_range(), which is similar to
vm_page_write_modified_pages(), save that it only writes pages in the
  given range.
* Added vm_page_schedule_write_page_range() which schedules all modified
  pages in the given cache's range for writing by the page writer.
* Added _kern_sync_memory() syscall and the msync() POSIX function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-22 21:51:12 +00:00
Ingo Weinhold f3917584f1 Added missing INET_ADDRSTRLEN.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25598 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-21 22:37:42 +00:00
Ingo Weinhold 43a4a6bacb Forgot closing parenthesis.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25593 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-21 21:08:47 +00:00
Ingo Weinhold 3021393e36 Let's pretend we support POSIX threads.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25588 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-21 00:03:09 +00:00
Ingo Weinhold 9ac19900c4 Added LOG_UPTO() macro. Not part of POSIX, but widely used anyway.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25587 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-21 00:02:26 +00:00
Ingo Weinhold a8af2b6dda Some work on pthreads:
* Made the pthread_cond_t internals public. This is necessary to support
  process shared condition variables. Fixed initializer macro.
* Made the pthread_rwlockattr_t structure opaque.
* pthread_t is no longer typedef'ed to int. It's the pointer to the
  internal _pthread_thread structure.
* Removed __get_pthread(). pthread_self() can be used instead.
* No longer tunnel the pthread exit value through Haiku's thread exit
  value. We do have a separate field in the _pthread_thread structure
  for it, now.
* Handle detaching of threads correctly.
* pthread_rwlockattr_{g,s}etpshared() use the
  PTHREAD_PROCESS_{SHARED,PRIVATE} constants, now.
* Commented out yet unsupported structures (barriers, spinlocks).
* Rebuilt APR optional package. The pthread changes weren't binary
  compatible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25582 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-20 20:43:28 +00:00
Ingo Weinhold 89d327d66e Added missing spwd::sp_lstchg field.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25560 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-19 02:16:12 +00:00
Ingo Weinhold 6e19c86ab0 Fixed potential warnings.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25487 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-14 12:52:34 +00:00
Ingo Weinhold 3ca1072d44 * Reimplemented pthread_once. The old one was neither thread-safe nor
particularly efficient.
* pthread_mutex implementation:
  - Removed the pthread_mutex_t indirection (the type was a pointer to
    the actual structure which was allocated on the heap), as it made
    sharing the mutex between processes impossible.
  - Removed the distinction between process shared and non-shared
    mutexes. Benaphores work just as well in shared memory, so we always
    use them.
* Fixed some static initializer macros. PTHREAD_COND_INITIALIZER is
  still broken, since it doesn't work in C code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-13 01:50:54 +00:00
Ingo Weinhold 370602bff6 Added pthread rwlock support.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25470 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-12 13:56:11 +00:00
Ingo Weinhold b932012815 Patch by Andreas Faerber:
Replaced single-line comments by multi-line comments for ANSI C
compliance.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25433 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-10 21:30:34 +00:00
Ingo Weinhold f7cc12b389 Implemented pthread_attr_{g,s}etstacksize(). Also added commented-out
prototypes for the missing pthread_attr_*() functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25390 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-09 01:36:49 +00:00
Ingo Weinhold f23d0a6242 Implement shm_open() and shm_unlink(). The shared memory objects are
simply created as files in /boot/var/shared_memory/. The Bootscript
clears the directory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25374 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-08 13:42:33 +00:00
Ingo Weinhold 3dfe682f55 * Added some padding to the sem_t structure.
* Changed the semantics of unnamed semaphores. Before parent and child
  of a fork() would always share an earlier created semaphore. Now we do
  that only, if the "shared" parameter of sem_init() was true. That's
  still not quite the behavior Linux and Solaris have, but should be
  perfectly fine with how reasonable code would use the API.
* There's a global table for shared unnamed semaphores now. ATM a
  semaphore is leaked when no one explicitly destroys it (just as with
  named sems).
* Enforce per-team and global semaphore number limits.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25362 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-08 01:39:49 +00:00
Ingo Weinhold 01b1098795 * Fixed some misunderstanding regarding the _POSIX_* macros. They are
not supposed to be passed to pathconf() or sysconf().
* Added POSIX semaphore related macros.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25361 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-08 01:27:31 +00:00
Ingo Weinhold 5142c2ac86 Added support for POSIX semaphores (the ones from the XSI extension
Realtime option group). The implementation should be complete, but is
totally untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-06 03:39:36 +00:00
Ingo Weinhold d29deffa2c Added the Linuxish SO_PEERCRED.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25303 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-04 00:28:27 +00:00
Ingo Weinhold 0e42d1bcd8 Our sockaddr_storage is only 128 bytes long. Hence invocations of bind()
or connect() that passed sizeof(sockaddr_un) would always fail. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25138 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 22:30:54 +00:00
Ingo Weinhold fb913b19be Added POSIX functions posix_openpt(), grantpt(), ptsname(), and
unlockpt(), which provide a portable way of opening a pty.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25134 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 21:29:13 +00:00
Axel Dörfler 945fb7e32a * Replaced destructor with destructorFunc to please python - it's not a reserved
keyword, so this stupid python should really be fixed instead.
* Enforced the 80 column limit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25090 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-20 21:20:07 +00:00
Ingo Weinhold a94ce1c912 * Reorganized the passwd and group support: A dedicated thread in the
registrar provides access to the DBs via a port message based
  protocol. The functions in libroot just ask the registrar now.
* Added Linuxish shadow passwd support. No putspent() though -- we'll
  provide private functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25002 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-17 16:19:18 +00:00
Ingo Weinhold 3cf7ecd1e4 * Added <sys/mman.h> header. It declares only mmap() and munmap() yet
and defines the macros needed by them.
* Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the
  path to an FD parameter. Changed vm_map_file() accordingly and
  adjusted the kernel ELF loader and the runtime loader.
* Added syscall _kern_unmap_memory().
* Added bool unmapAddressRange parameter to vm_create_anonymous_area()
  and map_backing_store(). If true and the address specification is
  B_EXACT_ADDRESS, all areas in the specified address range will be
  deleted (unless an area is covered only partially).
* Introduced B_SHARED_AREA flag, which is set on areas that have been
  created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When
  fork()ing those areas won't be copied CoW, but rather be cloned. This
  is needed for mmap() MAP_SHARED.
* {vm,_user}_map_file() also accept an FD argument < 0, in which case an
  anonymous area is created.
* Implemented mmap() and munmap(). Currently there's the restriction
  that we can't partially unmap areas. Otherwise the functions should be
  rather compliant. We also support the non-POSIX extension
  MAP_ANONYMOUS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 22:52:11 +00:00
Ingo Weinhold ac4630e161 * Added <sys/param.h> include, which is needed for _ALIGN().
* Added SCM_RIGHTS macro.
* Added a few non-standard but widely-used CMSG_*() macros.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 08:30:25 +00:00
Ingo Weinhold bab4c3bbff Changed the type of msghdr::{msg_name,msg_control} to void* as dictated
by POSIX.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24902 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:27:53 +00:00
Ingo Weinhold ef7cb2253b Rather use a char[] for the path. uint8_t[] is rather uncomfortable to
use with the string and *printf() functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24882 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 03:06:11 +00:00
Ingo Weinhold 64cd033664 Added socket macros.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 03:04:03 +00:00
Axel Dörfler 3d7e508f7b Added sys/poll.h header by popular request (see ticket #2037).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24864 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-08 09:17:07 +00:00
Axel Dörfler b9fe86d2d7 * Added pthread_setconcurrency(), and pthread_getconcurrency() functions.
* Since we use a 1:1 mapping, they don't do anything besides remembering the
  level set, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-07 10:57:01 +00:00
François Revol 038ed3d1f2 Add _SC_PAGE_SIZE sysconf().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24850 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-07 01:08:18 +00:00
Stephan Aßmus 42014658ad Applied patch by James Woodcock:
* Implemented POSIX getpagesize() function in libroot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24763 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 08:50:56 +00:00
Ingo Weinhold f8cb30712e * Replaced the dummy implementations of the <grp.h> and <pwd.h>
functions by ones reading /etc/{group,passwd}.
* Added quasi-standard getpwent_r() and getgrent_r().
* Added _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX sysconf()
  constants.
* Moved initgroups() and getgrouplist() definition to grp.cpp. They use
  the same backend as the <grp.h> functions.
* Set the permissions of files created by the build system to what they
  should be on the image (executables: 755, others: 644). Otherwise only
  root could do anything under Haiku.
* Added build system variables HAIKU_ROOT_USER_NAME and
  HAIKU_ROOT_USER_REAL_NAME to customize name and real name of Haiku's
  root user.
* Added build system rules AddUserToHaikuImage and AddGroupToHaikuImage
  for adding additional users and groups (by default only root user and
  group and a "users" group are created).
* Adjusted BIND port and coreutils config.h files according to what
  features have become available.
* Fixed HAIKU_DOCUMENTATION_OBJECT_DIR definition. Untested, but it used
  a wrong variable name before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 14:02:52 +00:00
Axel Dörfler c80e610789 * Added start of an implementation of pthread_cancel().
* Implemented pthread_setcanceltype(), pthread_setcancelstate(), and
  pthread_testcancel().
* In the previous commit, I also made pthread_private.h self-contained.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24710 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-31 18:49:19 +00:00
Axel Dörfler a635399b07 * Rearranged pthread thread support a bit: there is now a pthread_thread
structure that is attached (via TLS) to each pthread.
* Implemented support for pthread_cleanup_{push|pop}().
* I haven't really been able to test these changes, yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24704 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-31 15:10:00 +00:00
Ingo Weinhold 1bc2fbc25d Added BSDish timer*() macros.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24683 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 17:28:31 +00:00
Ingo Weinhold 360be1fc45 * Implemented support for chroot:
- Added a "root" vnode to the io_context. It is used for resolving
    paths and converting nodes to paths instead of sRoot. Some more
    passing around of io_context structures was necessary.
  - Introduced a new lock sIOContextRootLock to protect
    io_context::root. The current uses of io_context::io_mutex
    (put_vnode(), remove_vnode() while holding it) looked too suspicious
    to use that mutex in vnode_path_to_vnode().
  - Added _kern_change_root() syscall and chroot() libroot function.
  - Added chroot coreutils program to the image. Funnily it seems to be
    much easier to set up a little jail than under Linux (just copy
    bash and libroot.so into respective subdirs; mount another pipefs
    if you want pipe support).
    With Haiku allowing direct access to directories via inode IDs
    jailing is obviously not very secure at the moment.
  - Added /var/empty to the image. It will be the chroot target for ssh.
* Changed vfs.cpp:get_cwd() so that the io_context::io_mutex is no
  longer held when calling dir_vnode_to_path().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24673 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 05:59:54 +00:00
Ingo Weinhold 290946ce80 * Implemented some basics for supplementary groups support:
- The kernel stores the group IDs in the team structure. They are
    correctly inherited on fork() and load_image_etc().
  - Implemented getgroups() for real, i.e. it retrieves the groups
    associated with the process.
  - Implemented setgroups(), initgroups() and (the BSDish)
    getgrouplist(). The latter two read the group information from the
    "group database" /etc/group (if existing).
  - Change the BIND port config, since we do have getgrouplist() now.
* The set-uid feature was broken when the path to the executable was
  relative, since we used stat(), which, in the kernel, uses the kernel
  IO context.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 00:08:13 +00:00
Ingo Weinhold f244a07d99 Corrected value for _POSIX_NGROUPS_MAX.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24668 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 23:58:27 +00:00
Ingo Weinhold 22611e781a Patch by Curtis Wanner:
* Added some limit macros.
* Removed the "L" suffix from [U]INT32_MAX.
* Reordered some definitions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24654 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 14:16:07 +00:00
Ingo Weinhold 29674ea8cb Patch by Vasilis Kaoutsis:
* Check against maximum baud rate in cfset{i,o}speed().
* Changed some functions comments to doxygen style.
* Sorted speed macros in termios.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24647 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 12:52:10 +00:00
Ingo Weinhold 79e1d3770c Not that I know what I'm doing...
Moved nameser_compat.h to our public headers (arpa/inet) and include in
<arpa/nameser.h>. That's solved similarly in BONE. At any rate OpenSSH
is now happy that HEADER exists.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24644 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 12:37:05 +00:00
Ingo Weinhold 479a926477 Define PF_LOCAL and PF_UNIX for compatibility reasons. Makes OpenSSH
happier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24642 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 12:21:45 +00:00
Ingo Weinhold 0fddf2f088 Define howmany(). It seems to be what the BSDs are using. Linux
defines it, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24641 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 12:20:40 +00:00
Ingo Weinhold 5d2044f643 POSIX headers should not include BeOS/Haiku headers. Should help with
flex's pthread test.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-28 14:25:06 +00:00
Ingo Weinhold b564056dda GCC provides <stdbool.h>.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24617 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-28 07:42:07 +00:00
Ingo Weinhold c7c82420e1 _single_threaded should have C linkage. Was for some reason only a
problem with gcc 4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24565 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-25 01:56:46 +00:00
Ingo Weinhold e26a4ce3e9 Define __THROW.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 01:21:53 +00:00
Ingo Weinhold 2754fa8772 bcopy() is supposed to be overlap-save.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-22 18:13:42 +00:00
Ingo Weinhold 62319d069e Commented out real-time signal related stuff (SA_SIGINFO, waitid()) to
prevent "configure" scripts from thinking we do actually support it.
Having real-time signals would be nice though (cf. #1935).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24444 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 17:33:03 +00:00
Ingo Weinhold 404a0fea46 Second stab at reorganizing standard/gcc headers. This time it not only
builds on Linux with gcc 2 and 4, but the images do even run. :-) Not
tested on BeOS.

* Removed stddef.h and stdarg.h. They are provided by the compiler.
* Adjusted size_t.h, wchar_t.h, and wchar.h accordingly.
* Made stdio.h avoid gcc 2.95.3's fixincludes hack stdio_va_list
* Added gcc 2.95.3 headers to the repository. They are used instead of
  the headers of the gcc 2.95.3's we use to compile Haiku with. Should
  avoid build problems with the BeOS native compiler.

For sake of personal recreation you can rebuild the cross gcc 2.95.3,
but the only thing that changed is its header directory
(lib/gcc-lib/.../include), which isn't used anymore. Replacing it with
headers/build/gcc-2.95.3 should have the same effect as rebuilding, BTW.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24413 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-16 17:21:37 +00:00
Ingo Weinhold 0cfb40d0dc Define HUGE_VAL in <math.h> conditionally. That's what gcc's fixincludes
hack math_huge_val_ifndef does, anyway. We do it ourselves and remove
the therefore superfluous gcc math.h header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24412 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-16 16:39:06 +00:00
Ingo Weinhold d8ce64a27f Reverted r24406. If it builds, it doesn't always work as well. The
change resulted in "version mismatch between boot loader and kernel". So
apparently the size of some type changed unintentionally.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24408 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-15 19:23:05 +00:00
Ingo Weinhold 6191d9a8da * Removed our stddef.h. We don't need it, since gcc comes with one that
under Haiku overrides ours anyway.
* Adjusted size_t.h, wchar_t.h, wchar.h accordingly. This should fix the
  annoying "ssize_t redefined" warnings when compiling under Haiku.
* When building Haiku the gcc headers come first in the include
  search path now, as it should be. The respective TODO suggested that
  this might break the build depending on compiler version and host
  platform. I've tested with Linux gcc 2 and gcc 4, which work fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24406 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-15 18:41:46 +00:00
Ingo Weinhold 4eb3560949 * Added real, effective and saved set- user and group IDs to the team
structure. They are properly inherited and updated on
  fork(), load_image(), and exec().
* Implemented the get[e]{u,g}id(), set[[r]e]{u,g}id() family for real.
* getgroups() also calls the kernel now, but only returns the effective
  group ID. Supplementary groups support is still missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24359 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-11 17:12:02 +00:00
Jérôme Duval 6213408838 added search.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24091 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-24 13:41:01 +00:00
Jérôme Duval b3918e2f66 added SIZE_MAX to stdint.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24085 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-23 22:31:19 +00:00
Axel Dörfler 3a0782dc15 Added printf()/scanf() type definitions, courtesy of Curtis Wanner - thanks
a lot!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24039 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-21 00:08:03 +00:00
Axel Dörfler 392eb518d5 * Added gcvt() implementation - this fixes bug #1757.
* Added gcvt(), ecvt(), and fcvt() prototypes to stdlib.h - they are all
  marked legacy, but are still part of the POSIX standard, so we might want
  to implement them if the need arises.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-06 17:11:02 +00:00
Axel Dörfler a32a4683ff * Implemented flock() semantics to the advisory locking backend. Not tested
(must also compare to BSD; I've looked at their sources, but I might have
  missed something).
* Added sys/file.h and the flock() system call.
* common_fcntl() could forget to put back the file descriptor on some error
  conditions (I guess we should introduce and use a DescriptorGetter class).
* Cleaned up fcntl.h, moved the BSD extensions S_IREAD and S_IWRITE to
  sys/stat.h where they belong, and added the missing S_IEXEC to them.
* Added some more comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 15:37:31 +00:00
Axel Dörfler e5bc2a9e7a Added BSD extension vsyslog() - is also found on Linux.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23835 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 15:31:16 +00:00
Axel Dörfler b4fd412b3e * Added BSD's FD_COPY() macro (it's not POSIX, though).
* Some other minor improvements.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23826 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-02 17:32:01 +00:00
Jérôme Duval d2d6724788 added pthread_once() implementation and tests
there is still a TODO on an init race condition 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23076 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-12-07 21:02:59 +00:00
Jérôme Duval 4ff6af6d52 applied patch by kaliber
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-12-07 19:30:34 +00:00
Ryan Leavengood aaa10d6056 Added trunc to the math headers. I need this for JavaScriptCore. It is already
defined in libroot.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22949 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-18 16:54:48 +00:00
Ingo Weinhold f969977bc1 Patch by Vasilis Kaoutsis (modified by myself): Implemented sigset().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22947 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-18 16:39:18 +00:00
Ingo Weinhold 99ed286c94 Patch by Vasilis Kaoutsis: Implemented sigrelse().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22865 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-09 23:23:46 +00:00
Ingo Weinhold 0a1968cf8f Patch by Vasilis Kaoutsis: Implemented sighold().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22846 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-06 22:11:43 +00:00
Ingo Weinhold 7154471870 Removed inline versions of sigismember(), sigaddset(), and sigdelset(). They
weren't in sync with the non-inline version in libroot anymore, and aren't
really performance-critical anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22827 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-04 17:43:44 +00:00
Ingo Weinhold 74fa73bac6 Patch by Vasilis Kaoutsis: Implemented sigignore(). Small changes by myself.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22789 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-01 18:03:36 +00:00
François Revol 0e26d146ec tag warnings with M68K:
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22717 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-25 12:43:05 +00:00
François Revol 5d31dc1586 Grmbl, wrong type!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22708 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-25 01:45:09 +00:00
François Revol 2f6b2f8612 missing semi-colon.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22707 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-25 01:41:28 +00:00
François Revol 82a9fd6a48 Add m68k to the big endian family.
Remove DOS CR from some files.
Add setjmp stuff for m68k (unfinished).
Moved arch specific stuff out of signal.h to arch/<arch>/signal.h
Added m68k vreg for signal.h (unfinished).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22703 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-25 00:36:36 +00:00
Ingo Weinhold 6bd2f399e8 Patch by Vasilis Kaoutsis: Implemented killpg().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-24 13:49:42 +00:00