Page MenuHomeFreeBSD

D33411.id100136.diff
No OneTemporary

D33411.id100136.diff

diff --git a/stand/common/commands.c b/stand/common/commands.c
--- a/stand/common/commands.c
+++ b/stand/common/commands.c
@@ -545,3 +545,34 @@
pager_close();
return (CMD_OK);
}
+
+static int
+command_readtest(int argc, char *argv[])
+{
+ int fd;
+ time_t start, end;
+ char buf[512];
+ ssize_t rv, count = 0;
+
+ if (argc != 2) {
+ snprintf(command_errbuf, sizeof(command_errbuf),
+ "Usage: readtest <filename>");
+ return (CMD_ERROR);
+ }
+
+ start = getsecs();
+ if ((fd = open(argv[1], O_RDONLY)) < 0) {
+ snprintf(command_errbuf, sizeof(command_errbuf),
+ "can't open '%s'", argv[1]);
+ return (CMD_ERROR);
+ }
+ while ((rv = read(fd, buf, sizeof(buf))) > 0)
+ count += rv;
+ end = getsecs();
+
+ printf("Received %zd bytes during %jd seconds\n", count, (intmax_t)end - start);
+ close(fd);
+ return (CMD_OK);
+}
+
+COMMAND_SET(readtest, "readtest", "Time a file read", command_readtest);
diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c
--- a/stand/libsa/tftp.c
+++ b/stand/libsa/tftp.c
@@ -55,6 +55,7 @@
#include <string.h>
+#include <bootstrap.h>
#include "stand.h"
#include "net.h"
#include "netif.h"

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 4, 12:21 AM (11 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16957000
Default Alt Text
D33411.id100136.diff (1 KB)

Event Timeline