Commit Graph

24069 Commits

Author SHA1 Message Date
François Revol
0ddd7ea66e Some more ioctls...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25282 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 21:59:46 +00:00
Ingo Weinhold
9e518ee91d Also hold the threads lock when removing a team from the team hash
table. This is not necessary, but allows for a better solution fo how to
lock the IO context of another team.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 21:53:12 +00:00
Ingo Weinhold
ee96aa8f6e * Replaced cutex::release_count by flags field. It is only one thread
that can unlock the mutex, so one bit is sufficient.
* Added cutex_init_etc() which has an additional "flags" parameter.
  The only specifyable flag is CUTEX_FLAG_CLONE_NAME, which causes the
  function to strdup() the given name and free() its copy in
  cutex_destroy().
* cutex_destroy() does now unblock waiting threads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25280 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 18:06:09 +00:00
Ingo Weinhold
2988eab3dc Added support for option '-L' (always dereference symbolic links).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25279 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 12:43:29 +00:00
Axel Dörfler
63368af591 * As Ingo pointed out to me earlier, TCP could now delete its socket too early
when using the shutdown() command.
* If TCP no longer needs a socket, it will now set the flag FLAG_DELETE_ON_CLOSE;
  when the socket is closed from the upper layers, it will set the FLAG_CLOSED
  flag - and only if both are set, TCP will now delete the socket itself on
  receive.
* This fixes bug #2189.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25278 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 11:44:19 +00:00
Ingo Weinhold
184de764fe Replaced the vm_cache mutex by a cutex. This should save quite a few
semaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25277 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 01:59:09 +00:00
Ingo Weinhold
8562499f44 * Introduced a new locking primitive I called "cutex" (sorry for the
name, couldn't resist :-P). It's semantically equivalent to a mutex,
  but doesn't need a semaphore (it uses thread blocking and a simple
  queue instead). Initialization can't fail. In fact it is ready to use
  without initialization when living in the bss segment, also in the
  early boot process. It's as fast as a benaphore in cases of low lock
  contention, and faster otherwise.  Only disadvantage is the higher
  immediate memory footprint of 16 bytes.
* Changed how the "thread" and "threads" debugger commands list the
  objects they are waiting for. Cutexes are also included.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 01:53:07 +00:00
Ingo Weinhold
4e6b38af6c Following Axel's suggestions:
* Added data_node::flags field and currently only flag
  DATA_NODE_READ_ONLY, indicating that the node is read-only (i.e.
  a clone). If set, the node won't have any header or tail space. Not
  being able to write to it is not yet enforced, though.
* Moved data_node::tail_space to data_header.
* Removed data_node:used_header_space/own_header_space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25275 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 18:47:11 +00:00
Ingo Weinhold
8e671b34c2 Introduced kernel tracing in wait_for_objects.cpp (in r25273), ATM only
for select(), though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25274 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 16:14:42 +00:00
Ingo Weinhold
514fb1360b * Removed select_sync::lock. The only thread that was still locking was
the selecting thread, which has obviously no effect.
* Changed select_info::events to vint32. It is now updated atomically.
  This removes a race condition when concurrent threads would notify at
  the same time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25273 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 16:12:20 +00:00
Axel Dörfler
a1e3e17d35 * Added 24-bit mode support.
* This fixes bug #2182.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25272 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 16:07:25 +00:00
Ingo Weinhold
503912f733 Fixed the case that a file to be created non-exclusively is a symlink
(bug #2183).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25271 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 14:21:02 +00:00
Axel Dörfler
ec12806d2f Reverted r25258 - I didn't know that an undefined value defaults to 0.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25270 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 08:03:53 +00:00
Ryan Leavengood
6aede71c0c Resolve a TODO and fix another ancient bug, #386. Print Screen is now handled
by BWindow, no longer by the app_server. This should stop the "screen freeze"
effect.

This adds a dependency on libpng.so and libz.so to libbe.so. The same
dependencies and the PNGDump code added here can be removed from the
app_server. I am just waiting for a code review of this before doing that.

This implementation still does not give the client a chance to handle it
differently.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25269 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 02:55:15 +00:00
Ingo Weinhold
2428097297 Removed superfluous uint32 ref parameter from select() FS hook.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25268 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 00:06:17 +00:00
Ryan Leavengood
85a4868f71 Future proofing, make sure we get the screen this window is in.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 23:55:55 +00:00
Ingo Weinhold
9981c81f8b Fixed a race condition between select_fd() and close(). Since
select_fd() first added the select info to the IO context and then
called select() on the descriptor, a close() called at the same time
could already deselect the events and close the descriptor before
select_fd() was done with select(). select_fd() does now keep an own
open reference while selecting the events and add the select info
afterwards to the IO context (if the FD is still current).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25266 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 23:54:35 +00:00
Ingo Weinhold
e9488bd9e6 * Removed bogus select notifications in socket_close(). This is really
not necessary, since the VFS makes sure (or should at least) that all
  events are deselected when close() is called. ~0 isn't a valid event
  anyway.
* Removed delete_select_sync_pool() in socket_free(). It's not
  necessary, since the select_sync_pool is auto-destroyed when the last
  event has been deselected (which the VFS should take care of).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25265 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 23:09:54 +00:00
Axel Dörfler
5b90e47b18 The "arp" command now supports flushing all temporary entries using the new
-F option.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25264 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 22:07:06 +00:00
Axel Dörfler
801591dbde * Added an atomic_pointer_set() template function to util/atomic.h.
* Made the pointers const.
* Changed how the ARP module maintains its arp_entry::request_buffer: it
  now uses the atomic_pointer*() functions to make sure there is no race
  condition, and it's deleted only once.
* Getting an ARP entry would return uninitialized data, if the entry hadn't
  been resolved yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25263 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 22:03:03 +00:00
Ingo Weinhold
67e2e88213 Added a section to the select() hook documentation discussing the FSs
responsibility never to call notify_select_event() after deselect().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25262 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 21:52:30 +00:00
Jérôme Duval
e6b421a98e fix misuse of ... with B_UTF8_ELLIPSIS
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25261 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 21:48:36 +00:00
Axel Dörfler
b1d749f8f1 * Added an atomic.h header that provides a C++ file with a templatized
64-bit safe version of atomic_test_and_set() for pointers:
  atomic_pointer_test_and_set().
* The VFS is now using this function (it's not used anywhere else in the
  kernel this way).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25260 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 21:05:05 +00:00
Ingo Weinhold
8e4941e810 Forgot this one: Stack trace depth macro for net_buffer tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25259 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 20:47:15 +00:00
Axel Dörfler
6ad0d967f0 Fixed build when ENABLE_TRACING is 0.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25258 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 20:43:34 +00:00
Axel Dörfler
c0b5962cd6 * Removed unused function benaphore_lock_etc(). A timeout is not really a
good idea for a benaphore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25257 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 20:20:36 +00:00
Ingo Weinhold
0b69689a18 * Fixed free_data_header_space(). It would increase the header space
although it put the freed space in the free list. Alternating
  invocations of alloc_...() and free_...() would thus increase the
  header space unboundedly.
* Unified the way a data_header and data_node access the header space.
  Originally data_header::data_space and data_node::header_space had to
  be kept in sync, which some functions failed to do. Introduced a
  header_space structure, which is located in data_header and referenced
  by data_node, so that accessing it either way does always keep both
  structures in sync.
* Removed the special handling for the data node created with a buffer.
  Since remove_{header,trailer}() and trim() could remove it without
  knowing, the last reference to the first data header would be freed
  prematurely, causing operations on freed memory, and in the end a
  second free which screwed the object cache's free list. This crashed
  Haiku e.g. when running OpenSSH's "forwarding" test. Now the first
  created node is just a node like any other. It's allocated in the data
  header, too.
* Changed the mechanism how data nodes are allocated. Now they will
  always be allocated on a header associated with the buffer for which
  they are created. This fixes a race condition when freeing them. They
  would otherwise modify the free list of a header which might be
  accessed by another thread at the same time (added a TODO explaining
  how the old code could possibly be fixed). Also squashed several
  TODOs related to running out of header space when allocating a node.
  If the buffer runs out of header space, it will simply allocate a new
  header, now.
* Dealt with some TODOs regarding reverting the buffer to its previous
  state when running out of memory after allocating a few nodes.
* Added several TODOs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25256 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 19:49:43 +00:00
Axel Dörfler
c16d05cff9 * steal_page() called remove_page_from_queue() without holding the sPageLock.
This fixes bug #1900 for real.
* Rearranged find_page_candidate() a bit, removed duplicate code, added a panic
  in case the marker state is invalid.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25255 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 19:45:13 +00:00
Ingo Weinhold
d96c90096f Added a simple net_buffer implementation (using a single malloc()ed
buffer) for debugging/testing purposes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25254 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 19:05:50 +00:00
Ingo Weinhold
0e8836d284 Fixed build for paranoia disabled globally, but enabled for individual
components.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25253 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 18:42:31 +00:00
Ingo Weinhold
e81ddd2870 Partial solution to a race condition between arp_timer() and
arp_update_entry(). While arp_timer() was sending the last request
arp_update_entry() could be called (caused by an incoming reply) and
free the request buffer, which arp_timer() would free a moment later
again. The problem is not completely solved, since a duplicate reply can
still cause a double free. Checked in mainly for Axel's reading
pleasure. :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25252 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 17:15:43 +00:00
Axel Dörfler
bbc25eb650 * Renamed temporary KDL variable from _cookie to _volume in the "mount"
command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25251 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 16:49:14 +00:00
Axel Dörfler
0b51ee4efd * The page writer was calling remove_page_marker() without holding the
sPageLock. This could easily mess up the page queue.
* Now, remove_page_marker() gets the lock itself. This fixes bug #1900.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25250 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 16:48:27 +00:00
Axel Dörfler
8e8edffce7 * Fixed at least the "dd" part of bug #2148: the second double indirect array
block would be incorrectly addressed when allocating a stream - this could
  cause random blocks to be overwritten, and therefore could cause many sorts
  of problems.
* Moved BFS_TRACING macro to the tracing_config.h file, and let it follow the
  new semantics of those other macros in there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25249 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 16:15:35 +00:00
Axel Dörfler
e7ad26598a * The "bfs" KDL command can now also convert block offsets to block_runs and
vice versa.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 16:08:42 +00:00
Axel Dörfler
76824051fd * Only enable block/transaction tracing when the macro is 1.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25247 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 14:57:56 +00:00
Axel Dörfler
18df7df8f7 * Followed Ingo's suggestion, and retricted sending SIGPIPE only to userland
API clients.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 14:01:46 +00:00
Axel Dörfler
8e0a418b70 * Implemented sending of urgent data. Seems to work fine, but of course only
if the other end is not a Haiku host (retrieving of urgent data is still
  missing).
* Resolved TODO: SendData() now sends a SIGPIPE when trying to send on a
  closed connection.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25245 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 12:42:50 +00:00
Stephan Aßmus
f466d35d9c Rewrote parts related to drawing the labels. The order of drawing happens as
this (seems to be what R5 BStatusBar does):
* combine the "trailing text" with the "trailing label" and truncate the
  resulting string on the left side according to the width of the entire
  control
* combine the "label" with the "text" and truncate that on the right side
  according to the space left by the right hand text.

-> No more overlaps (theoretically, in practise there are still overlaps
  because our BFont::TruncateString() does not respect the width in some
  situations.)

* Changed _SetTextData() accordingly, it is not used anymore for the
  label and trailing label, and could therefor be simplified a little.
* fixed _BarFrame() to not return fractional coords, which could sometimes
  leave a dirty line of pixels.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 12:42:10 +00:00
Axel Dörfler
63cf342664 * tcp_header::urgent_offset must be set in network byte order as well.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 12:31:57 +00:00
Axel Dörfler
b18927737f * Added the "sock" test application (as used in Steven's TCP Illustrated) to
our repository, and integrated it to the build system.
* Got it from: http://www.icir.org/christian/sock.html (sock-0.3).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 09:30:29 +00:00
Axel Dörfler
895d7215fb * Added TCPEndpoint::GetOption(), currently only supports TCP_NODELAY, and
TCP_MAXSEG.
* Note, TCP_MAXSEG cannot be set yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25241 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 09:26:24 +00:00
Axel Dörfler
6289578982 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25240 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 08:46:01 +00:00
Axel Dörfler
ae33c41ea8 * For local connections, we no longer use the TIME_WAIT state; in this case,
we know that the connection was torn down cleanly, and there are no inflight
  segments floating around anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 08:39:08 +00:00
Axel Dörfler
cd2bea0cd2 * Closed endpoints are now deleted directly, they no longer get into the
2MSL wait.
* Accidently left on debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25238 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 08:28:36 +00:00
Axel Dörfler
66cb8f0ede * Use dprintf_no_syslog() for FLOW and everything in scsi2ata.c - this prevents
endless writing to the syslog.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 08:11:43 +00:00
Axel Dörfler
0cadc931d2 * TIME_WAIT endpoints must not send an acknowledgement for known data; this
fixes the "endless discussions" when closing a local connection - only
  happened on a simultaneous close.
* A FIN in TIME_WAIT now updates the time-wait timer, as required by the
  TCP specification.
* Entering TIME_WAIT now cancels all connection timers. We might want to
  think about putting time wait connections into a separate hash, and delete
  the socket early on.
* Added tracing support for send/receive, timers, and state changes.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25236 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 07:39:58 +00:00
Axel Dörfler
5abeea69a5 * Added tracing for binds and connects as well.
* Introduced the TCP_TRACING macro in tracing_config.h.
* Enlarged the default trace size to something a tiny bit useful (but still
  acceptable for systems with little RAM).
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25235 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 07:35:00 +00:00
Ryan Leavengood
ef13436f1f Fix for #676, an oldie (from 2 years ago): if the MediaPlayer window is moved
off the screen at all, it will be moved back on when the window is activated.

I almost think this might be a reasonable default implementation for
WindowActivated in BWindow :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25234 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 03:37:41 +00:00
Ingo Weinhold
a1587d16d5 Ctrl-L clears the KDL screen.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 01:24:41 +00:00