Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 321206 Details for
Bug 431214
dev-util/catalyst: add qemu support
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
qemu-binfmt wrapper
qemu-binfmt.c (text/plain), 1.82 KB, created by
Cédric Caron
on 2012-08-13 13:00:00 UTC
(
hide
)
Description:
qemu-binfmt wrapper
Filename:
MIME Type:
Creator:
Cédric Caron
Created:
2012-08-13 13:00:00 UTC
Size:
1.82 KB
patch
obsolete
>#include <stdio.h> >#include <stdarg.h> >#include <unistd.h> >#include <libgen.h> >#include <string.h> >#include <stdlib.h> >#include <sys/stat.h> > >int main(int argc, char **argv, char **envp) >{ > char *binfmt; > char **new_argv; > > /* > * Check if our file name ends with -binfmt > */ > binfmt = argv[0] + strlen(argv[0]) - strlen("-binfmt"); > if (strcmp(binfmt, "-binfmt")) { > fprintf(stderr, "%s: Invalid executable name\n", argv[0]); > exit(1); > } > if (argc < 3) { > fprintf(stderr, "%s: Please use me through binfmt with P flag\n", > argv[0]); > exit(1); > } > > char fileName[128] = "/crossroot"; > strcat(fileName, argv[1]); > > struct stat buf; > int i = stat ( fileName, &buf ); > > /* > FILE * log = fopen("/dev/pts/1", "a"); > if(log) { > fprintf(log, "%s%s - %s - %s (%d)\n", i ? " ":"*", fileName, argv[1], argv[2], argc); > int a; > for(a=0; a<argc; a++) > { > fprintf(log, "%s $$$ ", argv[a]); > } > fprintf(log, "\n"); > > fclose(log); > } > */ > > if(i == 0) { > new_argv = (char **)malloc((argc - 1) * sizeof(*new_argv)); > if (argc > 3) { > memcpy(&new_argv[1], &argv[3], (argc - 3) * sizeof(*new_argv)); > } > new_argv[0] = argv[2]; > new_argv[argc - 2] = NULL; > } else { > binfmt[0] = '\0'; > /* Now argv[0] is the real qemu binary name */ > > new_argv = (char **)malloc((argc + 2) * sizeof(*new_argv)); > if (argc > 3) { > memcpy(&new_argv[4], &argv[3], (argc - 3) * sizeof(*new_argv)); > } > new_argv[0] = argv[0]; > new_argv[1] = (char *)"-0"; > new_argv[2] = argv[2]; > new_argv[3] = argv[1]; > new_argv[argc + 1] = NULL; > } > > return execve(i ? new_argv[0] : fileName, new_argv, envp); >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 431214
:
321204
| 321206 |
321520