요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
==========
spu_create
==========
Name
====
spu_create - create a new spu context
Synopsis
========
::
#include <sys/types.h>
#include <sys/spu.h>
int spu_create(const char *pathname, int flags, mode_t mode);
Description
===========
The spu_create system call is used on PowerPC machines that implement
the Cell Broadband Engine Architecture in order to access Synergistic
Processor Units (SPUs). It creates a new logical context for an SPU in
pathname and returns a handle to associated with it. pathname must
point to a non-existing directory in the mount point of the SPU file
system (spufs). When spu_create is successful, a directory gets cre-
ated on pathname and it is populated with files.
The returned file handle can only be passed to spu_run(2) or closed,
other operations are not defined on it. When it is closed, all associ-
ated directory entries in spufs are removed. When the last file handle
pointing either inside of the context directory or to this file
descriptor is closed, the logical SPU context is destroyed.
The parameter flags can be zero or any bitwise or'd combination of the
following constants:
SPU_RAWIO
Allow mapping of some of the hardware registers of the SPU into
user space. This flag requires the CAP_SYS_RAWIO capability, see
capabilities(7).
The mode parameter specifies the permissions used for creating the new
directory in spufs. mode is modified with the user's umask(2) value
and then used for both the directory and the files contained in it. The
file permissions mask out some more bits of mode because they typically
support only read or write access. See stat(2) for a full list of the
possible mode values.
Return Value
============
spu_create returns a new file descriptor. It may return -1 to indicate
an error condition and set errno to one of the error codes listed
below.
Errors
======
EACCES
The current user does not have write access on the spufs mount
point.
EEXIST An SPU context already exists at the given path name.
EFAULT pathname is not a valid string pointer in the current address
space.
EINVAL pathname is not a directory in the spufs mount point.
ELOOP Too many symlinks were found while resolving pathname.
EMFILE The process has reached its maximum open file limit.
ENAMETOOLONG
pathname was too long.
ENFILE The system has reached the global open file limit.
ENOENT Part of pathname could not be resolved.
ENOMEM The kernel could not allocate all resources required.
ENOSPC There are not enough SPU resources available to create a new
context or the user specific limit for the number of SPU con-
texts has been reached.
ENOSYS the functionality is not provided by the current system, because
either the hardware does not provide SPUs or the spufs module is
not loaded.
ENOTDIR
A part of pathname is not a directory.
Notes
=====
spu_create is meant to be used from libraries that implement a more
abstract interface to SPUs, not to be used from regular applications.
See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
ommended libraries.
Files
=====
pathname must point to a location beneath the mount point of spufs. By
convention, it gets mounted in /spu.
Conforming to
=============
This call is Linux specific and only implemented by the ppc64 architec-
ture. Programs using this system call are not portable.
Bugs
====
The code does not yet fully implement all features lined out here.
Author
======
Arnd Bergmann <[email protected]>
See Also
========
capabilities(7), close(2), spu_run(2), spufs(7)
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
`spu_create()` 호출과 수명
1-51`spu_create(const char *pathname, int flags, mode_t mode)`는 Cell Broadband Engine Architecture를 구현한 PowerPC에서 Synergistic Processor Unit(SPU)에 접근할 논리 context를 만든다. `pathname`은 spufs mountpoint 아래 아직 존재하지 않는 directory를 가리켜야 한다.
성공하면 해당 경로에 미리 정해진 파일로 채운 context directory가 생기고, 연결된 file descriptor를 반환한다. 이 handle에는 `spu_run(2)` 또는 `close`만 정의되어 있다. handle을 닫으면 관련 spufs directory entry가 제거되고, context directory 내부나 이 descriptor를 가리키는 마지막 handle까지 닫히면 논리 context가 파괴된다.
`flags`는 0 또는 상수의 bitwise OR이다. `SPU_RAWIO`는 일부 SPU hardware register를 user space에 map하도록 허용하며 `CAP_SYS_RAWIO` capability가 필요하다. `mode`는 새 directory와 내부 파일 권한의 기반이며 사용자 `umask(2)`가 적용된다. 각 파일이 read 또는 write 일부만 지원하므로 모순되는 permission bit는 추가로 제거된다.
경로 생성부터 마지막 reference 종료까지다.
.. SPDX-License-Identifier: GPL-2.0
==========
spu_create
==========
Name
====
spu_create - create a new spu context
Synopsis
========
::
#include <sys/types.h>
#include <sys/spu.h>
int spu_create(const char *pathname, int flags, mode_t mode);
Description
===========
The spu_create system call is used on PowerPC machines that implement
the Cell Broadband Engine Architecture in order to access Synergistic
Processor Units (SPUs). It creates a new logical context for an SPU in
pathname and returns a handle to associated with it. pathname must
point to a non-existing directory in the mount point of the SPU file
system (spufs). When spu_create is successful, a directory gets cre-
ated on pathname and it is populated with files.
The returned file handle can only be passed to spu_run(2) or closed,
other operations are not defined on it. When it is closed, all associ-
ated directory entries in spufs are removed. When the last file handle
pointing either inside of the context directory or to this file
descriptor is closed, the logical SPU context is destroyed.
The parameter flags can be zero or any bitwise or'd combination of the
following constants:
SPU_RAWIO
Allow mapping of some of the hardware registers of the SPU into
user space. This flag requires the CAP_SYS_RAWIO capability, see
capabilities(7).
The mode parameter specifies the permissions used for creating the new
directory in spufs. mode is modified with the user's umask(2) value
and then used for both the directory and the files contained in it. The
file permissions mask out some more bits of mode because they typically
support only read or write access. See stat(2) for a full list of the
possible mode values.
반환값과 오류
52-98성공하면 새 file descriptor를 반환한다. 실패하면 `-1`을 반환하고 `errno`를 설정한다.
원문의 errno와 발생 조건을 보존한다.
Return Value
============
spu_create returns a new file descriptor. It may return -1 to indicate
an error condition and set errno to one of the error codes listed
below.
Errors
======
EACCES
The current user does not have write access on the spufs mount
point.
EEXIST An SPU context already exists at the given path name.
EFAULT pathname is not a valid string pointer in the current address
space.
EINVAL pathname is not a directory in the spufs mount point.
ELOOP Too many symlinks were found while resolving pathname.
EMFILE The process has reached its maximum open file limit.
ENAMETOOLONG
pathname was too long.
ENFILE The system has reached the global open file limit.
ENOENT Part of pathname could not be resolved.
ENOMEM The kernel could not allocate all resources required.
ENOSPC There are not enough SPU resources available to create a new
context or the user specific limit for the number of SPU con-
texts has been reached.
ENOSYS the functionality is not provided by the current system, because
either the hardware does not provide SPUs or the spufs module is
not loaded.
ENOTDIR
A part of pathname is not a directory.
사용 범위·파일 위치·이식성
99-123`spu_create()`는 일반 application이 직접 호출하기보다 SPU를 더 추상적으로 제공하는 library에서 사용하도록 설계됐다. 문서는 권장 library 정보로 Linux on Cell 프로젝트 URL을 제시한다.
`pathname`은 spufs mountpoint 아래여야 하며 관례상 spufs는 `/spu`에 mount한다. 이 syscall은 Linux 전용이고 ppc64 architecture에서만 구현되므로 이를 사용하는 program은 이식성이 없다.
Bugs 절은 문서에 열거된 기능을 code가 아직 모두 구현하지 않았다고 밝힌다.
호출자가 알아야 할 환경 제약이다.
Notes
=====
spu_create is meant to be used from libraries that implement a more
abstract interface to SPUs, not to be used from regular applications.
See http://www.bsc.es/projects/deepcomputing/linuxoncell/ for the rec-
ommended libraries.
Files
=====
pathname must point to a location beneath the mount point of spufs. By
convention, it gets mounted in /spu.
Conforming to
=============
This call is Linux specific and only implemented by the ppc64 architec-
ture. Programs using this system call are not portable.
Bugs
====
The code does not yet fully implement all features lined out here.
저자와 관련 문서
124-131저자는 Arnd Bergmann이다. 관련 manual page는 `capabilities(7)`, `close(2)`, `spu_run(2)`, `spufs(7)`이며, capability·수명·실행·파일 시스템 interface를 함께 확인해야 한다.
Author
======
Arnd Bergmann <[email protected]>
See Also
========
capabilities(7), close(2), spu_run(2), spufs(7)
요약·해설
spu_create.rst:1-131`spu_create()`는 ppc64 Cell 시스템에서 spufs 아래 논리 SPU context directory와 전용 handle을 만든다. `SPU_RAWIO`는 `CAP_SYS_RAWIO`를 요구하며, 마지막 handle이 닫히면 context가 파괴된다.
SPU context의 공개 수명이다.