system-calls

PHP system calls and $PATH in OS X

折月煮酒 提交于 2019-12-31 06:07:57
问题 I'm trying to get PHP to make system calls on OS X. However, it doesn't seem to be able to find anything that's included in the system path. When I run... putenv("PATH={$_SERVER["PATH"]}:/usr/local/bin"); ... just before the system call, it works. This is not a practical solution, since the code that executes the system call is a plugin, so I'd rather not touch source code that'll make it incompatible come an update. Apache2 is running as the same user as I'm logged in, so theoretically it

Using a variable in Fortran's SYSTEM subroutine

萝らか妹 提交于 2019-12-31 01:58:27
问题 How do I use a variable in the command executed in a system subroutine call? For example, if I want to create multiple directories like test_1_1 , test_1_2 , and so on till test_3_3 then what should my code be? I am trying the following code but can't seem to figure out what to write in #### part. integer :: i,j do i = 1,3 do j = 1,3 CALL system('mkdir folder ####') enddo enddo 回答1: character (len=8) :: test_name do i=1, 3 do j=1, 3 write (test_name, '( "test_", I1, "_", I1 )' ) i, j call

How does one programmatically determine if “write” system call is atomic on a particular file?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 00:45:18
问题 In some cases the coder cannot rely on system calls being atomic, e.g. if the file is on a NFS filesystem. (c.f. NFS Overview, FAQ and HOWTO Documents). But atomic system calls are ultimately required for most database work. (c.f. Atomicity of database systems). Is there a standard (and OS independent) way of confirming writes (and other syscalls) are atomic on a particular FILE in C (or python). Any suggestions? Subsequent notes: Atomicity on pipes is discussed in the following: unix pipe

xv6 add a system call that counts system calls

大憨熊 提交于 2019-12-30 10:00:10
问题 EDIT: GOT IT here is what I did: in syscall.c: extern int numSysCalls; in sysproc.c: int numSysCalls = -1; Okay, so I'm working on implementing an easy system call that returns the number of times a system call has been made. Seems easy, but I'm getting an error I don't understand... Basically, here is what I did: in syscall.c there is a function called syscall() that checks whether it is a syscall or not. I have basically declared a variable and am incrementing it every time this function is

Adding a new system call in Linux kernel 3.3

纵饮孤独 提交于 2019-12-30 00:38:11
问题 I am very new to this kernel thing. What I want to do is just add a new system call to the kernel. I was following this guideline: http://hekimian-williams.com/?p=20. The problem is there used to syscall_table_32.S file under arch/x86/kernel, but I cannot find the file for x86 systems in kernel version 3.3. Do I still need to edit the file and append one more line for the newly added system call? Or do I need to do something else to let the kernel know about my new system call? Any help will

system call tracing using ptrace

心不动则不痛 提交于 2019-12-29 09:23:36
问题 I wrote a program to list all the system calls executed by a command (say /bin/ls). Now what I am trying to do is find all the system call arguments, environment variables, command line arguments that may be passed to it Example: If I open a file. The system call sys_access will open the file right ? But how to get these values? Want to do this for system calls like open, read, write, close. As per my study these must be in the registers (ebx - edx) If so what does these register values

Make a system call to get list of processes

匆匆过客 提交于 2019-12-29 06:29:49
问题 I'm new on modules programming and I need to make a system call to retrieve the system processes and show how much CPU they are consuming. How can I make this call? 回答1: Why would you implement a system call for this? You don't want to add a syscall to the existing Linux API. This is the primary Linux interface to userspace and nobody touches syscalls except top kernel developers who know what they do. If you want to get a list of processes and their parameters and real-time statuses, use

How to trace just system call events with ftrace without showing any other functions in the Linux kernel?

淺唱寂寞╮ 提交于 2019-12-28 18:55:30
问题 For example, to monitor all mkdir calls made, the best I could come up with was: #!/bin/sh set -eux d=debug/tracing mkdir -p debug if ! mountpoint -q debug; then mount -t debugfs nodev debug fi # Stop tracing. echo 0 > "${d}/tracing_on" # Clear previous traces. echo > "${d}/trace" # Enable tracing mkdir echo sys_enter_mkdir > "${d}/set_event" # Set tracer type. echo function > "${d}/current_tracer" # Filter only sys_mkdir as a workaround. echo SyS_mkdir > "${d}/set_ftrace_filter" # Start

How does sched_setaffinity() work?

点点圈 提交于 2019-12-28 12:09:05
问题 I am trying to understand how the linux syscall sched_setaffinity() works. This is a follow-on from my question here. I have this guide, which explains how to use the syscall and has a pretty neat (working!) example. So I downloaded the Linux 2.6.27.19 kernel sources. I did a 'grep' for lines containing that syscall, and I got 91 results. Not promising. Ultimately, I'm trying to understand how the kernel is able to set the instruction pointer for a specific core (or processor.) I am familiar

Python: waiting for external launched process finish

社会主义新天地 提交于 2019-12-28 11:53:48
问题 The question already in title - how can one make the python script wait until some process launched with os.system() call is completed ? For example a code like for i in range( 0, n ): os.system( 'someprog.exe %d' % i ) This launches the requested process n times simultaneously, which may make my pc to sweat a bit ) Thanks for any advice. 回答1: os.system() does wait for its process to complete before returning. If you are seeing it not wait, the process you are launching is likely detaching