From 3e8314320ac0adb114910f67294a25c7fdd097f4 Mon Sep 17 00:00:00 2001 From: martinvuyk Date: Mon, 11 Nov 2024 20:41:42 -0300 Subject: [PATCH] add licence Signed-off-by: martinvuyk --- stdlib/src/sys/ffi/__init__.mojo | 12 ++++++++++++ stdlib/src/sys/ffi/c/__init__.mojo | 12 ++++++++++++ stdlib/src/sys/ffi/c/constants.mojo | 12 ++++++++++++ stdlib/src/sys/ffi/c/libc.mojo | 16 ++++++++++++++-- stdlib/src/sys/ffi/c/types.mojo | 12 ++++++++++++ stdlib/src/sys/ffi/utils.mojo | 4 ++-- stdlib/test/sys/ffi/c/test_files.mojo | 12 ++++++++++++ stdlib/test/sys/ffi/c/test_logging.mojo | 12 ++++++++++++ stdlib/test/sys/ffi/c/test_networking.mojo | 12 ++++++++++++ 9 files changed, 100 insertions(+), 4 deletions(-) diff --git a/stdlib/src/sys/ffi/__init__.mojo b/stdlib/src/sys/ffi/__init__.mojo index 1deb3848ff..1851b9c717 100644 --- a/stdlib/src/sys/ffi/__init__.mojo +++ b/stdlib/src/sys/ffi/__init__.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # """Implements a foreign functions interface (FFI).""" diff --git a/stdlib/src/sys/ffi/c/__init__.mojo b/stdlib/src/sys/ffi/c/__init__.mojo index 188d72f983..1be74093a7 100644 --- a/stdlib/src/sys/ffi/c/__init__.mojo +++ b/stdlib/src/sys/ffi/c/__init__.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # """FFI utils for the C programming language.""" diff --git a/stdlib/src/sys/ffi/c/constants.mojo b/stdlib/src/sys/ffi/c/constants.mojo index f4ab6fd59a..34199cd650 100644 --- a/stdlib/src/sys/ffi/c/constants.mojo +++ b/stdlib/src/sys/ffi/c/constants.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # """Libc POSIX constants.""" diff --git a/stdlib/src/sys/ffi/c/libc.mojo b/stdlib/src/sys/ffi/c/libc.mojo index 9089354414..3758e9ce45 100644 --- a/stdlib/src/sys/ffi/c/libc.mojo +++ b/stdlib/src/sys/ffi/c/libc.mojo @@ -1,8 +1,20 @@ -"""Libc POSIX file syscalls.""" +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # +"""Libc POSIX implementation.""" from collections import Optional from memory import UnsafePointer, stack_allocation -from sys.ffi import external_call, DLHandle +from sys.ffi.utils import external_call, DLHandle from sys.info import os_is_windows, triple_is_nvidia_cuda from .types import C diff --git a/stdlib/src/sys/ffi/c/types.mojo b/stdlib/src/sys/ffi/c/types.mojo index 3dd71beebf..827c3445f6 100644 --- a/stdlib/src/sys/ffi/c/types.mojo +++ b/stdlib/src/sys/ffi/c/types.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # """C POSIX types.""" from sys.info import is_64bit, os_is_windows diff --git a/stdlib/src/sys/ffi/utils.mojo b/stdlib/src/sys/ffi/utils.mojo index ad4058b1e5..75db78b7e6 100644 --- a/stdlib/src/sys/ffi/utils.mojo +++ b/stdlib/src/sys/ffi/utils.mojo @@ -17,8 +17,8 @@ from memory import UnsafePointer from utils import StringRef -from .info import os_is_linux, os_is_windows, is_64bit, os_is_macos -from .intrinsics import _mlirtype_is_eq +from sys.info import os_is_linux, os_is_windows, is_64bit, os_is_macos +from sys.intrinsics import _mlirtype_is_eq from sys._libc import dlerror, dlopen, dlclose, dlsym diff --git a/stdlib/test/sys/ffi/c/test_files.mojo b/stdlib/test/sys/ffi/c/test_files.mojo index 9f24da34b3..ad94ab4f91 100644 --- a/stdlib/test/sys/ffi/c/test_files.mojo +++ b/stdlib/test/sys/ffi/c/test_files.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # # RUN: %mojo %s diff --git a/stdlib/test/sys/ffi/c/test_logging.mojo b/stdlib/test/sys/ffi/c/test_logging.mojo index 51bf78ab7b..19ad90a87f 100644 --- a/stdlib/test/sys/ffi/c/test_logging.mojo +++ b/stdlib/test/sys/ffi/c/test_logging.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # # RUN: %mojo %s from testing import assert_equal, assert_false, assert_raises, assert_true diff --git a/stdlib/test/sys/ffi/c/test_networking.mojo b/stdlib/test/sys/ffi/c/test_networking.mojo index f18976c347..60d9fdbcf2 100644 --- a/stdlib/test/sys/ffi/c/test_networking.mojo +++ b/stdlib/test/sys/ffi/c/test_networking.mojo @@ -1,3 +1,15 @@ +# ===----------------------------------------------------------------------=== # +# Copyright (c) 2024, Modular Inc. All rights reserved. +# +# Licensed under the Apache License v2.0 with LLVM Exceptions: +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ===----------------------------------------------------------------------=== # # RUN: %mojo %s from testing import assert_equal, assert_false, assert_raises, assert_true