File: path_utils.h

package info (click to toggle)
vuos 0.9.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,616 kB
  • sloc: ansic: 22,155; python: 284; makefile: 28; sh: 4
file content (24 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef PATH_UTILS_H
#define PATH_UTILS_H

/* helper function to get a canonicalized path arguemnts from the user process.
	 return values, if not NULL, are dynamically allocated strings, so their memory must be
	 deallocated by free(3) */

char *get_path(int dirfd, syscall_arg_t addr, struct stat *buf, int flags, uint8_t *need_rewrite, int nested);

/* get the canonicalized path of the system call described is sd. It uses arch_table to
	 process -at calls, to decide if the system call follow synbolic links or not etc. */
char *get_syspath(struct syscall_descriptor_t *sd, struct stat *buf, uint8_t *need_rewrite);
/* the same as above for nested syscalls */
char *get_nested_syspath(int syscall_number, syscall_arg_t *args, struct stat *buf, uint8_t *need_rewrite);

/* the same as above for virtual syscalls */
char *get_vsyspath(struct syscall_descriptor_t *sd, struct stat *buf, uint8_t *need_rewrite);

/* change the path of a system call: rewrite the path in the user process memory.
	 The hosting kernel receives the system call request using the modified path.
	 The new path string is stored on the stack, just below the stack pointer */
void rewrite_syspath(struct syscall_descriptor_t *sd, char *newpath);

#endif