[agent/codex:gpt-5.3-codex-spark] Read docs/RFC.md fully. Find ONE feature described in the sp... #9
3 changed files with 30 additions and 0 deletions
11
call_test.go
11
call_test.go
|
|
@ -94,6 +94,17 @@ func TestCallSupportsSixArguments(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCallSupportsBufferArgument(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
buffer := NewBuffer(4)
|
||||
defer buffer.Free()
|
||||
|
||||
if err := Call(callBufferArgumentFunction(), buffer); err != nil {
|
||||
t.Fatalf("expected success, got error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrnoMapping(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ int call_six_args(uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintpt
|
|||
return 13;
|
||||
}
|
||||
|
||||
int call_buffer_argument(uintptr_t value) {
|
||||
return value == 0 ? 13 : 0;
|
||||
}
|
||||
|
||||
uintptr_t call_sum_length_ptr(void) {
|
||||
return (uintptr_t)&call_sum_length;
|
||||
}
|
||||
|
|
@ -33,6 +37,11 @@ uintptr_t call_failure_ptr(void) {
|
|||
uintptr_t call_six_args_ptr(void) {
|
||||
return (uintptr_t)&call_six_args;
|
||||
}
|
||||
|
||||
uintptr_t call_buffer_argument_ptr(void) {
|
||||
return (uintptr_t)&call_buffer_argument;
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
|
|
@ -53,6 +62,11 @@ func callSixArgumentFunction() unsafe.Pointer {
|
|||
return *(*unsafe.Pointer)(unsafe.Pointer(&function))
|
||||
}
|
||||
|
||||
func callBufferArgumentFunction() unsafe.Pointer {
|
||||
function := C.call_buffer_argument_ptr()
|
||||
return *(*unsafe.Pointer)(unsafe.Pointer(&function))
|
||||
}
|
||||
|
||||
func callWithErrnoZero() (int, error) {
|
||||
return WithErrno(func() C.int {
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -215,6 +215,11 @@ func toSyscallArg(value interface{}) (uintptr, bool) {
|
|||
return 0, true
|
||||
case uintptr:
|
||||
return typed, true
|
||||
case *Buffer:
|
||||
if typed == nil {
|
||||
return 0, true
|
||||
}
|
||||
return uintptr(typed.Ptr()), true
|
||||
case unsafe.Pointer:
|
||||
return uintptr(typed), true
|
||||
case C.char:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue