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
|
Index: b/usr/src/head/string.h
===================================================================
--- a/usr/src/head/string.h 2014-03-02 23:23:14.072577470 +0400
+++ b/usr/src/head/string.h 2014-03-02 23:23:35.767723294 +0400
@@ -126,6 +126,7 @@
#if defined(__EXTENSIONS__) || defined(_GNU_SOURCE)
#define __mempcpy mempcpy
extern void *mempcpy(void *, const void *, size_t);
+extern void *memrchr(const void *, int, size_t);
#endif
#if defined(__EXTENSIONS__) || \
Index: b/usr/src/lib/libc/amd64/Makefile
===================================================================
--- a/usr/src/lib/libc/amd64/Makefile 2014-03-02 23:23:28.527980233 +0400
+++ b/usr/src/lib/libc/amd64/Makefile 2014-03-02 23:23:35.771315039 +0400
@@ -448,6 +448,7 @@
memalign.o \
memmem.o \
mempcpy.o \
+ memrchr.o \
mkdev.o \
mkdtemp.o \
mkfifo.o \
Index: b/usr/src/lib/libc/i386/Makefile.com
===================================================================
--- a/usr/src/lib/libc/i386/Makefile.com 2014-03-02 23:23:28.530105789 +0400
+++ b/usr/src/lib/libc/i386/Makefile.com 2014-03-02 23:23:35.774056030 +0400
@@ -479,6 +479,7 @@
memalign.o \
memmem.o \
mempcpy.o \
+ memrchr.o \
mkdev.o \
mkdtemp.o \
mkfifo.o \
Index: b/usr/src/lib/libc/port/mapfile-vers
===================================================================
--- a/usr/src/lib/libc/port/mapfile-vers 2014-03-02 23:23:28.533322797 +0400
+++ b/usr/src/lib/libc/port/mapfile-vers 2014-03-02 23:23:35.777427998 +0400
@@ -134,6 +134,7 @@
error_print_progname;
flock;
mempcpy;
+ memrchr;
program_invocation_name;
program_invocation_short_name;
} ILLUMOS_0.3;
Index: b/usr/src/lib/libc/port/gen/memrchr.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ b/usr/src/lib/libc/port/gen/memrchr.c 2014-03-02 23:23:35.779333256 +0400
@@ -0,0 +1,18 @@
+#include<string.h>
+
+void *memrchr(const void *s, int c, size_t n)
+{
+ const unsigned char *p;
+ unsigned char cc;
+
+ if (n) {
+ cc = (unsigned char) c;
+ p = (unsigned char *)s + n;
+
+ while (n--) {
+ if (*(--p) == cc)
+ return (void *)p;
+ }
+ }
+ return NULL;
+}
|