このドキュメントで説明するソフトウェアは、Extended SupportまたはSustaining Supportのいずれかにあります。 詳細は、https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdfを参照してください。
Oracleでは、このドキュメントに記載されているソフトウェアをできるだけ早くアップグレードすることをお薦めします。

機械翻訳について

3.6 システム・コールのマッピング

Oracle Linuxオペレーティング・システムはPOSIX標準に準拠し、適切に定義されたシステム・コール・インタフェースを備えています。 Oracle Linuxで使用できるシステム・コールのほとんどは、システム・コールまたはライブラリ関数(API)のいずれかとして、他のPOSIX準拠オペレーティング・システムでも使用できます。 システム・コールの実装には、プラットフォーム間で他にも軽微な相違がいくつか見られる可能性があります。

次の各項では、引数の数、引数型、戻り値、戻り値型について想定される実装上の相違点、またはインクルードする必要のあるヘッダー・ファイルの差異を一覧で表示します。 また、エラーが発生した場合に設定される可能性のあるerrno値、あるいはサポートされているシグナルや引数フラグにも相違点が見られる場合があります。

一方のプラットフォームでしか使用できないシステム・コールもいくつかあります。 そのようなシステム・コールについては、移行時に費やす必要のある時間と工数が増えるでしょう。

システム・コール

想定される実装上の相違点

#include <unistd.h>

int access(const char *pathname, int mode);

一部のオペレーティング・システムでは、<sys/fcntl.h>などの追加ヘッダー・ファイルのインクルードが必要。

#include <unistd.h>

int acct(const char *filename);

一部のオペレーティング・システムでは、別の引数型を定義するか、<unistd.h>ヘッダー・ファイルのインクルードは不要。

#include <unistd.h>

int brk(void *addr);

一部のオペレーティング・システムでは別の引数型を定義。

#include <unistd.h>

int chown(const char *path, uid_t owner, gid_t group);

一部のオペレーティング・システムでは、<sys/types.h>などの追加ヘッダー・ファイルのインクルードが必要。

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

int creat(const char *pathname, mode_t mode);

一部のオペレーティング・システムでは、場合によって<sys/types.h>または<sys/stat.h>のインクルードは不要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <unistd.h>

int faccessat(int dirfd, const char *pathname, int mode, int flags);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>のかわりに<sys/fcntl.h>のインクルードが必要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <sys/stat.h>

int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>のインクルードは不要。

#include <unistd.h>

int fchown(int fd, uid_t owner, gid_t group);

一部のオペレーティング・システムでは、<sys/types.h>などの追加ヘッダー・ファイルのインクルードが必要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <unistd.h>

int fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>ではなく<sys/types.h>のインクルードが必要。

#include <unistd.h>

#include <fcntl.h>

int fcntl(int fd, int cmd, ... /* arg */ );

一部のオペレーティング・システムでは、<sys/types.h>などの追加ヘッダー・ファイルのインクルードが必要、または<unistd.h>は不要。

#include <unistd.h>

pid_t fork(void);

一部のオペレーティング・システムでは、<sys/types.h>などの追加ヘッダー・ファイルをインクルード。

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

int fstat(int fd, struct stat *buf);

一部のオペレーティング・システムでは、<fcntl.h>ヘッダー・ファイルのインクルードが必要、あるいは<sys/types.h>または<unistd.h>は不要。 dev_tオブジェクトへの参照は、場合によって<sys/sysmacros.h>に定義されたmajorminorおよびmakedevの各マクロを使用する必要があります。

#include <sys/vfs.h> /* or <sys/statfs.h> */

int fstatfs(int fd, struct statfs *buf);

一部のオペレーティング・システムでは、場合によって<sys/statfs.h>ヘッダー・ファイルのインクルードが必要。<sys/vfs.h><sys/statfs.h>はOracle Linuxでは同等です。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

int futimesat(int dirfd, const chat *pathname, const struct timeval times[2]);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>ではなく<sys/time.h>をインクルード。

int getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int count);

一部のオペレーティング・システムでは、場合によってgetdentsの引数型が異なり、<dirent.h>ヘッダー・ファイルのインクルードも必要。

getdentsはPOSIXに準拠していません。 移植時のPOSIX準拠対策として、かわりにreaddirの使用を検討してください。

#include <sys/types.h>

#include <unistd.h>

int getgroups(int size, gid_t list[]);

一部のオペレーティング・システムでは、getdentsの引数型が異なり、場合によって<sys/types.h>ヘッダー・ファイルのインクルードは不要。

#include <sys/types.h>

#include <unistd.h>

pid_t getpid(void);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードは不要。

#include <sys/types.h>

#include <unistd.h>

pid_t getppid(void);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードは不要。

#include <sys/time.h>

#include <sys/resource.h>

int getrlimit(int resource, struct rlimit *rlim);

一部のオペレーティング・システムでは、場合によって<sys/time.h>ヘッダー・ファイルのインクルードは不要。

#include <sys/ioctl.h>

int ioctl(int d, int request, ...);

一部のオペレーティング・システムでは、<unistd.h><sys/types.h><stropts.h>などの追加ヘッダー・ファイルのインクルードが必要、場合によって<sys/ioctl.h>は不要。

通常、コマンド・リクエストはデバイス・ドライバに固有なので、ioctlにオペレーティング・システム間での互換性はありません。 ioctlコールを使用するコードの移行時に同等の動作を実現するには時間と工数がかかります。

#include <sys/klog.h>

int klogctl(int type, char *bufp, int len);

klogctlはOracle Linux固有であり、POSIXに準拠していません。 一部のオペレーティング・システムでは、klogctlが実装されていないか、klogctlの引数と引数型が異なる場合あり。

klogctlコールを使用するコードの移行時に同等の動作を実現するには時間と工数がかかります。

#include <unistd.h>

int lchown(const char *path, uid_t owner, gid_t group);

一部のオペレーティング・システムでは、<sys/types.h>などの追加ヘッダー・ファイルのインクルードが必要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <unistd.h>

int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>のインクルードは不要。

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

int lstat(const char *path, struct stat *buf);

一部のオペレーティング・システムでは、lstatを実装していないか、<sys/types.h>または<unistd.h>ヘッダー・ファイルのインクルードは不要。

#include <unistd.h>

#include <sys/mman.h>

int mincore(void *addr, size_t length, unsigned char *vec);

一部のオペレーティング・システムでは、場合によってmincoreの引数型が異なり、また<unistd.h><sys/mman.h>ではなく<sys/types.h>ヘッダー・ファイルのインクルードが必要。

#include <sys/stat.h>

#include <sys/types.h>

int mkdir(const char *pathname, mode_t mode);

一部のオペレーティング・システムでは、場合によって<sys/types.h>のインクルードは不要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <sys/stat.h>

int mkdirat(int dirfd, const char *pathname, mode_t mode);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>のインクルードは不要。

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

#include <unistd.h>

int mknod(const char *pathname, mode_t mode, dev_t dev);

一部のオペレーティング・システムでは、場合によって<sys/types.h><fcntl.h>または<unistd.h>のインクルードは不要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <sys/stat.h>

int mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>のインクルードは不要。

#include <sys/mount.h>

int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags,const void *data);

mountはPOSIXに準拠していません。 一部のオペレーティング・システムでは、場合によってmountの引数と引数型が異なり、<sys/types.h><sys/mntent.h>または<sys/vmount.h>ヘッダー・ファイルのインクルードも必要。

mountコールを使用するコードの移行時に同等の動作を実現するには時間と工数がかかります。

#include <sys/mman.h>

int mprotect(const void *addr, size_t len, int prot);

一部のオペレーティング・システムでは、mprotectの引数と引数型が異なる場合あり。

#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/msg.h>

int msgctl(int msqid, int cmd, struct msqid_ds *buf);

一部のオペレーティング・システムでは、場合によって<sys/types.h>または<sys/ipc.h>のインクルードは不要。

#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/msg.h>

int msgget(key_t key, int msgflg);

一部のオペレーティング・システムでは、場合によって<sys/types.h>または<sys/ipc.h>のインクルードは不要。

#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/msg.h>

ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp,int msgflg);

一部のオペレーティング・システムでは、場合によってmsgrcvの引数型が異なり、<sys/types.h><sys/ipc.h>ヘッダー・ファイルのインクルードは不要。

#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/msg.h>

int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);

一部のオペレーティング・システムでは、場合によって<sys/types.h><sys/ipc.h>のインクルードは不要。

#include <poll.h>

int poll(struct pollfd *fds, nfds_t nfds, int timeout);

一部のオペレーティング・システムでは、pollの引数型が異なる場合あり。

#define _GNU_SOURCE

#include <poll.h>

int ppoll(struct pollfd *fds, nfds_t nfds,const struct timespec *timeout, const sigset_t *sigmask);

一部のオペレーティング・システムでは、_GNU_SOURCEの定義は不要。

#include <unistd.h>

int profil(unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale);

一部のオペレーティング・システムでは、場合によってprofilの引数型と戻り値型が異なるか、<unistd.h>ではなく<time.h>ヘッダー・ファイルのインクルードが必要。

#include <unistd.h>

ssize_t readlink(const char *path, char *buf, size_t bufsiz);

一部のオペレーティング・システムでは、場合によってreadlinkの引数型と戻り値型が異なり、<unistd.h>のかわりに<symlink.h>ヘッダー・ファイルをインクルードする必要あり。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <unistd.h>

int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>ヘッダー・ファイルのインクルードは不要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <stdio.h>

int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h><stdio.h>ではなく<unistd.h>のインクルードが必要。

#include <unistd.h>

void *sbrk(intptr_t increment);

一部のオペレーティング・システムでは別の引数型を定義。

#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/sem.h>

int semop(int semid, struct sembuf *sops, unsigned nsops);

一部のオペレーティング・システムでは、場合によってsemopの引数型が異なるか、<sys/types.h><sys/ipc.h>ヘッダー・ファイルのインクルードは不要。

#include <sys/types.h>

#include <sys/ipc.h>

#include <sys/sem.h>

int semtimedop(int semid, struct sembuf *sops, unsigned nsops, struct timespec *timeout);

一部のオペレーティング・システムでは、場合によってsemtimedopの引数型が異なるか、<sys/types.h><sys/ipc.h>のかわりに<sys/time.h>ヘッダー・ファイルのインクルードが必要。

#include <grp.h>

int setgroups(size_t size, const gid_t *list);

一部のオペレーティング・システムでは、場合によってsetgroupsの引数型が異なり、<grp.h>のかわりに<unistd.h>ヘッダー・ファイルのインクルードが必要。

#include <unistd.h>

int setpgid(pid_t pid, pid_t pgid);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードが必要。

#include <unistd.h>

pid_t setsid(void);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードが必要。

#include <sys/ipc.h>

#include <sys/shm.h>

int shmctl(int shmid, int cmd, struct shmid_ds *buf);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードが必要、または<sys/ipc.h>は不要。

#include <sys/ipc.h>

#include <sys/shm.h>

int shmget(key_t key, size_t size, int shmflg);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードが必要、または<sys/ipc.h>は不要。

#include <signal.h>

int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);

一部のオペレーティング・システムでは、sigactionの引数型が異なる場合あり。

#include <signal.h>

int sigaltstack(const stack_t *ss, stack_t *oss);

一部のオペレーティング・システムでは、sigaltstackの引数型が異なる場合あり。

#include <signal.h>

int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);

一部のオペレーティング・システムでは、sigprocmaskの引数型が異なる場合あり。

#include <sys/types.h>

#include <sys/stat.h>

#include <unistd.h>

int stat(const char *path, struct stat *buf);

一部のオペレーティング・システムでは、場合によって<fcntl.h>ヘッダー・ファイルのインクルードが必要、または<unistd.h>は不要。

#include <sys/vfs.h> /* or <sys/statfs.h> */

int statfs(const char *path, struct statfs *buf);

一部のオペレーティング・システムでは、場合によって<sys/statfs.h>ヘッダー・ファイルのインクルードが必要。<sys/vfs.h><sys/statfs.h>はOracle Linuxでは同等です。

#include <time.h>

int stime(time_t *t);

一部のオペレーティング・システムでは、場合によってstimeの引数型が異なるか、<time.h>のかわりに<unistd.h>ヘッダー・ファイルのインクルードが必要。

#define _ATFILE_SOURCE

#include <fcntl.h> /* Definition of AT_* constants */

#include <stdio.h>

int symlinkat(const char *oldpath, int newdirfd, const char *newpath);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h><stdio.h>ではなく<unistd.h>のインクルードが必要。

int sysfs(int option);

int sysfs(int option, const char *fsname);

int sysfs(int option, unsigned int fs_index, char *buf);

一部のオペレーティング・システムでは、場合によってsysfsのサポートされている引数と引数型が異なり、<sys/fstyp.h>または<sys/fsid.h>ヘッダー・ファイルのインクルードが必要。

#include <sys/sysinfo.h>

int sysinfo(struct sysinfo *info);

一部のオペレーティング・システムでは、場合によってsysfsのサポートされている引数と引数型が異なり、<sys/sysinfo.h>のかわりに<sys/systeminfo.h>ヘッダー・ファイルのインクルードが必要。

sysinfoコールを使用するコードの移行時に同等の動作を実現するには時間と工数がかかります。

int syslog(int type, char *bufp, int len);

syslogはOracle Linux固有であり、POSIXに準拠していません。 一部のオペレーティング・システムでは、syslogが実装されていないか、syslogの引数と引数型が異なる場合あり。

syslogコールを使用するコードの移行時に同等の動作を実現するには時間と工数がかかります。

#include <time.h>

time_t time(time_t *t);

一部のオペレーティング・システムでは、場合によって<sys/types.h>ヘッダー・ファイルのインクルードも必要。

所要時間を判断する方法は、システム・アーキテクチャによって異なる場合があります。

#include <sys/times.h>

clock_t times(struct tms *buf);

一部のオペレーティング・システムでは、場合によって<limits.h>ヘッダー・ファイルのインクルードも必要。

#include <sys/utsname.h>

int uname(struct utsname *buf);

一部のオペレーティング・システムでは、domainnameutsname構造体の一部として定義する場合あり。

#define _ATFILE_SOURCE

#include <fcntl.h>

int unlinkat(int dirfd, const char *pathname, int flags);

一部のオペレーティング・システムでは、_ATFILE_SOURCEの定義は不要、場合によって<fcntl.h>ではなく<unistd.h>のインクルードが必要。

#include <sys/types.h>

#include <unistd.h> /* libc[45] */

#include <ustat.h> /* glibc2 */

int ustat(dev_t dev, struct ustat *ubuf);

一部のオペレーティング・システムでは、<unistd.h>または<sys/types.h>ヘッダー・ファイルのインクルードは不要。

#include <unistd.h>

int vhangup(void);

一部のオペレーティング・システムでは、vhangupの戻り値型が異なる場合あり。