Skip to content

Commit

Permalink
Remove redundant calling convention specification (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz authored Oct 19, 2024
1 parent a4fca7e commit 930ede1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static partial nint ProviderInit(string name)
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerInit", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(byte* __name_native);
}
}
Expand Down Expand Up @@ -74,7 +73,6 @@ private static partial nint ProviderAddProbe(nint provider, string name, int arg
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerAddProbe", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(nint __provider_native, byte* __name_native, int __argCount_native, global::LibstapsdtPinvokes.ArgType __arg1_native);
}
}
Expand Down Expand Up @@ -110,7 +108,6 @@ private static partial nint ProviderAddProbe(nint provider, string name, int arg
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerAddProbe", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(nint __provider_native, byte* __name_native, int __argCount_native, global::LibstapsdtPinvokes.ArgType __arg1_native, global::LibstapsdtPinvokes.ArgType __arg2_native);
}
}
Expand Down Expand Up @@ -146,7 +143,6 @@ private static partial nint ProviderAddProbe(nint provider, string name, int arg
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerAddProbe", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(nint __provider_native, byte* __name_native, int __argCount_native, global::LibstapsdtPinvokes.ArgType __arg1_native, global::LibstapsdtPinvokes.ArgType __arg2_native, global::LibstapsdtPinvokes.ArgType __arg3_native);
}
}
Expand Down Expand Up @@ -182,7 +178,6 @@ private static partial nint ProviderAddProbe(nint provider, string name, int arg
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerAddProbe", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(nint __provider_native, byte* __name_native, int __argCount_native, global::LibstapsdtPinvokes.ArgType __arg1_native, global::LibstapsdtPinvokes.ArgType __arg2_native, global::LibstapsdtPinvokes.ArgType __arg3_native, global::LibstapsdtPinvokes.ArgType __arg4_native);
}
}
Expand Down Expand Up @@ -218,7 +213,6 @@ private static partial nint ProviderAddProbe(nint provider, string name, int arg
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerAddProbe", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(nint __provider_native, byte* __name_native, int __argCount_native, global::LibstapsdtPinvokes.ArgType __arg1_native, global::LibstapsdtPinvokes.ArgType __arg2_native, global::LibstapsdtPinvokes.ArgType __arg3_native, global::LibstapsdtPinvokes.ArgType __arg4_native, global::LibstapsdtPinvokes.ArgType __arg5_native);
}
}
Expand Down Expand Up @@ -254,7 +248,6 @@ private static partial nint ProviderAddProbe(nint provider, string name, int arg
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "providerAddProbe", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe nint __PInvoke(nint __provider_native, byte* __name_native, int __argCount_native, global::LibstapsdtPinvokes.ArgType __arg1_native, global::LibstapsdtPinvokes.ArgType __arg2_native, global::LibstapsdtPinvokes.ArgType __arg3_native, global::LibstapsdtPinvokes.ArgType __arg4_native, global::LibstapsdtPinvokes.ArgType __arg5_native, global::LibstapsdtPinvokes.ArgType __arg6_native);
}
}
Expand Down Expand Up @@ -358,7 +351,6 @@ public static partial bool ProbeIsEnabled(nint probe)
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("libstapsdt.so.0", EntryPoint = "probeIsEnabled", ExactSpelling = true)]
[global::System.Runtime.InteropServices.UnmanagedCallConvAttribute(CallConvs = new global::System.Type[] { typeof(global::System.Runtime.CompilerServices.CallConvCdecl) })]
static extern unsafe int __PInvoke(nint __probe_native);
}
}
Expand Down
19 changes: 0 additions & 19 deletions src/Libstapsdt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ public static partial class Libstapsdt

// P/Invoke function declarations
[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerInit", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial SdtProviderPtr ProviderInit(string name);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerUseMemfd")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int ProviderUseMemfd(SdtProviderPtr provider, MemfdOption option);

// Overloads for providerAddProbe for different argument counts
Expand All @@ -47,73 +45,56 @@ public static ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, Ar
ProviderAddProbe(provider, name, 6, arg1, arg2, arg3, arg4, arg5, arg6);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerAddProbe", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static partial ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, int argCount, ArgType arg1);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerAddProbe", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static partial ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, int argCount, ArgType arg1, ArgType arg2);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerAddProbe", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static partial ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, int argCount, ArgType arg1, ArgType arg2, ArgType arg3);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerAddProbe", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static partial ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, int argCount, ArgType arg1, ArgType arg2, ArgType arg3, ArgType arg4);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerAddProbe", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static partial ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, int argCount, ArgType arg1, ArgType arg2, ArgType arg3, ArgType arg4, ArgType arg5);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerAddProbe", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static partial ProbePtr ProviderAddProbe(SdtProviderPtr provider, string name, int argCount, ArgType arg1, ArgType arg2, ArgType arg3, ArgType arg4, ArgType arg5, ArgType arg6);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerLoad")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int ProviderLoad(SdtProviderPtr provider); // return -1 on error, 0 on success

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerUnload")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int ProviderUnload(SdtProviderPtr provider); // return -1 on error, 0 on success

[LibraryImport(LibstapsdtLibrary, EntryPoint = "providerDestroy")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProviderDestroy(SdtProviderPtr provider);

// Overloads for probeFire for different argument counts

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe, long arg1);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe, long arg1, long arg2);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe, long arg1, long arg2, long arg3);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe, long arg1, long arg2, long arg3, long arg4);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe, long arg1, long arg2, long arg3, long arg4, long arg5);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeFire")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void ProbeFire(ProbePtr probe, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6);

[LibraryImport(LibstapsdtLibrary, EntryPoint = "probeIsEnabled")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool ProbeIsEnabled(ProbePtr probe); // return 1 if true, 0 if false
}
Expand Down

0 comments on commit 930ede1

Please sign in to comment.