vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / accelerants / nvidia / engine / nv_support.c
blobaa4fdaca7bee5b328a426137c657721e02a44d47
1 /* Some commmon support functions */
2 /* Mark Watson 2/2000;
3 * Rudolf Cornelissen 1/2004-11/2005 */
5 #define MODULE_BIT 0x00000800
7 #include <stdarg.h>
8 #include "nv_std.h"
10 /*delays in multiple of microseconds*/
11 void delay(bigtime_t i)
13 bigtime_t start=system_time();
14 while(system_time()-start<i);
17 /*debug logging*/
18 void nv_log(char *fmt, ...)
20 char buffer[1024];
21 char fname[64];
22 FILE *myhand;
23 va_list args;
25 /* determine the logfile name:
26 * we need split-up logging per card and instance of the accelerant */
27 sprintf (fname, "/boot/home/" DRIVER_PREFIX "." DEVICE_FORMAT ".%d.log",
28 si->vendor_id, si->device_id, si->bus, si->device, si->function,
29 accelerantIsClone);
30 myhand=fopen(fname,"a+");
32 if (myhand == NULL) return;
34 va_start(args,fmt);
35 vsprintf (buffer, fmt, args);
36 va_end(args);
37 fprintf(myhand, "%s", buffer);
38 fclose(myhand);