public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: <newlib@sourceware.org>
Cc: <tdevries@suse.de>, Thomas Schwinge <thomas@codesourcery.com>,
	Andrew Stubbs <ams@codesourcery.com>
Subject: [PATCH] nvptx: Provide stub 'getpid', 'kill', 'stat'
Date: Thu, 19 Jan 2023 22:53:37 +0100	[thread overview]
Message-ID: <20230119215337.2002000-1-thomas@codesourcery.com> (raw)
In-Reply-To: <ae825c453f484ffd99c9be34af726089@mentor.com>

... as implemented for GCN in 'newlib/libc/sys/amdgcn/*' files, but (for now)
still adding to the catch-all 'newlib/libc/machine/nvptx/misc.c' file.

This is necessary for the GCC/Fortran I/O system, for example.

Co-authored-by: Andrew Stubbs <ams@codesourcery.com>
---
 newlib/libc/machine/nvptx/misc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/newlib/libc/machine/nvptx/misc.c b/newlib/libc/machine/nvptx/misc.c
index 897ddc807..56e66b9f3 100644
--- a/newlib/libc/machine/nvptx/misc.c
+++ b/newlib/libc/machine/nvptx/misc.c
@@ -36,11 +36,22 @@ gettimeofday (struct timeval *tv, void *tz) {
   return -1;
 }

+int
+getpid (void) {
+  return 0;
+}
+
 int
 isatty (int fd) {
   return fd == 1;
 }

+int
+kill (int pid, int sig) {
+  errno = ESRCH;
+  return -1;
+}
+
 off_t
 lseek(int fd, off_t offset, int whence) {
   return 0;
@@ -56,6 +67,12 @@ read(int fd, void *buf, size_t count) {
   return 0;
 }

+int
+stat (const char *file, struct stat *pstat) {
+  errno = EACCES;
+  return -1;
+}
+
 void
 sync (void) {
 }
--
2.25.1

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

      parent reply	other threads:[~2023-01-19 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ae825c453f484ffd99c9be34af726089@mentor.com>
2023-01-19 21:53 ` [PATCH 1/2] nvptx: Don't use global constructor for SSP setup Thomas Schwinge
2023-01-19 21:53   ` [PATCH 2/2] nvptx: Remove newlib ELIX level 1 restriction Thomas Schwinge
2023-01-19 21:53 ` Thomas Schwinge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230119215337.2002000-1-thomas@codesourcery.com \
    --to=thomas@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=newlib@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).