~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_write.cc

  • Committer: Brian Aker
  • Date: 2010-01-27 18:58:12 UTC
  • Revision ID: brian@gaz-20100127185812-n62n0vwetnx8jrjy
Remove dead code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "mysys_priv.h"
17
 
#include "mysys_err.h"
 
16
#include "drizzled/internal/mysys_priv.h"
 
17
#include "drizzled/my_error.h"
18
18
#include <errno.h>
19
19
 
20
20
 
21
21
        /* Write a chunk of bytes to a file */
22
22
 
23
 
size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
 
23
size_t my_write(int Filedes, const unsigned char *Buffer, size_t Count, myf MyFlags)
24
24
{
25
25
  size_t writenbytes, written;
26
 
  uint errors;
 
26
  uint32_t errors;
27
27
  errors=0; written=0;
28
28
 
29
29
  /* The behavior of write(fd, buf, 0) is not portable */
30
30
  if (unlikely(!Count))
31
31
    return(0);
32
 
  
 
32
 
33
33
  for (;;)
34
34
  {
35
35
    if ((writenbytes= write(Filedes, Buffer, Count)) == Count)
40
40
      Buffer+=writenbytes;
41
41
      Count-=writenbytes;
42
42
    }
43
 
    my_errno=errno;
 
43
    errno=errno;
44
44
#ifndef NO_BACKGROUND
45
45
    if (my_thread_var->abort)
46
46
      MyFlags&= ~ MY_WAIT_IF_FULL;              /* End if aborted by user */
47
 
    if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
 
47
    if ((errno == ENOSPC || errno == EDQUOT) &&
48
48
        (MyFlags & MY_WAIT_IF_FULL))
49
49
    {
50
50
      if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
51
51
        my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
52
 
                 my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
53
 
      VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
 
52
                 "unknown", errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
 
53
      sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
54
54
      continue;
55
55
    }
56
56
 
57
57
    if ((writenbytes == 0 || writenbytes == (size_t) -1))
58
58
    {
59
 
      if (my_errno == EINTR)
 
59
      if (errno == EINTR)
60
60
      {
61
61
        continue;                               /* Interrupted */
62
62
      }
76
76
      if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
77
77
      {
78
78
        my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
79
 
                 my_filename(Filedes),my_errno);
 
79
                 "unknown", errno);
80
80
      }
81
81
      return(MY_FILE_ERROR);            /* Error on read */
82
82
    }