Skip to content

Commit

Permalink
Add sigdef attribute for posix_spawn.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed May 29, 2014
1 parent fed067f commit a13f4b6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/jnr/posix/SpawnAttribute.java
Expand Up @@ -20,6 +20,10 @@ public static SpawnAttribute flags(short flags) {
return new SetFlags(flags);
}

public static SpawnAttribute sigdef(long sigdef) {
return new Sigdef(sigdef);
}

public static SpawnAttribute sigmask(long sigmask) {
return new Sigmask(sigmask);
}
Expand Down Expand Up @@ -61,4 +65,16 @@ final boolean set(POSIX posix, Pointer nativeSpawnAttr) {
}
}

private static final class Sigdef extends SpawnAttribute {
final long sigdef;

public Sigdef(long sigdef) {
this.sigdef = sigdef;
}

final boolean set(POSIX posix, Pointer nativeSpawnAttr) {
return ((UnixLibC) posix.libc()).posix_spawnattr_setsigdefault(nativeSpawnAttr, new NumberByReference(TypeAlias.u_int32_t, sigdef)) == 0;
}
}

}

0 comments on commit a13f4b6

Please sign in to comment.