linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: ppc32: semctl fails
Date: Wed, 6 Dec 2017 17:23:33 +0000	[thread overview]
Message-ID: <1512581010.8313.153.camel@infinera.com> (raw)

This test, taken from perl Configure, fails on my ppc32, should it?
  semctl IPC_STAT failed: errno =3D Bad Address=20
is what I get, kernel is 4.1.43

-----------------

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/stat.h>
#ifndef S_IRUSR
#   ifdef S_IREAD
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
#define S_IXUSR S_IEXEC
#   else
#define S_IRUSR 0400
#define S_IWUSR 0200
#define S_IXUSR 0100
#   endif
#   define S_IRGRP (S_IRUSR>>3)
#   define S_IWGRP (S_IWUSR>>3)
#   define S_IXGRP (S_IXUSR>>3)
#   define S_IROTH (S_IRUSR>>6)
#   define S_IWOTH (S_IWUSR>>6)
#   define S_IXOTH (S_IXUSR>>6)
#endif
#ifndef S_IRWXU
#   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
#   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
#   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
#endif

#include <string.h>
#include <stdio.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
int main() {
  int sem, st;
  struct semid_ds arg;

#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  define=
d(S_IRWXO) && defined(IPC_CREAT)
  sem =3D semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
  if (sem > -1) {
    #ifdef IPC_STAT
    st =3D semctl(sem, 0, IPC_STAT, &arg);
    if (st =3D=3D 0)
      printf("semid_ds\n");
    else
#endif /* IPC_STAT */
      printf("semctl IPC_STAT failed: errno =3D %s\n", strerror(errno));
    #ifdef IPC_RMID
    if (semctl(sem, 0, IPC_RMID, &arg) !=3D 0)
#endif /* IPC_RMID */
      printf("semctl IPC_RMID failed: errno =3D %d\n", errno);
  } else
#endif /* IPC_PRIVATE && ... */
    printf("semget failed: errno =3D %d\n", errno);

  return 0;
}=

             reply	other threads:[~2017-12-06 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 17:23 Joakim Tjernlund [this message]
     [not found] <1512581010.8313.153.camel__41464.7176782184$1512581316$gmane$org@infinera.com>
2017-12-06 22:56 ` ppc32: semctl fails Andreas Schwab
2017-12-06 23:53   ` Joakim Tjernlund

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=1512581010.8313.153.camel@infinera.com \
    --to=joakim.tjernlund@infinera.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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 NNTP newsgroup(s).