summaryrefslogtreecommitdiffstats
path: root/lib/libc/gmon/gmon.c
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-01-12 09:23:48 +0000
committerjasone <jasone@FreeBSD.org>2000-01-12 09:23:48 +0000
commit75903038bc52105bc7479fe5f2b75f22f10c1c50 (patch)
treec9e28eda650bbd7eaa3eb22c8d7c75d00a96a451 /lib/libc/gmon/gmon.c
parent688bb99b3f790aad607b949661d0361486bbe346 (diff)
downloadFreeBSD-src-75903038bc52105bc7479fe5f2b75f22f10c1c50.zip
FreeBSD-src-75903038bc52105bc7479fe5f2b75f22f10c1c50.tar.gz
Add three-tier symbol naming in support of POSIX thread cancellation
points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
Diffstat (limited to 'lib/libc/gmon/gmon.c')
-rw-r--r--lib/libc/gmon/gmon.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index 267a469..938cd02 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if !defined(lint) && defined(LIBC_SCCS)
@@ -60,7 +62,7 @@ static int s_scale;
/* see profil(2) where this is describe (incorrectly) */
#define SCALE_1_TO_1 0x10000L
-#define ERR(s) write(2, s, sizeof(s))
+#define ERR(s) _libc_write(2, s, sizeof(s))
void moncontrol __P((int));
static int hertz __P((void));
@@ -170,20 +172,20 @@ _mcleanup()
moncontrol(0);
snprintf(outname,sizeof(outname),"%s.gmon",__progname);
- fd = open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666);
+ fd = _libc_open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666);
if (fd < 0) {
warnx("_mcleanup: %s - %s",outname,strerror(errno));
return;
}
#ifdef DEBUG
- log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
+ log = _libc_open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
if (log < 0) {
perror("_mcleanup: gmon.log");
return;
}
len = sprintf(buf, "[mcleanup1] kcount 0x%x ssiz %d\n",
p->kcount, p->kcountsize);
- write(log, buf, len);
+ _libc_write(log, buf, len);
#endif
hdr = (struct gmonhdr *)&gmonhdr;
hdr->lpc = p->lowpc;
@@ -191,8 +193,8 @@ _mcleanup()
hdr->ncnt = p->kcountsize + sizeof(gmonhdr);
hdr->version = GMONVERSION;
hdr->profrate = clockinfo.profhz;
- write(fd, (char *)hdr, sizeof *hdr);
- write(fd, p->kcount, p->kcountsize);
+ _libc_write(fd, (char *)hdr, sizeof *hdr);
+ _libc_write(fd, p->kcount, p->kcountsize);
endfrom = p->fromssize / sizeof(*p->froms);
for (fromindex = 0; fromindex < endfrom; fromindex++) {
if (p->froms[fromindex] == 0)
@@ -207,15 +209,15 @@ _mcleanup()
"[mcleanup2] frompc 0x%x selfpc 0x%x count %d\n" ,
frompc, p->tos[toindex].selfpc,
p->tos[toindex].count);
- write(log, buf, len);
+ _libc_write(log, buf, len);
#endif
rawarc.raw_frompc = frompc;
rawarc.raw_selfpc = p->tos[toindex].selfpc;
rawarc.raw_count = p->tos[toindex].count;
- write(fd, &rawarc, sizeof rawarc);
+ _libc_write(fd, &rawarc, sizeof rawarc);
}
}
- close(fd);
+ _libc_close(fd);
}
/*
OpenPOWER on IntegriCloud