~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_read.cc

  • Committer: Stewart Smith
  • Date: 2009-10-08 11:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 1179.
  • Revision ID: stewart@flamingspork.com-20091008111147-pd951xqprru7hz3y
make mysql_parse static to sql_parse.cc

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 "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
#include "drizzled/error.h"
 
16
#include "mysys/mysys_priv.h"
 
17
#include "mysys/mysys_err.h"
20
18
#include <errno.h>
21
19
 
22
 
namespace drizzled
23
 
{
24
 
namespace internal
25
 
{
26
 
 
27
20
 
28
21
/*
29
22
  Read a chunk of bytes from a file with retry's if needed
40
33
      N  number of bytes read.
41
34
*/
42
35
 
43
 
size_t my_read(int Filedes, unsigned char *Buffer, size_t Count, myf MyFlags)
 
36
size_t my_read(File Filedes, unsigned char *Buffer, size_t Count, myf MyFlags)
44
37
{
45
38
  size_t readbytes, save_count;
46
39
  save_count= Count;
50
43
    errno= 0;                                   /* Linux doesn't reset this */
51
44
    if ((readbytes= read(Filedes, Buffer, Count)) != Count)
52
45
    {
53
 
      errno= errno ? errno : -1;
 
46
      my_errno= errno ? errno : -1;
54
47
      if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
55
48
      {
56
49
        continue;                              /* Interrupted */
59
52
      {
60
53
        if (readbytes == (size_t) -1)
61
54
          my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
62
 
                   "unknown", errno);
 
55
                   "unknown", my_errno);
63
56
        else if (MyFlags & (MY_NABP | MY_FNABP))
64
57
          my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
65
 
                   "unknown", errno);
 
58
                   "unknown", my_errno);
66
59
      }
67
60
      if (readbytes == (size_t) -1 ||
68
61
          ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
83
76
  }
84
77
  return(readbytes);
85
78
} /* my_read */
86
 
 
87
 
} /* namespace internal */
88
 
} /* namespace drizzled */