1 /*
2 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
385 public static native long getuid();
386
387 /**
388 * Returns the effective user ID of the calling process,
389 * or -1 if the value is not available.
390 */
391 public static native long geteuid();
392
393 /**
394 * Returns the real group ID of the calling process,
395 * or -1 if the value is not available.
396 */
397 public static native long getgid();
398
399 /**
400 * Returns the effective group ID of the calling process,
401 * or -1 if the value is not available.
402 */
403 public static native long getegid();
404
405 static {
406 initialize();
407 }
408 private native static void initialize();
409 }
|
1 /*
2 * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
385 public static native long getuid();
386
387 /**
388 * Returns the effective user ID of the calling process,
389 * or -1 if the value is not available.
390 */
391 public static native long geteuid();
392
393 /**
394 * Returns the real group ID of the calling process,
395 * or -1 if the value is not available.
396 */
397 public static native long getgid();
398
399 /**
400 * Returns the effective group ID of the calling process,
401 * or -1 if the value is not available.
402 */
403 public static native long getegid();
404
405 /**
406 * Get a nanosecond time stamp adjustment in the form of a single long.
407 *
408 * This value can be used to create an instant using
409 * {@link java.time.Instant#ofEpochSecond(long, long)
410 * java.time.Instant.ofEpochSecond(offsetInSeconds,
411 * getNanoTimeAdjustment(offsetInSeconds))}.
412 * <p>
413 * The value returned has the best resolution available to the JVM on
414 * the current system.
415 * This is usually down to microseconds - or tenth of microseconds -
416 * depending on the OS/Hardware and the JVM implementation.
417 *
418 * @param offsetInSeconds The offset in seconds from which the nanosecond
419 * time stamp should be computed.
420 *
421 * @apiNote The offset should be recent enough - so that
422 * {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
423 * current UTC time. If the offset is too far off, {@code -1} will be
424 * returned. As such, {@code -1} must not be considered as a valid
425 * nano time adjustment, but as an exception value indicating
426 * that an offset closer to the current time should be used.
427 *
428 * @return A nanosecond time stamp adjustment in the form of a single long.
429 * If the offset is too far off the current time, this method returns -1.
430 * In that case, the caller should call this method again, passing a
431 * more accurate offset.
432 */
433 public static native long getNanoTimeAdjustment(long offsetInSeconds);
434
435 static {
436 initialize();
437 }
438 private native static void initialize();
439 }
|