Blame view

buildroot/buildroot-2016.08.1/package/screen/0002-no-memcpy-fallback.patch 3.38 KB
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  From: Maarten ter Huurne <maarten@treewalker.org>
  Date: Sat, 13 Sep 2014 11:37:59 +0200
  Subject: Do not use memcpy as an alternative for bcopy/memmove
  
  The configure script runs a small test program to check whether
  memcpy can handle overlapping memory areas. However, it is not valid
  to conclude that if a single case of overlapping memory is handled
  correctly, all cases will be handled correctly.
  
  Since screen already has its own bcopy implementation as a fallback
  for the case that bcopy and memmove are unusable, removing the memcpy
  option should not break any systems.
  
  Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
  [Ricardo: rebase on top of 4.3.1]
  Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
  ---
   acconfig.h   |  3 +--
   configure.ac | 18 +-----------------
   os.h         |  8 ++------
   osdef.h.in   | 10 +---------
   4 files changed, 5 insertions(+), 34 deletions(-)
  
  diff --git a/acconfig.h b/acconfig.h
  index 2e46985..9b0b9d4 100644
  --- a/acconfig.h
  +++ b/acconfig.h
  @@ -476,7 +476,7 @@
   #undef GETTTYENT
   
   /*
  - * Define USEBCOPY if the bcopy/memcpy from your system's C library
  + * Define USEBCOPY if the bcopy from your system's C library
    * supports the overlapping of source and destination blocks.  When
    * undefined, screen uses its own (probably slower) version of bcopy().
    * 
  @@ -487,7 +487,6 @@
    * Their memove fails the test in the configure script. Sigh. (Juergen)
    */
   #undef USEBCOPY
  -#undef USEMEMCPY
   #undef USEMEMMOVE
   
   /*
  diff --git a/configure.ac b/configure.ac
  index 27690a6..b8e3bec 100644
  --- a/configure.ac
  +++ b/configure.ac
  @@ -1145,7 +1145,7 @@ AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
   AC_CHECKING(fdwalk)
   AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
   
  -AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
  +AC_CHECKING(whether memmove/bcopy handles overlapping arguments)
   AC_TRY_RUN([
   main() {
     char buf[10];
  @@ -1175,22 +1175,6 @@ main() {
     exit(0); /* libc version works properly.  */
   }], AC_DEFINE(USEMEMMOVE))
   
  -
  -AC_TRY_RUN([
  -#define bcopy(s,d,l) memcpy(d,s,l)
  -main() {
  -  char buf[10];
  -  strcpy(buf, "abcdefghi");
  -  bcopy(buf, buf + 2, 3);
  -  if (strncmp(buf, "ababcf", 6))
  -    exit(1);
  -  strcpy(buf, "abcdefghi");
  -  bcopy(buf + 2, buf, 3);
  -  if (strncmp(buf, "cdedef", 6))
  -    exit(1);
  -  exit(0); /* libc version works properly.  */
  -}], AC_DEFINE(USEMEMCPY))
  -
   AC_SYS_LONG_FILE_NAMES
   
   AC_MSG_CHECKING(for vsprintf)
  diff --git a/os.h b/os.h
  index e827ac9..0b41fb9 100644
  --- a/os.h
  +++ b/os.h
  @@ -142,12 +142,8 @@ extern int errno;
   # ifdef USEMEMMOVE
   #  define bcopy(s,d,len) memmove(d,s,len)
   # else
  -#  ifdef USEMEMCPY
  -#   define bcopy(s,d,len) memcpy(d,s,len)
  -#  else
  -#   define NEED_OWN_BCOPY
  -#   define bcopy xbcopy
  -#  endif
  +#  define NEED_OWN_BCOPY
  +#  define bcopy xbcopy
   # endif
   #endif
   
  diff --git a/osdef.h.in b/osdef.h.in
  index 8687b60..e4057a0 100644
  --- a/osdef.h.in
  +++ b/osdef.h.in
  @@ -58,16 +58,8 @@ extern int   bcmp __P((char *, char *, int));
   extern int   killpg __P((int, int));
   #endif
   
  -#ifndef USEBCOPY
  -# ifdef USEMEMCPY
  -extern void  memcpy __P((char *, char *, int));
  -# else
  -#  ifdef USEMEMMOVE
  +#if defined(USEMEMMOVE) && !defined(USEBCOPY)
   extern void  memmove __P((char *, char *, int));
  -#  else
  -extern void  bcopy __P((char *, char *, int));
  -#  endif
  -# endif
   #else
   extern void  bcopy __P((char *, char *, int));
   #endif
  -- 
  1.8.4.5