1. 28 Dec, 2007 1 commit
    • Eric Wong's avatar
      Merge branches/ew r7104 · b79f6b88
      Eric Wong authored
      thread-safety work in preparation for rewrite to use pthreads
      
      Expect no regressions against trunk (r7078), possibly minor
      performance improvements in update (due to fewer heap
      allocations), but increased stack usage.
      
      Applied the following patches:
      
      * maxpath_str for reentrancy (temporary fix, reverted)
      * path: start working on thread-safe variants of these methods
      * Re-entrancy work on path/character-set conversions
      * directory.c: exploreDirectory() use reentrant functions here
      * directory/update: more use of reentrant functions + cleanups
      * string_toupper: a strdup-less version of strDupToUpper
      * get_song_url: a static-variable-free version of getSongUrl()
      * Use reentrant/thread-safe get_song_url everywhere
      * replace rmp2amp with the reentrant version, rmp2amp_r
      * Get rid of the non-reentrant/non-thread-safe rpp2app, too.
      * buffer2array: assert strdup() returns a usable value in unit tests
      * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants
      * fix storing playlists w/o absolute paths
      * parent_path(), a reentrant version of parentPath()
      * parentPath => parent_path for reentrancy and thread-safety
      * allow "make test" to automatically run embedded unit tests
      * remove convStrDup() and maxpath_str()
      * use MPD_PATH_MAX everywhere instead of MAXPATHLEN
      * path: get rid of appendSlash, pfx_path and just use pfx_dir
      * get_song_url: fix the ability to play songs in the top-level music_directory
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      b79f6b88
  2. 08 Sep, 2007 1 commit
  3. 06 Sep, 2007 3 commits
  4. 27 Aug, 2007 2 commits
    • J. Alexander Treuman's avatar
      removing debug messages from signal handlers · 1b045d06
      J. Alexander Treuman authored
      As unfortunate as it is to remove such useful debugging messages, it's
      necessary to fix a potential deadlock with signal handling.  A bunch of
      functions the debug functions call aren't safe to call from a signal
      handler.  There are some alternate solutions, but they're neither pretty
      nor simple.  So just remove them entirely for now.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@6828 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      1b045d06
    • Eric Wong's avatar
      send SIGSTOP to player and decoder processes on pause, too · f18e5241
      Eric Wong authored
      as with the stop command, this will cause the player and decoder
      to suspend and not wake up hundreds of times a second to poll
      a variable for wakeup.  This will reduce power consumption
      on some CPUs while mpd is paused and not playing.
      
      tests:
      
      pause && unpause => OK
      
      pause && stop && play => OK
      
      pause && exit && restart w/statefile && unpause => OK
      
      pause && block sound device && \
      unpause => failed to open sound device \
      => still paused and suspended => unblock sound device &&
      unpause => OK (playing)
      
      In all cases, the player process releases the audio device
      when paused before going into the suspended state.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@6822 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      f18e5241
  5. 04 Jun, 2007 2 commits
  6. 01 Jun, 2007 2 commits
  7. 05 Apr, 2007 1 commit
  8. 19 Feb, 2007 1 commit
  9. 11 Feb, 2007 1 commit
  10. 14 Jan, 2007 1 commit
  11. 26 Aug, 2006 1 commit
    • Eric Wong's avatar
      Replace strdup and {c,re,m}alloc with x* variants to check for OOM errors · 90847fc8
      Eric Wong authored
      I'm checking for zero-size allocations and assert()-ing them,
      so we can more easily get backtraces and debug problems, but we'll
      also allow -DNDEBUG people to live on the edge if they wish.
      
      We do not rely on errno when checking for OOM errors because
      some implementations of malloc do not set it, and malloc
      is commonly overridden by userspace wrappers.
      
      I've spent some time looking through the source and didn't find any
      obvious places where we would explicitly allocate 0 bytes, so we
      shouldn't trip any of those assertions.
      
      We also avoid allocating zero bytes because C libraries don't
      handle this consistently (some return NULL, some not); and it's
      dangerous either way.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      90847fc8
  12. 20 Aug, 2006 1 commit
  13. 14 Aug, 2006 1 commit
    • Eric Wong's avatar
      Several bugfixes during exit found by valgrind · e5df85db
      Eric Wong authored
      First, make sure we call finishPlaylist() before
      closeMp3Directory() since the latter will free non-SONG_TYPE_URL
      songs in playlist, which causes an invalid read when we try to
      look for SONG_TYPE_URL songs to free in finishPlaylist.
      
      Secondly, make sure our children have all exited before freeing
      the playerData.  If we do not, slowly-delivered signals can
      trigger a race condition in the signal handlers of the decode
      and player processes which rely on getPlayerData.  To avoid
      waitpid-ing too long (or at all), move the freePlayerData() call
      farther down in main() (this won't affect anything else)
      to give the OS a better chance to deliver signals and finish running
      sig handlers for terminated children.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4640 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      e5df85db
  14. 11 Aug, 2006 1 commit
  15. 08 Aug, 2006 1 commit
    • Eric Wong's avatar
      more sparse cleanups · f7d150a3
      Eric Wong authored
      * less-commonly compiled things like ao/mvp outputs
      * Adding -Wno-transparent-union to SPARSE_FLAGS makes it check
      inside decode.c, directory.c, player.c, and sig_handlers.c
      * remove unused variables leftover from the master process
      in sig_handlers.c
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4598 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      f7d150a3
  16. 06 Aug, 2006 1 commit
  17. 01 Aug, 2006 1 commit
    • Eric Wong's avatar
      logging cleanups · 89073cfb
      Eric Wong authored
      * Moved all logging-related stuff into log.c
      (and not myfprintf.c)
      
      * ISO C90-compliant strftime usage:
      %e and %R replaced with %d and %H:%M respectively
      
      * Got rid of variadic macros since some old-school compilers
      don't like them
      
      * compiling with -DNDEBUG disables the DEBUG() macro
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4512 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      89073cfb
  18. 30 Jul, 2006 3 commits
    • Eric Wong's avatar
      remove clumsy strncpy use · 263a9d58
      Eric Wong authored
      strncpy isn't really safe because it doesn't guarantee null termination,
      and we have had to work around it in several places.
      strlcpy (from OpenBSD) isn't great, either because it often leaves
      errors going unchecked (by truncating strings).
      
      So we'll add the pathcpy_trunc() function with is basically strlcpy
      with a hardcoded MAXPATHLEN as the limit, and we'll acknowledge
      truncation since we only work on paths and MAXPATHLEN should be
      set correctly by the system headers[1].
      
      file-specific notes:
      
      inputStream_http:
      eyeballing the changes here, it seems to look alright but I
      haven't actually tested it myself.
      
      ls:
      don't even bother printing a file if the filename is too long
      (and when is it ever?) since we won't be able to read it anyways.
      
      metadataChunk:
      it's only metadata, and it's only for showin the user, so truncating
      it here souldn't be a big issue.
      memset to zero in init is unecessary, so lets not waste cycles
      
      [1] - If the system headers are screwed up, then we're majorly
      screwed regardless of what we do :x
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4491 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      263a9d58
    • Eric Wong's avatar
      commandError() cleanups, fixup gcc checks · e86fd65c
      Eric Wong authored
      stripped binary size reduced by 9k on my machine from making
      commandError a function.  We'll print out error messages slightly
      slower before, but the smaller binary is more than worth it.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      e86fd65c
    • Eric Wong's avatar
      interface/connection malloc reductions from mpd-ke · 4cf5d04c
      Eric Wong authored
      This patch massively reduces the amount of heap allocations at
      the interface/command layer.  Most commands with minimal output
      should not allocate memory from the heap at all.  Things like
      repeatedly polling status, currentsong, and volume changes
      should be faster as a result, and more importantly, not a source
      of memory fragmentation.
      
      These changes should be safe in that there's no way for a
      remote-client to corrupt memory or otherwise do bad stuff to
      MPD, but an extra set of eyes to review would be good.  Of
      course there's never any warranty :)
      
      No longer do we use FILE * structures in the interface, which means
      we don't have to allocate any new memory for most connections.
      
      Now, before you go on about losing the buffering that FILE *
      +implies+, remember that myfprintf() never took advantage of
      any of the stdio buffering features.
      
      To reduce the diff and make bugs easier to spot in the diff,
      I've kept myfprintf in places where we write to files (and not
      network interfaces).  Expect myfprintf to go away entirely soon
      (we'll use fprintf for writing regular files).
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      4cf5d04c
  19. 20 Jul, 2006 1 commit
  20. 14 Jul, 2006 3 commits
  21. 13 Jul, 2006 1 commit
  22. 19 Nov, 2005 1 commit
  23. 16 Nov, 2005 1 commit
  24. 11 Nov, 2004 1 commit
  25. 10 Nov, 2004 1 commit
  26. 03 Nov, 2004 2 commits
  27. 25 Oct, 2004 1 commit
  28. 29 Jun, 2004 1 commit
  29. 15 Jun, 2004 1 commit
  30. 09 Jun, 2004 1 commit