src/hotspot/os/aix/misc_aix.cpp
author alanb
Thu, 21 Mar 2019 08:41:10 +0000
branchniosocketimpl-branch
changeset 57275 222fa5ed1c91
parent 51139 c95334202a14
permissions -rw-r--r--
Add @systemProperty ref to system property to configure old impl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     1
/*
35594
cc13089c6327 8147937: Adapt SAP copyrights to new company name.
goetz
parents: 34647
diff changeset
     2
 * Copyright (c) 2015 SAP SE. All rights reserved.
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     4
 *
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     8
 *
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    13
 * accompanied this code).
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    14
 *
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    18
 *
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    21
 * questions.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    22
 *
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    23
 */
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    24
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    25
#include "misc_aix.hpp"
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    26
#include "runtime/stubRoutines.hpp"
46625
edefffab74e2 8183552: Move align functions to align.hpp
stefank
parents: 46619
diff changeset
    27
#include "utilities/align.hpp"
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    28
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    29
#include <pthread.h>
34647
fafb32d71489 8143125: [aix] Further Developments for AIX
stuefe
parents: 33743
diff changeset
    30
#include <unistd.h>
fafb32d71489 8143125: [aix] Further Developments for AIX
stuefe
parents: 33743
diff changeset
    31
#include <errno.h>
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    32
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    33
void MiscUtils::init_critsect(MiscUtils::critsect_t* cs) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    34
  const int rc = pthread_mutex_init(cs, NULL);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    35
  assert0(rc == 0);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    36
}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    37
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    38
void MiscUtils::free_critsect(MiscUtils::critsect_t* cs) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    39
  const int rc = pthread_mutex_destroy(cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    40
  assert0(rc == 0);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    41
}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    42
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    43
void MiscUtils::enter_critsect(MiscUtils::critsect_t* cs) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    44
  const int rc = pthread_mutex_lock(cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    45
  assert0(rc == 0);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    46
}
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    47
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    48
void MiscUtils::leave_critsect(MiscUtils::critsect_t* cs) {
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    49
  const int rc = pthread_mutex_unlock(cs);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    50
  assert0(rc == 0);
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents:
diff changeset
    51
}