Maintenance

This commit is contained in:
Zhengyi Chen 2024-01-25 19:13:06 +00:00
parent e0dd90ab8b
commit d27f8a39f0
2 changed files with 90 additions and 10 deletions

View file

@ -0,0 +1,38 @@
!_TAG_EXTRA_DESCRIPTION anonymous /Include tags for non-named objects like lambda/
!_TAG_EXTRA_DESCRIPTION fileScope /Include tags of file scope/
!_TAG_EXTRA_DESCRIPTION pseudo /Include pseudo tags/
!_TAG_EXTRA_DESCRIPTION subparser /Include tags generated by subparsers/
!_TAG_FIELD_DESCRIPTION epoch /the last modified time of the input file (only for F\/file kind tag)/
!_TAG_FIELD_DESCRIPTION file /File-restricted scoping/
!_TAG_FIELD_DESCRIPTION input /input file/
!_TAG_FIELD_DESCRIPTION name /tag name/
!_TAG_FIELD_DESCRIPTION pattern /pattern/
!_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_KIND_DESCRIPTION!C d,macro /macro definitions/
!_TAG_KIND_DESCRIPTION!C e,enumerator /enumerators (values inside an enumeration)/
!_TAG_KIND_DESCRIPTION!C f,function /function definitions/
!_TAG_KIND_DESCRIPTION!C g,enum /enumeration names/
!_TAG_KIND_DESCRIPTION!C h,header /included header files/
!_TAG_KIND_DESCRIPTION!C m,member /struct, and union members/
!_TAG_KIND_DESCRIPTION!C s,struct /structure names/
!_TAG_KIND_DESCRIPTION!C t,typedef /typedefs/
!_TAG_KIND_DESCRIPTION!C u,union /union names/
!_TAG_KIND_DESCRIPTION!C v,variable /variable definitions/
!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
!_TAG_OUTPUT_FILESEP slash /slash or backslash/
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
!_TAG_OUTPUT_VERSION 0.0 /current.age/
!_TAG_PARSER_VERSION!C 1.1 /current.age/
!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
!_TAG_PROC_CWD /home/rubberhead/Git/00-UOE/unnamed_ba_thesis/src/aarch64-linux-flush-dcache/userspace/ //
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
!_TAG_PROGRAM_VERSION 6.1.0 /v6.1.0/
!_TAG_ROLE_DESCRIPTION!C!function foreigndecl /declared in foreign languages/
!_TAG_ROLE_DESCRIPTION!C!header local /local header/
!_TAG_ROLE_DESCRIPTION!C!header system /system header/
!_TAG_ROLE_DESCRIPTION!C!macro undef /undefined/
!_TAG_ROLE_DESCRIPTION!C!struct foreigndecl /declared in foreign languages/

View file

@ -1,11 +1,53 @@
/**
* @file userspace.c
* @author Zhengyi Chen (you@domain.com)
* @brief
* @version 0.1
* @date 2024-01-16
*
* @copyright Copyright (c) 2024
*
*/
#include <unistd.h> // sysconf
#include <stdio.h> // printf
#include <stdlib.h> // exit
#include <fcntl.h> // O_RDWR
#include <sys/mman.h> // mmap
#include <string.h> // strlen
#include <errno.h> // errno
#define eprintf(args...) fprintf(stderr, ##args)
const char *DEVICE_PATH = "/dev/my_shmem";
int main(int argc, char *argv[])
{
const long PAGE_SIZE = sysconf(_SC_PAGESIZE);
if (PAGE_SIZE == -1) {
eprintf("Error retrieving page size: %d.\n", errno);
exit(EXIT_FAILURE);
}
// open device file w/ RW perms
FILE *fp = fopen(DEVICE_PATH, "r+");
if (!fp) {
eprintf("Error opening device %s: %d.\n", DEVICE_PATH, errno);
exit(EXIT_FAILURE);
}
int fd = fileno(fp);
if (fd == -1) {
eprintf("Error retrieving file descriptor: %d.\n", errno);
exit(EXIT_FAILURE);
}
// mmap device
void *buf = mmap(NULL, PAGE_SIZE * 2, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
if (!buf) {
eprintf("Error mmap-ing: %d.\n", errno);
exit(EXIT_FAILURE);
}
// Write to mmap-ed device
char to_write[] = {0xca, 0xfe, 0xbe, 0xef, 0x00};
memcpy(buf, to_write, strlen(to_write));
// Unmap device
munmap(buf, PAGE_SIZE * 2);
// Close device
fclose(fp);
printf("Finished!\n");
exit(EXIT_SUCCESS);
}