system-calls

C stat struct does not have st_ctime field but only st_ctim

半城伤御伤魂 提交于 2019-12-23 15:54:14
问题 I've now been googleing this for about two hours, yet I was unable to find any answers that helped. The definition of 'stat' as spcified in the manpage says that a st_ctime field exists. struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device ID (if special file) */ off_t st

with -lpthread, g++ compiler error, “undefined reference to ” semaphore calls such as `sem_open'

故事扮演 提交于 2019-12-23 13:21:34
问题 I am new to posix thread library, and I tried to compile a sample code from a tutorial with: g++ -lpthread agreement.cpp -o agreement however I was not able to compile the code and got the following error message: a3q2.cpp:(.text+0x7e): undefined reference to `sem_open' a3q2.cpp:(.text+0xab): undefined reference to `sem_wait' a3q2.cpp:(.text+0x290): undefined reference to `sem_post' a3q2.cpp:(.text+0x2af): undefined reference to `sem_close' a3q2.cpp:(.text+0x2bb): undefined reference to `sem

commons-exec: Executing a program on the system PATH?

↘锁芯ラ 提交于 2019-12-23 11:49:34
问题 I'm trying to execute a program (convert from ImageMagick, to be specific) whose parent folder exists on the path. Ergo, when I run convert from the command line, it runs the command. The following, however, fails: String command = "convert" CommandLine commandLine = CommandLine.parse(command); commandLine.addArgument(...) ... int exitValue = executor.execute(commandLine); If I specify the full path of the convert executable ( C:\Program files\... ) then this code works. If I don't do this, I

System calls : difference between sys_exit(), SYS_exit and exit()

拈花ヽ惹草 提交于 2019-12-23 08:37:14
问题 What is the difference between SYS_exit, sys_exit() and exit()? What I understand : The linux kernel provides system calls, which are listed in man 2 syscalls . There are wrapper functions of those syscalls provided by glibc which have mostly similar names as the syscalls. My question : In man 2 syscalls , there is no mention of SYS_exit and sys_exit(), for example. What are they? Note : The syscall exit here is only an example. My question really is : What are SYS_xxx and sys_xxx()? 回答1: I

Intercepting DateTime.Now in .net app

南楼画角 提交于 2019-12-23 03:47:07
问题 We have an application which uses the current date (using Datetime.Now) to calculate specific values. We need to be able to run these calculations on the server based on a different date as well. Unfortunately the two obvious choices are not viable - a) although we have the code for the app, due to politics and the fact that other environments also use the service, will not be able to change it and inject a specific date and b) due to other applications and processes running on the server we

How to trace the write system call in the Linux kernel?

二次信任 提交于 2019-12-23 03:30:18
问题 I am trying to do this: I am sending packet through iperf-an open source tool from one machine to another and I want to trace the write system or send call. Please help me to do that,if someone can guide through Ftrace framework to trace system call that would be great otherwise by any other tracing tool. 回答1: The hard part is to know exactly what to trace so you can see only the results that you want, but the tracing itself is very easy: First, your kernel must be configured with CONFIG

File Copy using filp_open

耗尽温柔 提交于 2019-12-23 03:09:48
问题 I want to make the syscall using filp_open!! purpose is file copy!! but a problem is that i can't find end of file. opersting system is redhat9 and kernel version is 2.6.32!! i want to help to me plz!!!! #include <linux/kernel.h> #include <linux/fs.h> #include <asm/uaccess.h> #define BUF_SIZE 4096 asmlinkage int sys_forensiccopy(char *src, char *dst) { struct file *input_fd; struct file *output_fd; size_t ret_in, ret_out; /* Number of bytes returned by read() and write() */ char buffer[BUF

Shellcode with restrictions

拈花ヽ惹草 提交于 2019-12-23 02:54:08
问题 For a task I need to create simple shellcode, but it is not allowed that it contains \x80. Notice: To make a system call on linux, like write or exit, you need among others this line: int 0x80 , which in the end will produce shellcode including \x80. Nevertheless I need to make system calls, so my idea now is to use a variable for the interrupt vector number. For example 0x40 and then multiply it with 2, so in the end there will be a \x40 but not a \x80 in the shellcode. The problem is that

Splice system call, what is passed to the pipe? Data or whereabouts info?

风格不统一 提交于 2019-12-23 02:07:56
问题 I know with a splice, we can all stay in the kernel. But I am not sure whether it is the data or the whereabouts info that get passed to the pipe. EDIT 1: Thanks @vinayak, now I know there is actually data copy to and from the pipe buffer. But then, I just wonder why we can not just pass whereabouts and length info to the pipe? Within a single process, the address space is the same Between difference processes, it also works if the pipe buffer is linear mapped. If not, we may use the DMA

Adding new System Call in Minix

有些话、适合烂在心里 提交于 2019-12-23 01:46:28
问题 I am trying to create a new system call in Minix 3.3. At first i just want to create simple printmsg() call that will write "Hello World" on screen. I looked various tutorials on internet and still couldn't find out solution. I defined my sys call number in callnr.h like this #define PM_PRINTMSG (PM BASE + 48) and i increased number of sys calls #define NR_PM_CALLS 49 . In table.c I added CALL(PM_PRINTMSG) = doprintmsg . In proto.h I described function prototype `int do_printmsg(void);