X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fgp2x.c;h=6db1d41f95f07baf6d2329029ee943b6571f05d6;hb=88bfc63d316f9a19ce6d63421757f520cb4d6df9;hp=7a5156c78f22f35be68b562977337d1e4b85802a;hpb=a5365695a4e491413eeeca87243f776857d80913;p=libpicofe.git diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c index 7a5156c..6db1d41 100644 --- a/gp2x/gp2x.c +++ b/gp2x/gp2x.c @@ -284,6 +284,31 @@ void Reset940(int yes, int bank) gp2x_memregs[0x3B48>>1] = ((yes&1) << 7) | (bank & 0x03); } +static void proc_set(const char *path, const char *val) +{ + FILE *f; + char tmp[16]; + + f = fopen(path, "w"); + if (f == NULL) { + printf("failed to open: %s\n", path); + return; + } + + fprintf(f, "0\n"); + fclose(f); + + printf("\"%s\" is set to: ", path); + f = fopen(path, "r"); + if (f == NULL) { + printf("(open failed)\n"); + return; + } + + fgets(tmp, sizeof(tmp), f); + printf("%s", tmp); + fclose(f); +} /* common */ @@ -337,6 +362,10 @@ void gp2x_init(void) /* init usb joys -GnoStiC */ gp2x_usbjoy_init(); + /* disable Linux read-ahead */ + proc_set("/proc/sys/vm/max-readahead", "0\n"); + proc_set("/proc/sys/vm/min-readahead", "0\n"); + printf("exitting init()\n"); fflush(stdout); }