diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-10-07 07:25:16 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-10-07 07:25:16 +0000 |
commit | cab30d75a34782ea5ea0017238022da77494ce5f (patch) | |
tree | 10eebf50e77621744fefe2b8f69e2139a5d5acf5 /debug/pcprofile.c | |
parent | 42d7c593143c868dfce28182a34b10f8c9cf4e86 (diff) | |
download | glibc-cab30d75a34782ea5ea0017238022da77494ce5f.tar.gz glibc-cab30d75a34782ea5ea0017238022da77494ce5f.tar.xz glibc-cab30d75a34782ea5ea0017238022da77494ce5f.zip |
Update.
1999-10-07 Ulrich Drepper <drepper@cygnus.com> * debug/Makefile (install-bin): Add pcprofiledump and xtrace. Add rules for both programs. * debug/pcprofiledump.c: New file. * debug/xtrace.sh: New file. * debug/pcprofile.c: Allow creating output file. Add magic signature to let reader recognize file format.
Diffstat (limited to 'debug/pcprofile.c')
-rw-r--r-- | debug/pcprofile.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/debug/pcprofile.c b/debug/pcprofile.c index b5dc4e709c..11447deb7d 100644 --- a/debug/pcprofile.c +++ b/debug/pcprofile.c @@ -18,7 +18,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <errno.h> #include <fcntl.h> +#include <stdint.h> #include <stdlib.h> #include <unistd.h> @@ -39,10 +41,25 @@ install (void) if (outfile != NULL && *outfile != '\0') { - fd = open (outfile, O_RDWR); + fd = open (outfile, O_RDWR | O_CREAT, 0666); if (fd != -1) - active = 1; + { + uint32_t word; + + active = 1; + + /* Write a magic word which tells the reader about the byte + order and the size of the following entries. */ + word = 0xdeb00000 | sizeof (void *); + if (TEMP_FAILURE_RETRY (write (fd, &word, 4)) != 4) + { + /* If even this fails we shouldn't try further. */ + close (fd); + fd = -1; + active = 0; + } + } } } |