C sys_break做什么?

C sys_break做什么?,c,linux,gcc,x86,system-calls,C,Linux,Gcc,X86,System Calls,我在阅读时发现了sys\u break,其描述如下 Syntax: int sys_break() Source: kernel/sys.c Action: return -ENOSYS Details: call exists only for compatibility 有人知道系统中断是怎么做的吗?或者它什么也不做?我可能错了,但我假设它被brk(2)系统调用所取代,该系统调用用于控制分配给进程数据段的内存量。最初的break调用被弃用,可能是因为break在C编程语言中是一个关键

我在阅读时发现了
sys\u break
,其描述如下

Syntax: int sys_break()

Source: kernel/sys.c

Action: return -ENOSYS

Details: call exists only for compatibility

有人知道系统中断是怎么做的吗?或者它什么也不做?

我可能错了,但我假设它被
brk(2)
系统调用所取代,该系统调用用于控制分配给进程数据段的内存量。最初的
break
调用被弃用,可能是因为
break
在C编程语言中是一个关键字。我在源代码中发现了以下注释(写于1976年或之前):

因此,在C编程语言发明之前,Unix是用汇编语言编写的,汇编语言没有将
break
定义为保留字

sys\u break
本身作为系统调用号17在Unix V1中引入(这是PDP-11汇编程序):


现在,如果您比较V6和V1,您可以看到系统调用的含义随着时间的推移而改变。最初它是用来为进程设置断点的,在V6中它基本上是
brk(2)
syscall。

说它是一个未实现的系统。

你在哪里看到的?我似乎已经不存在了……那个文档已经有12年历史了。它是旧BSD系统调用终端信号的填充。ENOSYS只是一种表达“我不能为你做那件事”的方式,或者这个请求不是由操作系统实现的。为了向后兼容。
/* break system call.
* -- bad planning: "break" is a dirty word in C.
*/
sbreak()
{
register a, n, d;
int i;
/* set n to new data size
* set d to new-old
* set n to new total size
*/
...
}
# V1/u2.s - 1971-11-03
sysbreak: / set the program break
    mov u.break,r1 / move users break point to r1
    cmp r1,$core / is it the same or lower than core?
    blos    1f / yes, 1f
    cmp r1,sp / is it the same or higher than the stack?
    bhis    1f / yes, 1f
    bit $1,r1 / is it an odd address
    beq 2f / no, its even
    clrb    (r1)+ / yes, make it even
2: / clear area between the break point and the stack
    cmp r1,sp / is it higher or same than the stack
    bhis    1f / yes, quit
    clr (r1)+ / clear word
    br  2b / go back
1:
    jsr r0,arg; u.break / put the "address" in u.break (set new 
                / break point)
    br  sysret4 / br sysret