#!/usr/bin/env perl use strict; use warnings; use Config; if (@ARGV < 2) { die "Usage: $0 \n"; } sub gettime { my ($sec, $usec); eval { require Time::HiRes; ($sec, $usec) = Time::HiRes::gettimeofday(); }; unless (defined($sec) && defined($usec)) { my $tv_t = ($Config{'longsize'} == 8) ? 'qq' : 'll'; my $tv = pack $tv_t, 0, 0; eval { require 'syscall.ph'; syscall(SYS_gettimeofday(), $tv, 0); }; ($sec, $usec) = unpack $tv_t, $tv; } return ($sec, $usec); } my ($prefix, @cmd) = @ARGV; my ($sec, $usec) = gettime(); my $pid = fork(); if (!defined($pid)) { die "$0: Failure to fork(): $!\n"; } elsif ($pid == 0) { exec(@cmd); die "$0: Failure to exec(): $!\n"; } else { $SIG{'INT'} = 'IGNORE'; $SIG{'QUIT'} = 'IGNORE'; if (waitpid($pid, 0) == -1) { die "$0: Failure to waitpid(): $!\n"; } my $exitcode = $? >> 8; my ($sec2, $usec2) = gettime(); my (undef, undef, $cuser, $csystem) = times(); printf STDOUT "%s#%.2f#%.2f#%.2f\n", $prefix, $cuser, $csystem, ($sec2 - $sec) + ($usec2 - $usec) / 1000000; $SIG{'INT'} = 'DEFAULT'; $SIG{'QUIT'} = 'DEFAULT'; exit $exitcode; } [no description]
aboutsummaryrefslogtreecommitdiffstats
blob: 44775039d5b37a05252fcfa593cb855f8d67afea (plain)
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
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef BOOTLOADER_H
#define BOOTLOADER_H


/* give code for your bootloader to come up if needed */
void bootloader_jump(void);

#endif