Skip to content

Instantly share code, notes, and snippets.

@perillamint
Created March 29, 2015 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perillamint/a7ccd1be23b88c04623b to your computer and use it in GitHub Desktop.
Save perillamint/a7ccd1be23b88c04623b to your computer and use it in GitHub Desktop.
syscalltester.c
#include <unistd.h>
#include <stdio.h>
#if __x86_64__
#define __NR_my_enqueue 300
#define __NR_my_dequeue 301
#else // Assume X86_32
#define __NR_my_enqueue 338
#define __NR_my_dequeue 339
#endif
int arr[] = {1, 42, 72, 765, -1};
int arr_len = 5;
int main(int argc, char **argv) {
int i;
for(i=0; i<arr_len; i++) {
printf("calling sys_my_enqueue(%d)\n", arr[i]);
syscall(__NR_my_enqueue, arr[i]);
}
for(i=0; i<arr_len; i++)
printf("sys_my_dequeue() returns %d.\n", syscall(__NR_my_dequeue));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment